33
44// .
55// CHECK: @x = global %struct.CompleteS zeroinitializer, align 8
6+ // CHECK: @xExtern = external global %struct.CompleteS, align 8
67// CHECK: @y = external global %struct.S, align 1
8+ // CHECK: @d = global %class.b zeroinitializer, align 1
9+ // CHECK: @_ZN1b1eE = external global %class.a, align 1
710// CHECK: @__tysan_shadow_memory_address = external global i64
811// CHECK: @__tysan_app_memory_mask = external global i64
912// CHECK: @__tysan_v1_Simple_20C_2b_2b_20TBAA = linkonce_odr constant { i64, i64, [16 x i8] } { i64 2, i64 0, [16 x i8] c"Simple C++ TBAA\00" }, comdat
1215// CHECK: @__tysan_v1_any_20pointer = linkonce_odr constant { i64, i64, ptr, i64, [12 x i8] } { i64 2, i64 1, ptr @__tysan_v1_omnipotent_20char, i64 0, [12 x i8] c"any pointer\00" }, comdat
1316// CHECK: @__tysan_v1_p1_20int = linkonce_odr constant { i64, i64, ptr, i64, [7 x i8] } { i64 2, i64 1, ptr @__tysan_v1_any_20pointer, i64 0, [7 x i8] c"p1 int\00" }, comdat
1417// CHECK: @__tysan_v1___ZTS9CompleteS = linkonce_odr constant { i64, i64, ptr, i64, ptr, i64, [15 x i8] } { i64 2, i64 2, ptr @__tysan_v1_int, i64 0, ptr @__tysan_v1_p1_20int, i64 8, [15 x i8] c"_ZTS9CompleteS\00" }, comdat
15- // CHECK: @llvm.used = appending global [7 x ptr] [ptr @tysan.module_ctor, ptr @__tysan_v1_Simple_20C_2b_2b_20TBAA, ptr @__tysan_v1_omnipotent_20char, ptr @__tysan_v1_int, ptr @__tysan_v1_any_20pointer, ptr @__tysan_v1_p1_20int, ptr @__tysan_v1___ZTS9CompleteS], section "llvm.metadata"
16- // CHECK: @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @tysan.module_ctor, ptr null }]
18+ // CHECK: @__tysan_v1___ZTS1b = linkonce_odr constant { i64, i64, [7 x i8] } { i64 2, i64 0, [7 x i8] c"_ZTS1b\00" }, comdat
19+ // CHECK: @llvm.used = appending global [8 x ptr] [ptr @tysan.module_ctor, ptr @__tysan_v1_Simple_20C_2b_2b_20TBAA, ptr @__tysan_v1_omnipotent_20char, ptr @__tysan_v1_int, ptr @__tysan_v1_any_20pointer, ptr @__tysan_v1_p1_20int, ptr @__tysan_v1___ZTS9CompleteS, ptr @__tysan_v1___ZTS1b], section "llvm.metadata"
20+ // CHECK: @llvm.global_ctors = appending global [2 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr @_GLOBAL__sub_I_sanitize_type_globals.cpp, ptr null }, { i32, ptr, ptr } { i32 0, ptr @tysan.module_ctor, ptr null }]
1721// .
1822struct CompleteS {
1923 int x;
@@ -22,13 +26,18 @@ struct CompleteS {
2226
2327void f (CompleteS *);
2428CompleteS x;
29+ extern CompleteS xExtern;
2530// CHECK-LABEL: define dso_local void @_Z1gv(
2631// CHECK-SAME: ) #[[ATTR0:[0-9]+]] {
2732// CHECK: [[ENTRY:.*:]]
2833// CHECK: call void @_Z1fP9CompleteS(ptr noundef @x)
34+ // CHECK: call void @_Z1fP9CompleteS(ptr noundef @xExtern)
2935// CHECK: ret void
3036//
31- void g () { f (&x); }
37+ void g () {
38+ f (&x);
39+ f (&xExtern);
40+ }
3241
3342typedef struct S IncompleteS;
3443void f (IncompleteS *);
@@ -40,11 +49,21 @@ extern IncompleteS y;
4049// CHECK: ret void
4150//
4251void h () { f (&y); }
52+
53+ class a ;
54+ class b {
55+ public:
56+ using c = a;
57+ static c e;
58+ b (int , c & = e);
59+ } d = 0 ;
60+
4361// .
4462// CHECK: attributes #[[ATTR0]] = { mustprogress noinline nounwind optnone sanitize_type "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
4563// CHECK: attributes #[[ATTR1:[0-9]+]] = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
46- // CHECK: attributes #[[ATTR2:[0-9]+]] = { nounwind "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
47- // CHECK: attributes #[[ATTR3:[0-9]+]] = { nounwind }
64+ // CHECK: attributes #[[ATTR2:[0-9]+]] = { noinline nounwind sanitize_type "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
65+ // CHECK: attributes #[[ATTR3:[0-9]+]] = { nounwind "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
66+ // CHECK: attributes #[[ATTR4:[0-9]+]] = { nounwind }
4867// .
4968// CHECK: [[META0:![0-9]+]] = !{ptr @x, [[META1:![0-9]+]]}
5069// CHECK: [[META1]] = !{!"_ZTS9CompleteS", [[META2:![0-9]+]], i64 0, [[META5:![0-9]+]], i64 8}
@@ -53,6 +72,8 @@ void h() { f(&y); }
5372// CHECK: [[META4]] = !{!"Simple C++ TBAA"}
5473// CHECK: [[META5]] = !{!"p1 int", [[META6:![0-9]+]], i64 0}
5574// CHECK: [[META6]] = !{!"any pointer", [[META3]], i64 0}
56- // CHECK: [[META7:![0-9]+]] = !{i32 1, !"wchar_size", i32 4}
57- // CHECK: [[META8:![0-9]+]] = !{!"{{.*}}clang version {{.*}}"}
75+ // CHECK: [[META7:![0-9]+]] = !{ptr @d, [[META8:![0-9]+]]}
76+ // CHECK: [[META8]] = !{!"_ZTS1b"}
77+ // CHECK: [[META9:![0-9]+]] = !{i32 1, !"wchar_size", i32 4}
78+ // CHECK: [[META10:![0-9]+]] = !{!"{{.*}}clang version {{.*}}"}
5879// .
0 commit comments