comparison clang/test/CodeGenCXX/microsoft-uuidof-mangling.cpp @ 173:0572611fdcc8 llvm10 llvm12

reorgnization done
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 11:55:54 +0900 (2020-05-25)
parents 1d019706d866
children 2e18cbf3894f
comparison
equal deleted inserted replaced
172:9fbae9c8bf63 173:0572611fdcc8
20 struct __declspec(uuid("EAFA1952-66F8-438B-8FBA-AF1BBAE42191")) TestStruct 20 struct __declspec(uuid("EAFA1952-66F8-438B-8FBA-AF1BBAE42191")) TestStruct
21 { 21 {
22 int foo; 22 int foo;
23 }; 23 };
24 24
25 struct __declspec(uuid("EAFA1952-66F8-438B-8FBA-AF1BBAE42191")) OtherStruct {};
26
25 template <class T> void test_uuidofType(void *arg[sizeof(__uuidof(T))] = 0) {} 27 template <class T> void test_uuidofType(void *arg[sizeof(__uuidof(T))] = 0) {}
26 28
27 template <class T> void test_uuidofExpr(void *arg[sizeof(__uuidof(typename T::member))] = 0) {} 29 template <class T> void test_uuidofExpr(void *arg[sizeof(__uuidof(typename T::member))] = 0) {}
28 30
29 struct HasMember { typedef TestStruct member; }; 31 struct HasMember { typedef TestStruct member; };
30 32
33 template<const GUID&> struct UUIDTestTwo { UUIDTestTwo(); };
34
31 int main(int argc, const char * argv[]) 35 int main(int argc, const char * argv[])
32 { 36 {
33
34 UUIDTest<TestStruct> uuidof_test; 37 UUIDTest<TestStruct> uuidof_test;
38 // Note that these variables have the same type, so the mangling of that
39 // type had better not mention TestStruct or OtherStruct!
40 UUIDTestTwo<__uuidof(TestStruct)> uuidof_test2;
41 UUIDTestTwo<__uuidof(OtherStruct)> uuidof_test3;
35 test_uuidofType<TestStruct>(); 42 test_uuidofType<TestStruct>();
36 test_uuidofExpr<HasMember>(); 43 test_uuidofExpr<HasMember>();
37 return 0; 44 return 0;
38 } 45 }
39 46
40 // CHECK: define i32 @main 47 // CHECK: define i32 @main
41 // CHECK: call void @_ZN8UUIDTestI10TestStructXu8__uuidoftS0_EEC1Ev 48 // CHECK: call void @_ZN8UUIDTestI10TestStructL_Z42_GUID_eafa1952_66f8_438b_8fba_af1bbae42191EEC1Ev
49 // CHECK: call void @_ZN11UUIDTestTwoIL_Z42_GUID_eafa1952_66f8_438b_8fba_af1bbae42191EEC1Ev
50 // CHECK: call void @_ZN11UUIDTestTwoIL_Z42_GUID_eafa1952_66f8_438b_8fba_af1bbae42191EEC1Ev
42 // CHECK: call void @_Z15test_uuidofTypeI10TestStructEvPPv(i8** null) 51 // CHECK: call void @_Z15test_uuidofTypeI10TestStructEvPPv(i8** null)
43 // CHECK: call void @_Z15test_uuidofExprI9HasMemberEvPPv(i8** null) 52 // CHECK: call void @_Z15test_uuidofExprI9HasMemberEvPPv(i8** null)
44 53
45 // CHECK: define linkonce_odr void @_ZN8UUIDTestI10TestStructXu8__uuidoftS0_EEC1Ev 54 // CHECK: define linkonce_odr void @_ZN8UUIDTestI10TestStructL_Z42_GUID_eafa1952_66f8_438b_8fba_af1bbae42191EEC1Ev
46 // CHECK: define linkonce_odr void @_Z15test_uuidofTypeI10TestStructEvPPv 55 // CHECK: define linkonce_odr void @_Z15test_uuidofTypeI10TestStructEvPPv
47 // CHECK: define linkonce_odr void @_Z15test_uuidofExprI9HasMemberEvPPv 56 // CHECK: define linkonce_odr void @_Z15test_uuidofExprI9HasMemberEvPPv
48 // CHECK: define linkonce_odr void @_ZN8UUIDTestI10TestStructXu8__uuidoftS0_EEC2Ev 57 // CHECK: define linkonce_odr void @_ZN8UUIDTestI10TestStructL_Z42_GUID_eafa1952_66f8_438b_8fba_af1bbae42191EEC2Ev