blob: aae6a82a8f14c25d066f989557937f7c111862a9 [file] [log] [blame]
Ivan A. Kosarevb75a50b2017-09-26 14:22:48 +00001// RUN: %clang_cc1 -triple x86_64-linux -O1 -disable-llvm-passes %s -emit-llvm -o - | FileCheck %s
2//
3// Check that we generate correct TBAA information for reference accesses.
4
5struct S;
6
7struct B {
8 S &s;
9 B(S &s) : s(s) {}
10 void bar();
11};
12
13void foo(S &s) {
14 B b(s);
15 b.bar();
16}
17
18// CHECK-LABEL: _Z3fooR1S
19// Check initialization of the reference parameter in foo().
20// CHECK: store %struct.S* {{.*}}, %struct.S** {{.*}}, !tbaa [[TAG_pointer:!.*]]
21//
22// CHECK-LABEL: _ZN1BC2ER1S
23// TODO: Check loading of the reference parameter in B::B(S&).
24// Check initialization of B::s in B::B(S&).
25// CHECK: store %struct.S* {{.*}}, %struct.S** {{.*}}, !tbaa [[TAG_pointer]]
26//
27// CHECK-DAG: [[TAG_pointer]] = !{[[TYPE_pointer:!.*]], [[TYPE_pointer]], i64 0}
28// CHECK-DAG: [[TYPE_pointer]] = !{!"any pointer", [[TYPE_char:!.*]], i64 0}
29// CHECK-DAG: [[TYPE_char]] = !{!"omnipotent char", {{!.*}}, i64 0}