Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / member-expressions.cpp
blob0e57c7e1af26e89144033a1afa7a1e5ff4c49e48
1 // RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin10 | FileCheck %s
3 // PR5392
4 namespace PR5392 {
5 struct A
7 static int a;
8 };
10 A a1;
11 void f()
13 // CHECK: store i32 10, ptr @_ZN6PR53921A1aE
14 a1.a = 10;
15 // CHECK: store i32 20, ptr @_ZN6PR53921A1aE
16 A().a = 20;
21 struct A {
22 A();
23 ~A();
24 enum E { Foo };
27 A *g();
29 void f(A *a) {
30 A::E e1 = a->Foo;
32 // CHECK: call noundef ptr @_Z1gv()
33 A::E e2 = g()->Foo;
34 // CHECK: call void @_ZN1AC1Ev(
35 // CHECK: call void @_ZN1AD1Ev(
36 A::E e3 = A().Foo;
39 namespace test3 {
40 struct A {
41 static int foo();
43 int f() {
44 return A().foo();
48 namespace test4 {
49 struct A {
50 int x;
52 struct B {
53 int x;
54 void foo();
56 struct C : A, B {
59 extern C *c_ptr;
61 // CHECK-LABEL: define{{.*}} i32 @_ZN5test44testEv()
62 int test() {
63 // CHECK: load {{.*}} @_ZN5test45c_ptrE
64 // CHECK-NEXT: getelementptr
65 // CHECK-NEXT: call void @_ZN5test41B3fooEv
66 c_ptr->B::foo();
68 // CHECK: load {{.*}} @_ZN5test45c_ptrE
69 // CHECK-NEXT: getelementptr
70 // CHECK-NEXT: getelementptr
71 // CHECK-NEXT: store i32 5
72 c_ptr->B::x = 5;
74 // CHECK: load {{.*}} @_ZN5test45c_ptrE
75 // CHECK-NEXT: getelementptr
76 // CHECK-NEXT: getelementptr
77 // CHECK-NEXT: load i32, ptr
78 return c_ptr->B::x;