[cfe-commits] r65200 - in /cfe/trunk: lib/CodeGen/Mangle.cpp test/CodeGen/mangle.c
Daniel Dunbar
daniel at zuster.org
Fri Feb 20 15:09:28 PST 2009
Author: ddunbar
Date: Fri Feb 20 17:09:27 2009
New Revision: 65200
URL: http://llvm.org/viewvc/llvm-project?rev=65200&view=rev
Log:
We must always mangle attribute overloadable functions; even if in a
system header.
- Prevents a codegen crash when anything used anything in tgmath! :)
Added:
cfe/trunk/test/CodeGen/mangle.c
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=65200&r1=65199&r2=65200&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/Mangle.cpp (original)
+++ cfe/trunk/lib/CodeGen/Mangle.cpp Fri Feb 20 17:09:27 2009
@@ -62,14 +62,14 @@
// FIXME: Actually use a visitor to decode these?
if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
bool RequiresMangling = false;
- // No mangled in an "implicit extern C" header.
- if (Context.getSourceManager().getFileCharacteristic(FD->getLocation())
- == SrcMgr::C_ExternCSystem)
- RequiresMangling = false;
// Clang's "overloadable" attribute extension to C/C++ implies
// name mangling (always).
- else if (FD->getAttr<OverloadableAttr>())
+ if (FD->getAttr<OverloadableAttr>())
RequiresMangling = true;
+ // No mangled in an "implicit extern C" header.
+ else if (Context.getSourceManager().getFileCharacteristic(FD->getLocation())
+ == SrcMgr::C_ExternCSystem)
+ RequiresMangling = false;
else if (Context.getLangOptions().CPlusPlus) {
// C++ requires name mangling, unless we're in a C linkage
// specification.
Added: cfe/trunk/test/CodeGen/mangle.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/mangle.c?rev=65200&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/mangle.c (added)
+++ cfe/trunk/test/CodeGen/mangle.c Fri Feb 20 17:09:27 2009
@@ -0,0 +1,9 @@
+// RUN: clang -arch i386 -emit-llvm -o %t %s &&
+// RUN: grep '@_Z2f0i' %t &&
+// RUN: grep '@_Z2f0l' %t
+
+// Make sure we mangle overloadable, even in C system headers.
+
+# 1 "somesystemheader.h" 1 3 4
+void __attribute__((__overloadable__)) f0(int a) {}
+void __attribute__((__overloadable__)) f0(long b) {}
More information about the cfe-commits
mailing list