Computed length of a __func__ identifier used in an objective-c method correctly,
when creating its type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46109 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/AST/Decl.cpp b/AST/Decl.cpp
index bf1ffee..d80b5ee 100644
--- a/AST/Decl.cpp
+++ b/AST/Decl.cpp
@@ -549,6 +549,15 @@
   return NULL;
 }
 
+int ObjCMethodDecl::getSynthesizedSelectorSize() const {
+  // syntesized method name is a concatenation of -/+[class-name selector]
+  // Get length of this name.
+  int length = 4;  // for '+' or '-', '[', space in between and ']'
+  length += getSelector().getName().size(); // for selector name.
+  length += strlen(getMethodContext()->getName()); // for its class name
+  return length; 
+}
+
 ObjCInterfaceDecl *const ObjCMethodDecl::getClassInterface() const {
   if (ObjCInterfaceDecl *ID = dyn_cast<ObjCInterfaceDecl>(MethodContext))
     return ID;