2009-10-03 22:39:13 +08:00
|
|
|
// RUN: clang-cc %s -emit-llvm -o - -triple=x86_64-apple-darwin9 | FileCheck %s
|
2009-09-29 11:38:56 +08:00
|
|
|
|
2009-10-03 23:02:02 +08:00
|
|
|
struct A { int a; void f(); virtual void vf(); };
|
|
|
|
struct B { int b; virtual void g(); };
|
2009-09-29 11:38:56 +08:00
|
|
|
struct C : B, A { };
|
|
|
|
|
|
|
|
void (A::*pa)();
|
|
|
|
void (A::*volatile vpa)();
|
|
|
|
void (B::*pb)();
|
|
|
|
void (C::*pc)();
|
|
|
|
|
2009-10-03 23:02:02 +08:00
|
|
|
// CHECK: @pa2 = global %0 { i64 ptrtoint (void ()* @_ZN1A1fEv to i64), i64 0 }, align 8
|
|
|
|
void (A::*pa2)() = &A::f;
|
|
|
|
|
|
|
|
// CHECK: @pa3 = global %0 { i64 1, i64 0 }, align 8
|
|
|
|
void (A::*pa3)() = &A::vf;
|
|
|
|
|
2009-10-03 23:13:22 +08:00
|
|
|
// CHECK: @pc2 = global %0 { i64 ptrtoint (void ()* @_ZN1A1fEv to i64), i64 16 }, align 8
|
|
|
|
void (C::*pc2)() = &C::f;
|
|
|
|
|
|
|
|
// CHECK: @pc3 = global %0 { i64 1, i64 0 }, align 8
|
|
|
|
void (A::*pc3)() = &A::vf;
|
|
|
|
|
2009-09-29 11:38:56 +08:00
|
|
|
void f() {
|
2009-10-03 22:39:13 +08:00
|
|
|
// CHECK: store i64 0, i64* getelementptr inbounds (%0* @pa, i32 0, i32 0)
|
|
|
|
// CHECK: store i64 0, i64* getelementptr inbounds (%0* @pa, i32 0, i32 1)
|
2009-09-29 11:38:56 +08:00
|
|
|
pa = 0;
|
2009-10-03 22:39:13 +08:00
|
|
|
|
|
|
|
// CHECK: volatile store i64 0, i64* getelementptr inbounds (%0* @vpa, i32 0, i32 0)
|
|
|
|
// CHECK: volatile store i64 0, i64* getelementptr inbounds (%0* @vpa, i32 0, i32 1)
|
2009-09-29 11:38:56 +08:00
|
|
|
vpa = 0;
|
2009-10-03 22:39:13 +08:00
|
|
|
|
|
|
|
// CHECK: store i64 %0, i64* getelementptr inbounds (%0* @pc, i32 0, i32 0)
|
2009-10-03 23:43:24 +08:00
|
|
|
// CHECK: [[ADJ:%[a-zA-Z0-9\.]+]] = add i64 %1, 16
|
2009-10-03 22:39:13 +08:00
|
|
|
// CHECK: store i64 [[ADJ]], i64* getelementptr inbounds (%0* @pc, i32 0, i32 1)
|
2009-10-03 23:02:02 +08:00
|
|
|
pc = pa;
|
2009-09-29 11:38:56 +08:00
|
|
|
}
|
2009-10-03 23:43:24 +08:00
|
|
|
|
|
|
|
void f2() {
|
|
|
|
// CHECK: [[pa2ptr:%[a-zA-Z0-9\.]+]] = getelementptr inbounds %0* %pa2, i32 0, i32 0
|
|
|
|
// CHECK: store i64 ptrtoint (void ()* @_ZN1A1fEv to i64), i64* [[pa2ptr]]
|
|
|
|
// CHECK: [[pa2adj:%[a-zA-Z0-9\.]+]] = getelementptr inbounds %0* %pa2, i32 0, i32 1
|
|
|
|
// CHECK: store i64 0, i64* [[pa2adj]]
|
|
|
|
void (A::*pa2)() = &A::f;
|
|
|
|
|
|
|
|
// CHECK: [[pa3ptr:%[a-zA-Z0-9\.]+]] = getelementptr inbounds %0* %pa3, i32 0, i32 0
|
|
|
|
// CHECK: store i64 1, i64* [[pa3ptr]]
|
|
|
|
// CHECK: [[pa3adj:%[a-zA-Z0-9\.]+]] = getelementptr inbounds %0* %pa3, i32 0, i32 1
|
|
|
|
// CHECK: store i64 0, i64* [[pa2adj]]
|
|
|
|
void (A::*pa3)() = &A::vf;
|
|
|
|
}
|