[cfe-commits] r82567 - in /cfe/trunk: lib/CodeGen/Mangle.cpp test/CodeGenCXX/mangle.cpp
Anders Carlsson
andersca at mac.com
Tue Sep 22 13:33:32 PDT 2009
Author: andersca
Date: Tue Sep 22 15:33:31 2009
New Revision: 82567
URL: http://llvm.org/viewvc/llvm-project?rev=82567&view=rev
Log:
CXXMethodDecls should always be mangled, even if they are inside an extern "C" block. Fixes PR5017.
Modified:
cfe/trunk/lib/CodeGen/Mangle.cpp
cfe/trunk/test/CodeGenCXX/mangle.cpp
Modified: cfe/trunk/lib/CodeGen/Mangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/Mangle.cpp?rev=82567&r1=82566&r2=82567&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/Mangle.cpp (original)
+++ cfe/trunk/lib/CodeGen/Mangle.cpp Tue Sep 22 15:33:31 2009
@@ -131,7 +131,7 @@
return false;
// No name mangling in a C linkage specification.
- if (isInCLinkageSpecification(FD))
+ if (!isa<CXXMethodDecl>(FD) && isInCLinkageSpecification(FD))
return false;
}
@@ -502,6 +502,9 @@
// ::= <substitution>
// FIXME: We only handle mangling of namespaces and classes at the moment.
+ while (isa<LinkageSpecDecl>(DC))
+ DC = DC->getParent();
+
if (DC->isTranslationUnit())
return;
Modified: cfe/trunk/test/CodeGenCXX/mangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle.cpp?rev=82567&r1=82566&r2=82567&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle.cpp Tue Sep 22 15:33:31 2009
@@ -137,3 +137,13 @@
int f(struct a *x) {
return x->b;
}
+
+// PR5017
+extern "C" {
+struct Debug {
+ const Debug& operator<< (unsigned a) const { }
+};
+Debug dbg;
+// CHECK: @_ZNK5DebuglsEj
+int main(void) { dbg << 32 ;}
+}
More information about the cfe-commits
mailing list