]> granicus.if.org Git - clang/commitdiff
Only append 'L' for internal variable declarations, not all declarations. (Found...
authorAnders Carlsson <andersca@mac.com>
Sat, 6 Feb 2010 04:52:27 +0000 (04:52 +0000)
committerAnders Carlsson <andersca@mac.com>
Sat, 6 Feb 2010 04:52:27 +0000 (04:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95485 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/Mangle.cpp
test/CodeGenCXX/mangle.cpp

index 9ac5956a644f3d68397f1fc87a2fef47cef9bf15..a302225c7f772a696ce13603b4904baade55ddb8 100644 (file)
@@ -482,9 +482,10 @@ void CXXNameMangler::mangleUnqualifiedName(const NamedDecl *ND,
   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';
 
index 8f45175ae8970522abf552dd33b06dd96161de13..07183782e75e6b81196b1d76a8501315174e6e84 100644 (file)
@@ -372,3 +372,7 @@ namespace test1 {
   // CHECK: define void @_ZN5test11fINS_1XEiEEvT_IT0_E
   template void f(X<int>);
 }
+
+// CHECK: define internal void @_Z27functionWithInternalLinkagev()
+static void functionWithInternalLinkage() {  }
+void g() { functionWithInternalLinkage(); }