[cfe-commits] r95485 - in /cfe/trunk: lib/CodeGen/Mangle.cpp test/CodeGenCXX/mangle.cpp
Anders Carlsson
andersca at mac.com
Fri Feb 5 20:52:28 PST 2010
Author: andersca
Date: Fri Feb 5 22:52:27 2010
New Revision: 95485
URL: http://llvm.org/viewvc/llvm-project?rev=95485&view=rev
Log:
Only append 'L' for internal variable declarations, not all declarations. (Found by the mangle checker, yay)
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=95485&r1=95484&r2=95485&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/Mangle.cpp (original)
+++ cfe/trunk/lib/CodeGen/Mangle.cpp Fri Feb 5 22:52:27 2010
@@ -482,9 +482,10 @@
case DeclarationName::Identifier: {
if (const IdentifierInfo *II = Name.getAsIdentifierInfo()) {
// We must avoid conflicts between internally- and externally-
- // linked names in the same TU. This naming convention is the
- // same as that followed by GCC, though it shouldn't actually matter.
- if (ND && ND->getLinkage() == InternalLinkage &&
+ // linked variable declaration names in the same TU.
+ // This naming convention is the same as that followed by GCC, though it
+ // shouldn't actually matter.
+ if (ND && isa<VarDecl>(ND) && ND->getLinkage() == InternalLinkage &&
ND->getDeclContext()->isFileContext())
Out << 'L';
Modified: cfe/trunk/test/CodeGenCXX/mangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle.cpp?rev=95485&r1=95484&r2=95485&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle.cpp Fri Feb 5 22:52:27 2010
@@ -372,3 +372,7 @@
// CHECK: define void @_ZN5test11fINS_1XEiEEvT_IT0_E
template void f(X<int>);
}
+
+// CHECK: define internal void @_Z27functionWithInternalLinkagev()
+static void functionWithInternalLinkage() { }
+void g() { functionWithInternalLinkage(); }
More information about the cfe-commits
mailing list