From: David Chisnall Date: Thu, 14 Jan 2010 14:08:19 +0000 (+0000) Subject: Made ObjC method name mangling match GCC (which does it in a stupid and broken way... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d346736dfe5ef584a2d0c9d27d217408ee394b9b;p=clang 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). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93427 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGObjCGNU.cpp b/lib/CodeGen/CGObjCGNU.cpp index a8792bde95..e7a2093aa2 100644 --- a/lib/CodeGen/CGObjCGNU.cpp +++ b/lib/CodeGen/CGObjCGNU.cpp @@ -217,8 +217,11 @@ static std::string SymbolNameForClass(const std::string &ClassName) { 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)