[cfe-commits] r93427 - /cfe/trunk/lib/CodeGen/CGObjCGNU.cpp

David Chisnall csdavec at swan.ac.uk
Thu Jan 14 06:08:20 PST 2010


Author: theraven
Date: Thu Jan 14 08:08:19 2010
New Revision: 93427

URL: http://llvm.org/viewvc/llvm-project?rev=93427&view=rev
Log:
Made ObjC method name mangling match GCC (which does it in a stupid and broken way that can give conflicts on method names containing underscores, but is needed for gdb to work because gdb does not know how to read ObjC class tables and relies on the mangling).


Modified:
    cfe/trunk/lib/CodeGen/CGObjCGNU.cpp

Modified: cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCGNU.cpp?rev=93427&r1=93426&r2=93427&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCGNU.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCGNU.cpp Thu Jan 14 08:08:19 2010
@@ -217,8 +217,11 @@
 static std::string SymbolNameForMethod(const std::string &ClassName, const
   std::string &CategoryName, const std::string &MethodName, bool isClassMethod)
 {
-  return "_OBJC_METHOD_" + ClassName + "("+CategoryName+")"+
-            (isClassMethod ? "+" : "-") + MethodName;
+  std::string MethodNameColonStripped = MethodName;
+  std::replace(MethodNameColonStripped.begin(), MethodNameColonStripped.end(),
+      ':', '_');
+  return std::string(isClassMethod ? "_c_" : "_i_") + ClassName + "_" +
+    CategoryName + "_" + MethodNameColonStripped;
 }
 
 CGObjCGNU::CGObjCGNU(CodeGen::CodeGenModule &cgm)





More information about the cfe-commits mailing list