Only append 'L' for internal variable declarations, not all declarations. (Found by the mangle checker, yay)

llvm-svn: 95485
This commit is contained in:
Anders Carlsson 2010-02-06 04:52:27 +00:00
parent bdfcacbe8f
commit 2c4de4c31e
2 changed files with 8 additions and 3 deletions

View 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';

View 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(); }