diff options
author | Anders Carlsson <andersca@mac.com> | 2010-02-06 04:52:27 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2010-02-06 04:52:27 +0000 |
commit | aec2523ab2c91413ef2f66dc944d0d6ac6a58abe (patch) | |
tree | 20c244f372b635d722a98569b01bd4fc606336fe | |
parent | 81861abe9cd1669ca46e13866f77f7ece8c4c85f (diff) |
Only append 'L' for internal variable declarations, not all declarations. (Found by the mangle checker, yay)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95485 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/Mangle.cpp | 7 | ||||
-rw-r--r-- | test/CodeGenCXX/mangle.cpp | 4 |
2 files changed, 8 insertions, 3 deletions
diff --git a/lib/CodeGen/Mangle.cpp b/lib/CodeGen/Mangle.cpp index 9ac5956a64..a302225c7f 100644 --- a/lib/CodeGen/Mangle.cpp +++ b/lib/CodeGen/Mangle.cpp @@ -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'; diff --git a/test/CodeGenCXX/mangle.cpp b/test/CodeGenCXX/mangle.cpp index 8f45175ae8..07183782e7 100644 --- a/test/CodeGenCXX/mangle.cpp +++ b/test/CodeGenCXX/mangle.cpp @@ -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(); } |