From b8e7410b22fa573fb0078712439f343bc69208dd Mon Sep 17 00:00:00 2001 From: ed Date: Sun, 14 Jun 2009 09:24:02 +0000 Subject: Import Clang r73340. --- lib/CodeGen/Mangle.cpp | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'lib/CodeGen/Mangle.cpp') diff --git a/lib/CodeGen/Mangle.cpp b/lib/CodeGen/Mangle.cpp index 6ee1223..14392ab 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()) { - ; // 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()) { + // 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"; -- cgit v1.1