1 // RUN: %clang_cc1 -triple x86_64-unknown-linux -fsanitize=cfi-icall -fsanitize-trap=cfi-icall -fsanitize-cfi-icall-experimental-normalize-integers -emit-llvm -o - %s | FileCheck %s
3 // Test that integer types are normalized for cross-language CFI support with
4 // other languages that can't represent and encode C/C++ integer types.
6 void foo0(char arg
) { }
7 // CHECK: define{{.*}}foo0{{.*}}!type ![[TYPE0:[0-9]+]] !type !{{[0-9]+}}
8 void foo1(char arg1
, signed char arg2
) { }
9 // CHECK: define{{.*}}foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}}
10 void foo2(char arg1
, signed char arg2
, signed char arg3
) { }
11 // CHECK: define{{.*}}foo2{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}}
12 void foo3(int arg
) { }
13 // CHECK: define{{.*}}foo3{{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}}
14 void foo4(int arg1
, int arg2
) { }
15 // CHECK: define{{.*}}foo4{{.*}}!type ![[TYPE4:[0-9]+]] !type !{{[0-9]+}}
16 void foo5(int arg1
, int arg2
, int arg3
) { }
17 // CHECK: define{{.*}}foo5{{.*}}!type ![[TYPE5:[0-9]+]] !type !{{[0-9]+}}
18 void foo6(long arg
) { }
19 // CHECK: define{{.*}}foo6{{.*}}!type ![[TYPE6:[0-9]+]] !type !{{[0-9]+}}
20 void foo7(long arg1
, long long arg2
) { }
21 // CHECK: define{{.*}}foo7{{.*}}!type ![[TYPE7:[0-9]+]] !type !{{[0-9]+}}
22 void foo8(long arg1
, long long arg2
, long long arg3
) { }
23 // CHECK: define{{.*}}foo8{{.*}}!type ![[TYPE8:[0-9]+]] !type !{{[0-9]+}}
24 void foo9(short arg
) { }
25 // CHECK: define{{.*}}foo9{{.*}}!type ![[TYPE9:[0-9]+]] !type !{{[0-9]+}}
26 void foo10(short arg1
, short arg2
) { }
27 // CHECK: define{{.*}}foo10{{.*}}!type ![[TYPE10:[0-9]+]] !type !{{[0-9]+}}
28 void foo11(short arg1
, short arg2
, short arg3
) { }
29 // CHECK: define{{.*}}foo11{{.*}}!type ![[TYPE11:[0-9]+]] !type !{{[0-9]+}}
30 void foo12(unsigned char arg
) { }
31 // CHECK: define{{.*}}foo12{{.*}}!type ![[TYPE12:[0-9]+]] !type !{{[0-9]+}}
32 void foo13(unsigned char arg1
, unsigned char arg2
) { }
33 // CHECK: define{{.*}}foo13{{.*}}!type ![[TYPE13:[0-9]+]] !type !{{[0-9]+}}
34 void foo14(unsigned char arg1
, unsigned char arg2
, unsigned char arg3
) { }
35 // CHECK: define{{.*}}foo14{{.*}}!type ![[TYPE14:[0-9]+]] !type !{{[0-9]+}}
36 void foo15(unsigned int arg
) { }
37 // CHECK: define{{.*}}foo15{{.*}}!type ![[TYPE15:[0-9]+]] !type !{{[0-9]+}}
38 void foo16(unsigned int arg1
, unsigned int arg2
) { }
39 // CHECK: define{{.*}}foo16{{.*}}!type ![[TYPE16:[0-9]+]] !type !{{[0-9]+}}
40 void foo17(unsigned int arg1
, unsigned int arg2
, unsigned int arg3
) { }
41 // CHECK: define{{.*}}foo17{{.*}}!type ![[TYPE17:[0-9]+]] !type !{{[0-9]+}}
42 void foo18(unsigned long arg
) { }
43 // CHECK: define{{.*}}foo18{{.*}}!type ![[TYPE18:[0-9]+]] !type !{{[0-9]+}}
44 void foo19(unsigned long arg1
, unsigned long long arg2
) { }
45 // CHECK: define{{.*}}foo19{{.*}}!type ![[TYPE19:[0-9]+]] !type !{{[0-9]+}}
46 void foo20(unsigned long arg1
, unsigned long long arg2
, unsigned long long arg3
) { }
47 // CHECK: define{{.*}}foo20{{.*}}!type ![[TYPE20:[0-9]+]] !type !{{[0-9]+}}
48 void foo21(unsigned short arg
) { }
49 // CHECK: define{{.*}}foo21{{.*}}!type ![[TYPE21:[0-9]+]] !type !{{[0-9]+}}
50 void foo22(unsigned short arg1
, unsigned short arg2
) { }
51 // CHECK: define{{.*}}foo22{{.*}}!type ![[TYPE22:[0-9]+]] !type !{{[0-9]+}}
52 void foo23(unsigned short arg1
, unsigned short arg2
, unsigned short arg3
) { }
53 // CHECK: define{{.*}}foo23{{.*}}!type ![[TYPE23:[0-9]+]] !type !{{[0-9]+}}
55 // CHECK: ![[TYPE0]] = !{i64 0, !"_ZTSFvu2i8E.normalized"}
56 // CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFvu2i8S_E.normalized"}
57 // CHECK: ![[TYPE2]] = !{i64 0, !"_ZTSFvu2i8S_S_E.normalized"}
58 // CHECK: ![[TYPE3]] = !{i64 0, !"_ZTSFvu3i32E.normalized"}
59 // CHECK: ![[TYPE4]] = !{i64 0, !"_ZTSFvu3i32S_E.normalized"}
60 // CHECK: ![[TYPE5]] = !{i64 0, !"_ZTSFvu3i32S_S_E.normalized"}
61 // CHECK: ![[TYPE6]] = !{i64 0, !"_ZTSFvu3i64E.normalized"}
62 // CHECK: ![[TYPE7]] = !{i64 0, !"_ZTSFvu3i64S_E.normalized"}
63 // CHECK: ![[TYPE8]] = !{i64 0, !"_ZTSFvu3i64S_S_E.normalized"}
64 // CHECK: ![[TYPE9]] = !{i64 0, !"_ZTSFvu3i16E.normalized"}
65 // CHECK: ![[TYPE10]] = !{i64 0, !"_ZTSFvu3i16S_E.normalized"}
66 // CHECK: ![[TYPE11]] = !{i64 0, !"_ZTSFvu3i16S_S_E.normalized"}
67 // CHECK: ![[TYPE12]] = !{i64 0, !"_ZTSFvu2u8E.normalized"}
68 // CHECK: ![[TYPE13]] = !{i64 0, !"_ZTSFvu2u8S_E.normalized"}
69 // CHECK: ![[TYPE14]] = !{i64 0, !"_ZTSFvu2u8S_S_E.normalized"}
70 // CHECK: ![[TYPE15]] = !{i64 0, !"_ZTSFvu3u32E.normalized"}
71 // CHECK: ![[TYPE16]] = !{i64 0, !"_ZTSFvu3u32S_E.normalized"}
72 // CHECK: ![[TYPE17]] = !{i64 0, !"_ZTSFvu3u32S_S_E.normalized"}
73 // CHECK: ![[TYPE18]] = !{i64 0, !"_ZTSFvu3u64E.normalized"}
74 // CHECK: ![[TYPE19]] = !{i64 0, !"_ZTSFvu3u64S_E.normalized"}
75 // CHECK: ![[TYPE20]] = !{i64 0, !"_ZTSFvu3u64S_S_E.normalized"}
76 // CHECK: ![[TYPE21]] = !{i64 0, !"_ZTSFvu3u16E.normalized"}
77 // CHECK: ![[TYPE22]] = !{i64 0, !"_ZTSFvu3u16S_E.normalized"}
78 // CHECK: ![[TYPE23]] = !{i64 0, !"_ZTSFvu3u16S_S_E.normalized"}