From: Anders Carlsson Date: Sun, 31 May 2009 20:19:23 +0000 (+0000) Subject: Don't try to call getFileCharacteristic if the function declaration has an invalid... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8c49911e6e52f490dcef7eb181f29cc95be8ba36;p=clang Don't try to call getFileCharacteristic if the function declaration has an invalid source location (as is the case for the global allocation functions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72671 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/Mangle.cpp b/lib/CodeGen/Mangle.cpp index c09a13a59f..6ee1223a00 100644 --- a/lib/CodeGen/Mangle.cpp +++ b/lib/CodeGen/Mangle.cpp @@ -93,8 +93,9 @@ bool CXXNameMangler::mangleFunctionDecl(const FunctionDecl *FD) { !Context.getLangOptions().CPlusPlus || // "main" is not mangled in C++ FD->isMain() || - // No mangling in an "implicit extern C" header. - Context.getSourceManager().getFileCharacteristic(FD->getLocation()) + // 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))