[cfe-commits] r91149 - in /cfe/trunk: lib/CodeGen/Mangle.cpp test/CodeGenCXX/mangle-unnamed.cpp test/CodeGenCXX/mangle.cpp
Eli Friedman
eli.friedman at gmail.com
Fri Dec 11 12:21:38 PST 2009
Author: efriedma
Date: Fri Dec 11 14:21:38 2009
New Revision: 91149
URL: http://llvm.org/viewvc/llvm-project?rev=91149&view=rev
Log:
Make sure mangling doesn't crash in another case. Add some more tests.
Added:
cfe/trunk/test/CodeGenCXX/mangle-unnamed.cpp
Modified:
cfe/trunk/lib/CodeGen/Mangle.cpp
cfe/trunk/test/CodeGenCXX/mangle.cpp
Modified: cfe/trunk/lib/CodeGen/Mangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/Mangle.cpp?rev=91149&r1=91148&r2=91149&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/Mangle.cpp (original)
+++ cfe/trunk/lib/CodeGen/Mangle.cpp Fri Dec 11 14:21:38 2009
@@ -548,7 +548,7 @@
mangleFunctionEncoding(cast<FunctionDecl>(ND->getDeclContext()));
Out << 'E';
- mangleSourceName(ND->getIdentifier());
+ mangleUnqualifiedName(ND);
}
void CXXNameMangler::manglePrefix(const DeclContext *DC) {
Added: cfe/trunk/test/CodeGenCXX/mangle-unnamed.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle-unnamed.cpp?rev=91149&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle-unnamed.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/mangle-unnamed.cpp Fri Dec 11 14:21:38 2009
@@ -0,0 +1,39 @@
+// RUN: clang-cc -emit-llvm-only -verify %s
+
+struct S {
+ virtual ~S() { }
+};
+
+// PR5706
+// Make sure this doesn't crash; the mangling doesn't matter because the name
+// doesn't have linkage.
+static struct : S { } obj8;
+
+void f() {
+ // Make sure this doesn't crash; the mangling doesn't matter because the
+ // generated vtable/etc. aren't modifiable (although it would be nice for
+ // codesize to make it consistent inside inline functions).
+ static struct : S { } obj8;
+}
+
+inline int f2() {
+ // FIXME: We don't mangle the names of a or x correctly!
+ static struct { int a() { static int x; return ++x; } } obj;
+ return obj.a();
+}
+
+int f3() { return f2(); }
+
+struct A {
+ typedef struct { int x; } *ptr;
+ ptr m;
+ int a() {
+ static struct x {
+ // FIXME: We don't mangle the names of a or x correctly!
+ int a(ptr A::*memp) { static int x; return ++x; }
+ } a;
+ return a.a(&A::m);
+ }
+};
+
+int f4() { return A().a(); }
Modified: cfe/trunk/test/CodeGenCXX/mangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle.cpp?rev=91149&r1=91148&r2=91149&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle.cpp Fri Dec 11 14:21:38 2009
@@ -228,11 +228,3 @@
template void ft8<int>();
// CHECK: @_Z3ft8IPvEN11__enable_ifIXsr11__is_scalarIT_E7__valueEvE6__typeEv
template void ft8<void*>();
-
-// PR5706
-// This example was crashing in the mangler code
-struct S8 {
- virtual ~S8() { }
-};
-
-static struct : S8 { } obj8;
More information about the cfe-commits
mailing list