r175166 - Mangle extern "C" functions whose names are not simple identifiers.
Rafael Espindola
rafael.espindola at gmail.com
Thu Feb 14 07:38:59 PST 2013
Author: rafael
Date: Thu Feb 14 09:38:59 2013
New Revision: 175166
URL: http://llvm.org/viewvc/llvm-project?rev=175166&view=rev
Log:
Mangle extern "C" functions whose names are not simple identifiers.
Modified:
cfe/trunk/lib/AST/ItaniumMangle.cpp
cfe/trunk/test/CodeGenCXX/c-linkage.cpp
Modified: cfe/trunk/lib/AST/ItaniumMangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ItaniumMangle.cpp?rev=175166&r1=175165&r2=175166&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ItaniumMangle.cpp (original)
+++ cfe/trunk/lib/AST/ItaniumMangle.cpp Thu Feb 14 09:38:59 2013
@@ -373,8 +373,8 @@ bool ItaniumMangleContext::shouldMangleD
if (FD->hasAttr<OverloadableAttr>())
return true;
- // C functions and "main" are not mangled.
- if (FD->isMain() || L == CLanguageLinkage)
+ // "main" is not mangled.
+ if (FD->isMain())
return false;
// C++ functions and those whose names are not a simple identifier need
@@ -382,6 +382,10 @@ bool ItaniumMangleContext::shouldMangleD
if (!FD->getDeclName().isIdentifier() || L == CXXLanguageLinkage)
return true;
+ // C functions are not mangled.
+ if (L == CLanguageLinkage)
+ return false;
+
// FIXME: Users assume they know the mangling of static functions
// declared in extern "C" contexts, so we cannot always mangle them.
// As an improvement, maybe we could mangle them only if they are actually
Modified: cfe/trunk/test/CodeGenCXX/c-linkage.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/c-linkage.cpp?rev=175166&r1=175165&r2=175166&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/c-linkage.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/c-linkage.cpp Thu Feb 14 09:38:59 2013
@@ -22,3 +22,10 @@ extern "C" {
test2_f();
}
}
+
+extern "C" {
+ struct test3_s {
+ };
+ bool operator==(const int& a, const test3_s& b) {
+ }
+}
More information about the cfe-commits
mailing list