Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / microsoft-uuidof-mangling.cpp
blob9bcc95f780e2f878a5ad294046f3510ec7ae931a
1 // RUN: %clang_cc1 -emit-llvm %s -o - -triple x86_64-unknown-unknown -fms-extensions | FileCheck %s --check-prefixes=CHECK,CHECK-V12
2 // RUN: %clang_cc1 -emit-llvm %s -o - -triple x86_64-unknown-unknown -fms-extensions -fclang-abi-compat=11 | FileCheck %s --check-prefixes=CHECK,CHECK-V11
4 typedef struct _GUID
6 unsigned int Data1;
7 unsigned short Data2;
8 unsigned short Data3;
9 unsigned char Data4[ 8 ];
10 } GUID;
13 template < typename T, const GUID & T_iid = __uuidof(T)>
14 class UUIDTest
16 public:
17 UUIDTest() { }
20 struct __declspec(uuid("EAFA1952-66F8-438B-8FBA-AF1BBAE42191")) TestStruct
22 int foo;
25 struct __declspec(uuid("EAFA1952-66F8-438B-8FBA-AF1BBAE42191")) OtherStruct {};
27 template <class T> void test_uuidofType(decltype(__uuidof(T)) arg) {}
29 template <class T> void test_uuidofExpr(decltype(__uuidof(T::member)) arg) {}
31 struct HasMember {
32 TestStruct member;
35 // Ensure that mangling an "expr-primary" argument is handled properly.
36 template <class T> void test_uuidofExpr2(decltype(T{}, __uuidof(HasMember::member)) arg) {}
38 template<const GUID&> struct UUIDTestTwo { UUIDTestTwo(); };
40 int main(int argc, const char * argv[])
42 UUIDTest<TestStruct> uuidof_test;
43 // Note that these variables have the same type, so the mangling of that
44 // type had better not mention TestStruct or OtherStruct!
45 UUIDTestTwo<__uuidof(TestStruct)> uuidof_test2;
46 UUIDTestTwo<__uuidof(OtherStruct)> uuidof_test3;
47 test_uuidofType<TestStruct>(GUID{});
48 test_uuidofExpr<HasMember>(GUID{});
49 test_uuidofExpr2<TestStruct>(GUID{});
50 return 0;
53 // CHECK: define{{.*}} i32 @main
54 // CHECK: call void @_ZN8UUIDTestI10TestStructL_Z42_GUID_eafa1952_66f8_438b_8fba_af1bbae42191EEC1Ev(
55 // CHECK: call void @_ZN11UUIDTestTwoIL_Z42_GUID_eafa1952_66f8_438b_8fba_af1bbae42191EEC1Ev(
56 // CHECK: call void @_ZN11UUIDTestTwoIL_Z42_GUID_eafa1952_66f8_438b_8fba_af1bbae42191EEC1Ev(
57 // CHECK-V11: call void @_Z15test_uuidofTypeI10TestStructEvDTu8__uuidoftT_E(
58 // CHECK-V12: call void @_Z15test_uuidofTypeI10TestStructEvDTu8__uuidofT_EE(
59 // CHECK-V11: call void @_Z15test_uuidofExprI9HasMemberEvDTu8__uuidofzsrT_6memberE(
60 // CHECK-V12: call void @_Z15test_uuidofExprI9HasMemberEvDTu8__uuidofXsrT_6memberEEE(
61 // CHECK-V11: call void @_Z16test_uuidofExpr2I10TestStructEvDTcmtlT_Eu8__uuidofzL_ZN9HasMember6memberEEE(
62 // CHECK-V12: call void @_Z16test_uuidofExpr2I10TestStructEvDTcmtlT_Eu8__uuidofL_ZN9HasMember6memberEEEE(
63 // CHECK: define linkonce_odr void @_ZN8UUIDTestI10TestStructL_Z42_GUID_eafa1952_66f8_438b_8fba_af1bbae42191EEC1Ev
64 // CHECK-V11: define linkonce_odr void @_Z15test_uuidofTypeI10TestStructEvDTu8__uuidoftT_E(
65 // CHECK-V12: define linkonce_odr void @_Z15test_uuidofTypeI10TestStructEvDTu8__uuidofT_EE(
66 // CHECK-V11: define linkonce_odr void @_Z15test_uuidofExprI9HasMemberEvDTu8__uuidofzsrT_6memberE(
67 // CHECK-V12: define linkonce_odr void @_Z15test_uuidofExprI9HasMemberEvDTu8__uuidofXsrT_6memberEEE(
68 // CHECK-V11: define linkonce_odr void @_Z16test_uuidofExpr2I10TestStructEvDTcmtlT_Eu8__uuidofzL_ZN9HasMember6memberEEE(
69 // CHECK-V12: define linkonce_odr void @_Z16test_uuidofExpr2I10TestStructEvDTcmtlT_Eu8__uuidofL_ZN9HasMember6memberEEEE(
70 // CHECK: define linkonce_odr void @_ZN8UUIDTestI10TestStructL_Z42_GUID_eafa1952_66f8_438b_8fba_af1bbae42191EEC2Ev