aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/Mangle.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-11-07 07:15:03 +0000
committerAnders Carlsson <andersca@mac.com>2009-11-07 07:15:03 +0000
commita1e1622d1549c470acc999c4399456863e58a011 (patch)
treef800cbf71f4436c8566aed0f38fe8dbbbf694635 /lib/CodeGen/Mangle.cpp
parentd8fe2d56fb5463c9d109e8c6dab2e98b06bee186 (diff)
Always mangle functions with special names. Fixes PR5420.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86350 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/Mangle.cpp')
-rw-r--r--lib/CodeGen/Mangle.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/CodeGen/Mangle.cpp b/lib/CodeGen/Mangle.cpp
index 081156cb6e..94abcbe390 100644
--- a/lib/CodeGen/Mangle.cpp
+++ b/lib/CodeGen/Mangle.cpp
@@ -129,8 +129,10 @@ 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>()) {
+ // (always) as does passing a C++ member function and a function
+ // whose name is not a simple identifier.
+ if (!FD->hasAttr<OverloadableAttr>() && !isa<CXXMethodDecl>(FD) &&
+ FD->getDeclName().isIdentifier()) {
// C functions are not mangled, and "main" is never mangled.
if (!Context.getASTContext().getLangOptions().CPlusPlus || FD->isMain())
return false;
@@ -142,7 +144,7 @@ bool CXXNameMangler::mangleFunctionDecl(const FunctionDecl *FD) {
return false;
// No name mangling in a C linkage specification.
- if (!isa<CXXMethodDecl>(FD) && isInCLinkageSpecification(FD))
+ if (isInCLinkageSpecification(FD))
return false;
}