Use the unmangled name for the display name in Objective-C debug info.  This should have no effect with the Mac runtime where clang (unlike GCC) uses the display name symbol name.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112833 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp
index 939b6f7..d59faa1 100644
--- a/lib/CodeGen/CGDebugInfo.cpp
+++ b/lib/CodeGen/CGDebugInfo.cpp
@@ -1471,6 +1471,20 @@
     Name = getFunctionName(FD);
     // Use mangled name as linkage name for c/c++ functions.
     LinkageName = CGM.getMangledName(GD);
+  } else if (const ObjCMethodDecl *OMD = dyn_cast<ObjCMethodDecl>(D)) {
+    llvm::SmallString<256> MethodName;
+    llvm::raw_svector_ostream OS(MethodName);
+    OS << (OMD->isInstanceMethod() ? '-' : '+') << '[';
+    const DeclContext *DC = OMD->getDeclContext();
+    if (const ObjCImplementationDecl *OID = dyn_cast<const ObjCImplementationDecl>(DC)) {
+       OS << OID->getName();
+    } else if (const ObjCCategoryImplDecl *OCD = dyn_cast<const ObjCCategoryImplDecl>(DC)){
+        OS << ((NamedDecl *)OCD)->getIdentifier()->getNameStart() << '(' <<
+            OCD->getIdentifier()->getNameStart() << ')';
+    }
+    OS << ' ' << OMD->getSelector().getAsString() << ']';
+    Name = MethodName;
+    LinkageName = Name;
   } else {
     // Use llvm function name as linkage name.
     Name = Fn->getName();