[cfe-commits] r86350 - in /cfe/trunk: lib/CodeGen/Mangle.cpp test/CodeGenCXX/mangle-system-header.cpp
Anders Carlsson
andersca at mac.com
Fri Nov 6 23:15:03 PST 2009
Author: andersca
Date: Sat Nov 7 01:15:03 2009
New Revision: 86350
URL: http://llvm.org/viewvc/llvm-project?rev=86350&view=rev
Log:
Always mangle functions with special names. Fixes PR5420.
Added:
cfe/trunk/test/CodeGenCXX/mangle-system-header.cpp
Modified:
cfe/trunk/lib/CodeGen/Mangle.cpp
Modified: cfe/trunk/lib/CodeGen/Mangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/Mangle.cpp?rev=86350&r1=86349&r2=86350&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/Mangle.cpp (original)
+++ cfe/trunk/lib/CodeGen/Mangle.cpp Sat Nov 7 01:15:03 2009
@@ -129,8 +129,10 @@
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 @@
return false;
// No name mangling in a C linkage specification.
- if (!isa<CXXMethodDecl>(FD) && isInCLinkageSpecification(FD))
+ if (isInCLinkageSpecification(FD))
return false;
}
Added: cfe/trunk/test/CodeGenCXX/mangle-system-header.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle-system-header.cpp?rev=86350&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle-system-header.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/mangle-system-header.cpp Sat Nov 7 01:15:03 2009
@@ -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*) {}
More information about the cfe-commits
mailing list