From 36c49e3f258dced101949edabd72e9bc3f1dedc4 Mon Sep 17 00:00:00 2001 From: dim Date: Fri, 17 Sep 2010 15:54:40 +0000 Subject: Vendor import of clang r114020 (from the release_28 branch): http://llvm.org/svn/llvm-project/cfe/branches/release_28@114020 Approved by: rpaulo (mentor) --- test/CodeGenCXX/mangle.cpp | 117 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) (limited to 'test/CodeGenCXX/mangle.cpp') diff --git a/test/CodeGenCXX/mangle.cpp b/test/CodeGenCXX/mangle.cpp index 814a759..55357c7 100644 --- a/test/CodeGenCXX/mangle.cpp +++ b/test/CodeGenCXX/mangle.cpp @@ -507,3 +507,120 @@ namespace test13 { // CHECK: define weak_odr void @_ZN6test133fooINS_1BEEEvRKNS_1AIT_EE( template void foo(const A &a); } + +namespace test14 { + extern "C" { + struct S { + static int a(), x; + }; + // CHECK: define i32 @_ZN6test141S1aEv + // CHECK: load i32* @_ZN6test141S1xE + int S::a() { return S::x; } + } +} + +// rdar://problem/8204122 +namespace test15 { + enum E { e = 3 }; + template struct S {}; + + template void f(S) {} + + // CHECK: define weak_odr void @_ZN6test151fILi7EEEvNS_1SIXplT_LNS_1EE3EEEE( + template void f<7>(S<7 + e>); +} + +// rdar://problem/8125400. Don't crash. +namespace test16 { + static union {}; + static union { union {}; }; + static union { struct {}; }; + static union { union { union {}; }; }; + static union { union { struct {}; }; }; + static union { struct { union {}; }; }; + static union { struct { struct {}; }; }; +} + +// rdar://problem/8302148 +namespace test17 { + template struct A {}; + + struct B { + static int foo(void); + }; + + template A func(void); + + // CHECK: define void @_ZN6test174testEv() + // CHECK: call {{.*}} @_ZN6test174funcINS_1BEEENS_1AIXszclsrT_3fooEEEEv() + void test() { + func(); + } +} + +// PR7891 +namespace test18 { + struct A { + int operator+(); + int operator-(); + int operator*(); + int operator&(); + }; + template struct S {}; + + template void f(S<&T::operator+>) {} + template void f(S<&A::operator+>); + + template void f(S<&T::operator- >) {} + template void f(S<&A::operator- >); + + template void f(S<&T::operator*>) {} + template void f(S<&A::operator*>); + + template void f(S<&T::operator&>) {} + template void f(S<&A::operator&>); + + // CHECK: define weak_odr void @_ZN6test181fINS_1AEEEvNS_1SIXadsrT_plEEE + // CHECK: define weak_odr void @_ZN6test181fINS_1AEEEvNS_1SIXadsrT_miEEE + // CHECK: define weak_odr void @_ZN6test181fINS_1AEEEvNS_1SIXadsrT_mlEEE + // CHECK: define weak_odr void @_ZN6test181fINS_1AEEEvNS_1SIXadsrT_anEEE +} + +// rdar://problem/8332117 +namespace test19 { + struct A { + template int f(); + int operator+(); + operator int(); + template int operator-(); + }; + + template struct S {}; + + template void g (S<&T::template f >) {} + template void g (S<&T::operator+ >) {} + template void g (S<&T::operator int>) {} + template void g (S<&T::template operator- >) {} + + // CHECK: define weak_odr void @_ZN6test191gINS_1AEEEvNS_1SIXadsrT_1fIiEEEE( + template void g(S<&A::f >); + // CHECK: define weak_odr void @_ZN6test191gINS_1AEEEvNS_1SIXadsrT_plEEE( + template void g(S<&A::operator+>); + // CHECK: define weak_odr void @_ZN6test191gINS_1AEEEvNS_1SIXadsrT_cviEEE( + template void g(S<&A::operator int>); + // CHECK: define weak_odr void @_ZN6test191gINS_1AEEEvNS_1SIXadsrT_miIdEEEE( + template void g(S<&A::operator- >); +} + +namespace test20 { + template T *f(const T&); + template T *f(T*); + + // CHECK: define weak_odr void @_ZN6test205test0IiEEvDTcl1fIPT_ELi0EEE( + template void test0(decltype(f(0))) {} + template void test0(decltype(f(0))); + + // CHECK: define weak_odr void @_ZN6test205test1IiEEvDTcl1fIEcvT__EEE( + template void test1(decltype(f<>(T()))) {} + template void test1(decltype(f<>(int()))); +} -- cgit v1.1