diff options
Diffstat (limited to 'test/CodeGenCXX/mangle-ms.cpp')
-rw-r--r-- | test/CodeGenCXX/mangle-ms.cpp | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/test/CodeGenCXX/mangle-ms.cpp b/test/CodeGenCXX/mangle-ms.cpp index 0da5c6f..c2a3114 100644 --- a/test/CodeGenCXX/mangle-ms.cpp +++ b/test/CodeGenCXX/mangle-ms.cpp @@ -21,6 +21,10 @@ int _c(void) {return N::anonymous + c;} // CHECK-DAG: @"\01?_c@@YAHXZ" // X64-DAG: @"\01?_c@@YAHXZ" +const int &NeedsReferenceTemporary = 2; +// CHECK-DAG: @"\01?NeedsReferenceTemporary@@3ABHB" = constant i32* @"\01?$RT1@NeedsReferenceTemporary@@3ABHB" +// X64-DAG: @"\01?NeedsReferenceTemporary@@3AEBHEB" = constant i32* @"\01?$RT1@NeedsReferenceTemporary@@3AEBHEB" + class foo { static const short d; // CHECK-DAG: @"\01?d@foo@@0FB" @@ -389,3 +393,64 @@ template void fn_tmpl<extern_c_func>(); extern "C" void __attribute__((overloadable)) overloaded_fn() {} // CHECK-DAG: @"\01?overloaded_fn@@$$J0YAXXZ" + +namespace UnnamedType { +struct S { + typedef struct {} *T1[1]; + typedef struct {} T2; + typedef struct {} *T3, T4; + using T5 = struct {}; + using T6 = struct {} *; +}; +void f(S::T1) {} +void f(S::T2) {} +void f(S::T3) {} +void f(S::T4) {} +void f(S::T5) {} +void f(S::T6) {} +// CHECK-DAG: @"\01?f@UnnamedType@@YAXQAPAU<unnamed-type-T1>@S@1@@Z" +// CHECK-DAG: @"\01?f@UnnamedType@@YAXUT2@S@1@@Z" +// CHECK-DAG: @"\01?f@UnnamedType@@YAXPAUT4@S@1@@Z" +// CHECK-DAG: @"\01?f@UnnamedType@@YAXUT4@S@1@@Z" +// CHECK-DAG: @"\01?f@UnnamedType@@YAXUT5@S@1@@Z" +// CHECK-DAG: @"\01?f@UnnamedType@@YAXPAU<unnamed-type-T6>@S@1@@Z" + +// X64-DAG: @"\01?f@UnnamedType@@YAXQEAPEAU<unnamed-type-T1>@S@1@@Z" +// X64-DAG: @"\01?f@UnnamedType@@YAXUT2@S@1@@Z" +// X64-DAG: @"\01?f@UnnamedType@@YAXPEAUT4@S@1@@Z"(%"struct.UnnamedType::S::T4" +// X64-DAG: @"\01?f@UnnamedType@@YAXUT4@S@1@@Z" +// X64-DAG: @"\01?f@UnnamedType@@YAXUT5@S@1@@Z" +// X64-DAG: @"\01?f@UnnamedType@@YAXPEAU<unnamed-type-T6>@S@1@@Z" +} + +namespace PassObjectSize { +// NOTE: This mangling is subject to change. +// Reiterating from the comment in MicrosoftMangle, the scheme is pretend a +// parameter of type __clang::__pass_object_sizeN exists after each pass object +// size param P, where N is the Type of the pass_object_size attribute on P. +// +// e.g. we want to mangle: +// void foo(void *const __attribute__((pass_object_size(0)))); +// as if it were +// namespace __clang { enum __pass_object_size0 : size_t {}; } +// void foo(void *const, __clang::__pass_object_size0); +// where __clang is a top-level namespace. + +// CHECK-DAG: define i32 @"\01?foo@PassObjectSize@@YAHQAHW4__pass_object_size0@__clang@@@Z" +int foo(int *const i __attribute__((pass_object_size(0)))) { return 0; } +// CHECK-DAG: define i32 @"\01?bar@PassObjectSize@@YAHQAHW4__pass_object_size1@__clang@@@Z" +int bar(int *const i __attribute__((pass_object_size(1)))) { return 0; } +// CHECK-DAG: define i32 @"\01?qux@PassObjectSize@@YAHQAHW4__pass_object_size1@__clang@@0W4__pass_object_size0@3@@Z" +int qux(int *const i __attribute__((pass_object_size(1))), int *const j __attribute__((pass_object_size(0)))) { return 0; } +// CHECK-DAG: define i32 @"\01?zot@PassObjectSize@@YAHQAHW4__pass_object_size1@__clang@@01@Z" +int zot(int *const i __attribute__((pass_object_size(1))), int *const j __attribute__((pass_object_size(1)))) { return 0; } +} + +namespace Atomic { +// CHECK-DAG: define void @"\01?f@Atomic@@YAXU?$_Atomic@H@__clang@@@Z"( +void f(_Atomic(int)) {} +} +namespace Complex { +// CHECK-DAG: define void @"\01?f@Complex@@YAXU?$_Complex@H@__clang@@@Z"( +void f(_Complex int) {} +} |