Always mangle functions with special names. Fixes PR5420.

llvm-svn: 86350
This commit is contained in:
Anders Carlsson 2009-11-07 07:15:03 +00:00
parent 5091272fdf
commit c0a3561f0f
2 changed files with 12 additions and 3 deletions

View File

@ -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;
}

View File

@ -0,0 +1,7 @@
// RUN: clang-cc -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s
// PR5420
# 1 "fake_system_header.h" 1 3 4
// CHECK: define void @_ZdlPvS_(
void operator delete (void*, void*) {}