summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/mangle.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2012-11-14 01:52:05 +0000
committerDavid Blaikie <dblaikie@gmail.com>2012-11-14 01:52:05 +0000
commit095deba5336bfaf275f4837a5f229e58f9a927c0 (patch)
tree443f55dab57c503f362b220c6622157e105b40fd /clang/test/CodeGenCXX/mangle.cpp
parent5f265fb124f30a7179f4f65f7c4c37262f9f6d4e (diff)
downloadbcm5719-llvm-095deba5336bfaf275f4837a5f229e58f9a927c0.tar.gz
bcm5719-llvm-095deba5336bfaf275f4837a5f229e58f9a927c0.zip
Provide the correct mangling and linkage for certain unnamed nested classes.
This corrects the mangling and linkage of classes (& their member functions) in cases like this: struct foo { struct { void func() { ... } } x; }; we were accidentally giving this nested unnamed struct 'no' linkage where it should've had the linkage of the outer class. The mangling was incorrecty too, mangling as TU-wide unnamed type mangling of $_X rather than class-scoped mangling of UtX_. This also fixes -Wunused-member-function which would incorrectly diagnose 'func' as unused due to it having no linkage & thus appearing to be TU-local when in fact it might be correctly used in another TU. Similar mangling should be applied to function local classes in similar cases but I've deferred that for a subsequent patch. Review/discussion by Richard Smith, John McCall, & especially Eli Friedman. llvm-svn: 167906
Diffstat (limited to 'clang/test/CodeGenCXX/mangle.cpp')
-rw-r--r--clang/test/CodeGenCXX/mangle.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/clang/test/CodeGenCXX/mangle.cpp b/clang/test/CodeGenCXX/mangle.cpp
index ba1b3bf5acd..5dad030d5ea 100644
--- a/clang/test/CodeGenCXX/mangle.cpp
+++ b/clang/test/CodeGenCXX/mangle.cpp
@@ -218,7 +218,7 @@ struct S7 {
// PR5139
// CHECK: @_ZN2S7C1Ev
// CHECK: @_ZN2S7C2Ev
-// CHECK: @"_ZN2S73$_0C1Ev"
+// CHECK: @_ZN2S7Ut_C1Ev
S7::S7() {}
// PR5063
@@ -852,3 +852,23 @@ namespace test36 {
// CHECK: define weak_odr {{.*}} @_ZN6test362f1IJifEEENS_1AIXsZfp_EEEDpT_
template A<2> f1(int, float);
}
+
+namespace test37 {
+ struct foo {
+ struct {
+ } a;
+ typedef struct { } b;
+ typedef struct { } *c;
+ struct {
+ } d;
+ };
+ template<typename T> void func(T) { }
+ void test() {
+ // CHECK: define linkonce_odr void @_ZN6test374funcINS_3fooUt_EEEvT_
+ func(foo().a);
+ // CHECK: define linkonce_odr void @_ZN6test374funcINS_3fooUt0_EEEvT_
+ func(*foo::c());
+ // CHECK: define linkonce_odr void @_ZN6test374funcINS_3fooUt1_EEEvT_
+ func(foo().d);
+ }
+}
OpenPOWER on IntegriCloud