diff options
author | Chris Lattner <sabre@nondot.org> | 2009-06-13 23:34:16 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-06-13 23:34:16 +0000 |
commit | 783601d8c58deb97037f0f91161c5a1b89d5c4c9 (patch) | |
tree | da06775b552afccfc2f660c6b3feecc72e0aff41 /lib/CodeGen/Mangle.cpp | |
parent | 0d456588acac0713a7c33063922d35a8cc8c658e (diff) |
Simplify mangleFunctionDecl by unnesting a crazy condition. This fixes
the check for extern "c" system headers, which should prevent functiondecls
from being mangled.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73311 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/Mangle.cpp')
-rw-r--r-- | lib/CodeGen/Mangle.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/lib/CodeGen/Mangle.cpp b/lib/CodeGen/Mangle.cpp index 6ee1223a00..14392ab6e7 100644 --- a/lib/CodeGen/Mangle.cpp +++ b/lib/CodeGen/Mangle.cpp @@ -87,19 +87,20 @@ static bool isInCLinkageSpecification(const Decl *D) { bool CXXNameMangler::mangleFunctionDecl(const FunctionDecl *FD) { // Clang's "overloadable" attribute extension to C/C++ implies // name mangling (always). - if (FD->hasAttr<OverloadableAttr>()) { - ; // fall into mangling code unconditionally. - } else if (// C functions are not mangled - !Context.getLangOptions().CPlusPlus || - // "main" is not mangled in C++ - FD->isMain() || - // No mangling in an "implicit extern C" header. - (FD->getLocation().isValid() && - Context.getSourceManager().getFileCharacteristic(FD->getLocation())) - == SrcMgr::C_ExternCSystem || - // No name mangling in a C linkage specification. - isInCLinkageSpecification(FD)) - return false; + if (!FD->hasAttr<OverloadableAttr>()) { + // C functions are not mangled, and "main" is never mangled. + if (!Context.getLangOptions().CPlusPlus || FD->isMain()) + return false; + + // No mangling in an "implicit extern C" header. + if (FD->getLocation().isValid() && + Context.getSourceManager().isInExternCSystemHeader(FD->getLocation())) + return false; + + // No name mangling in a C linkage specification. + if (isInCLinkageSpecification(FD)) + return false; + } // If we get here, mangle the decl name! Out << "_Z"; |