diff options
author | John McCall <rjmccall@apple.com> | 2011-03-22 06:34:45 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-03-22 06:34:45 +0000 |
commit | 290b32b90f4c233aca0c855b9318fb5198f1d5f5 (patch) | |
tree | 860bbaf8bbb0bbc74b5349ffb3469f7477f906be /clang/lib/AST/ItaniumMangle.cpp | |
parent | 857e535520e81ac550fe83b5de190d1255ddbc4b (diff) | |
download | bcm5719-llvm-290b32b90f4c233aca0c855b9318fb5198f1d5f5.tar.gz bcm5719-llvm-290b32b90f4c233aca0c855b9318fb5198f1d5f5.zip |
File-scope static functions need to be mangled with 'L' so that
they don't collide with file-scope extern functions from the same
translation unit. This is basically a matter of applying the same
logic to FunctionDecls as we were previously applying to VarDecls.
llvm-svn: 128072
Diffstat (limited to 'clang/lib/AST/ItaniumMangle.cpp')
-rw-r--r-- | clang/lib/AST/ItaniumMangle.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp index bceed081378..bb274a96f1c 100644 --- a/clang/lib/AST/ItaniumMangle.cpp +++ b/clang/lib/AST/ItaniumMangle.cpp @@ -695,10 +695,12 @@ void CXXNameMangler::mangleUnqualifiedName(const NamedDecl *ND, case DeclarationName::Identifier: { if (const IdentifierInfo *II = Name.getAsIdentifierInfo()) { // We must avoid conflicts between internally- and externally- - // 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 && + // linked variable and function declaration names in the same TU: + // void test() { extern void foo(); } + // static void foo(); + // This naming convention is the same as that followed by GCC, + // though it shouldn't actually matter. + if (ND && ND->getLinkage() == InternalLinkage && ND->getDeclContext()->isFileContext()) Out << 'L'; |