1 | // RUN: %clang_cc1 -triple i686-pc-win32 -disable-llvm-passes -emit-llvm -o - -O1 %s | FileCheck %s -check-prefixes=CHECK,OLD-PATH |
2 | // RUN: %clang_cc1 -triple i686-pc-win32 -disable-llvm-passes -emit-llvm -new-struct-path-tbaa -o - -O1 %s | FileCheck %s -check-prefixes=CHECK,NEW-PATH |
3 | // |
4 | // Test that TBAA works in the Microsoft C++ ABI. We used to error out while |
5 | // attempting to mangle RTTI. |
6 | |
7 | struct StructA { |
8 | int a; |
9 | }; |
10 | |
11 | struct StructB : virtual StructA { |
12 | StructB(); |
13 | }; |
14 | |
15 | StructB::StructB() { |
16 | a = 42; |
17 | // CHECK: store i32 42, i32* {{.*}}, !tbaa [[TAG_A_i32:!.*]] |
18 | } |
19 | |
20 | // OLD-PATH: [[TYPE_INT:!.*]] = !{!"int", [[TYPE_CHAR:!.*]], i64 0} |
21 | // OLD-PATH: [[TYPE_CHAR]] = !{!"omnipotent char", ! |
22 | // OLD-PATH: [[TAG_A_i32]] = !{[[TYPE_A:!.*]], [[TYPE_INT]], i64 0} |
23 | // OLD-PATH: [[TYPE_A]] = !{!"?AUStructA@@", [[TYPE_INT]], i64 0} |
24 | // NEW-PATH: [[TYPE_INT:!.*]] = !{[[TYPE_CHAR:!.*]], i64 4, !"int"} |
25 | // NEW-PATH: [[TYPE_CHAR]] = !{{{.*}}, i64 1, !"omnipotent char"} |
26 | // NEW-PATH: [[TAG_A_i32]] = !{[[TYPE_A:!.*]], [[TYPE_INT]], i64 0, i64 4} |
27 | // NEW-PATH: [[TYPE_A]] = !{[[TYPE_CHAR]], i64 4, !"?AUStructA@@", [[TYPE_INT]], i64 0, i64 4} |
28 | |