diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2012-08-15 20:02:54 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2012-08-15 20:02:54 +0000 |
commit | 56d91b49b13fe55c918afbda19f6165b5fbff87a (patch) | |
tree | 9abb1a658a297776086f4e0dfa6ca533de02104e /test/CodeGenCXX/mangle-ms.cpp | |
parent | 41e20f564abdb05101d6b2b29c59459a966c22cc (diff) | |
download | src-test2-56d91b49b13fe55c918afbda19f6165b5fbff87a.tar.gz src-test2-56d91b49b13fe55c918afbda19f6165b5fbff87a.zip |
Notes
Diffstat (limited to 'test/CodeGenCXX/mangle-ms.cpp')
-rw-r--r-- | test/CodeGenCXX/mangle-ms.cpp | 73 |
1 files changed, 66 insertions, 7 deletions
diff --git a/test/CodeGenCXX/mangle-ms.cpp b/test/CodeGenCXX/mangle-ms.cpp index fe5fde1a1b3b..f392c1701edd 100644 --- a/test/CodeGenCXX/mangle-ms.cpp +++ b/test/CodeGenCXX/mangle-ms.cpp @@ -12,6 +12,13 @@ // CHECK: @"\01?j@@3P6GHCE@ZA" // CHECK: @"\01?k@@3PTfoo@@DA" // CHECK: @"\01?l@@3P8foo@@AEHH@ZA" +// CHECK: @"\01?color1@@3PANA" + +// FIXME: The following three tests currently fail, see PR13182. +// Replace "CHECK-NOT" with "CHECK" when it is fixed. +// CHECK-NOT: @"\01?color2@@3QBNB" +// CHECK-NOT: @"\01?color3@@3QAY02$$CBNA" +// CHECK-NOT: @"\01?color4@@3QAY02$$CBNA" int a; @@ -39,8 +46,13 @@ public: foo(char *q){} //CHECK: @"\01??0foo@@QAE@PAD@Z" + + static foo* static_method() { return 0; } + }f,s1(1),s2((char*)0); +typedef foo (foo2); + struct bar { static int g; }; @@ -57,8 +69,17 @@ enum quux { qthree }; -int foo::operator+(int a) {return a;} -// CHECK: @"\01??Hfoo@@QAEHH@Z" +foo bar() { return foo(); } +//CHECK: @"\01?bar@@YA?AVfoo@@XZ" + +int foo::operator+(int a) { +//CHECK: @"\01??Hfoo@@QAEHH@Z" + + foo::static_method(); +//CHECK: @"\01?static_method@foo@@SAPAV1@XZ" + bar(); + return a; +} const short foo::d = 0; volatile long foo::e; @@ -72,9 +93,9 @@ int i[10][20]; int (__stdcall *j)(signed char, unsigned char); -const volatile char foo::*k; +const volatile char foo2::*k; -int (foo::*l)(int); +int (foo2::*l)(int); // Static functions are mangled, too. // Also make sure calling conventions, arglists, and throw specs work. @@ -99,7 +120,45 @@ void delta(int * const a, const long &) {} void epsilon(int a[][10][20]) {} // CHECK: @"\01?epsilon@@YAXQAY19BE@H@Z" -// Blocks mangling (Clang extension). -void zeta(int (^)(int, int)) {} -// CHECK: @"\01?zeta@@YAXP_EAHHH@Z@Z" +void zeta(int (*)(int, int)) {} +// CHECK: @"\01?zeta@@YAXP6AHHH@Z@Z" + +// Blocks mangling (Clang extension). A block should be mangled slightly +// differently from a similar function pointer. +void eta(int (^)(int, int)) {} +// CHECK: @"\01?eta@@YAXP_EAHHH@Z@Z" + +void operator_new_delete() { + char *ptr = new char; +// CHECK: @"\01??2@YAPAXI@Z" + + delete ptr; +// CHECK: @"\01??3@YAXPAX@Z" + + char *array = new char[42]; +// CHECK: @"\01??_U@YAPAXI@Z" + + delete [] array; +// CHECK: @"\01??_V@YAXPAX@Z" +} +// PR13022 +void (redundant_parens)(); +void redundant_parens_use() { redundant_parens(); } +// CHECK: @"\01?redundant_parens@@YAXXZ" + +// PR13182, PR13047 +typedef double RGB[3]; +RGB color1; +extern const RGB color2 = {}; +extern RGB const color3[5] = {}; +extern RGB const ((color4)[5]) = {}; + +// PR12603 +enum E {}; +// CHECK: "\01?fooE@@YA?AW4E@@XZ" +E fooE() { return E(); } + +class X {}; +// CHECK: "\01?fooX@@YA?AVX@@XZ" +X fooX() { return X(); } |