summaryrefslogtreecommitdiff
path: root/test/CodeGenCXX/member-function-pointers.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-08-22 06:43:33 +0000
committerJohn McCall <rjmccall@apple.com>2010-08-22 06:43:33 +0000
commit875ab10245d3bf37252dd822aa1616bb0a391095 (patch)
treee0d71f880cfe63c0978c658fb5ef07d08a972679 /test/CodeGenCXX/member-function-pointers.cpp
parentcf2c85e76fdafe7e634810a292321a6c8322483d (diff)
downloadclang-875ab10245d3bf37252dd822aa1616bb0a391095.tar.gz
Abstract out member-pointer creation. I'm really unhappy about the current
duplication between the constant and non-constant paths in all of this. Implement ARM ABI semantics for member pointer constants and conversion. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111772 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/member-function-pointers.cpp')
-rw-r--r--test/CodeGenCXX/member-function-pointers.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/CodeGenCXX/member-function-pointers.cpp b/test/CodeGenCXX/member-function-pointers.cpp
index e4beee15bb..c0756fa144 100644
--- a/test/CodeGenCXX/member-function-pointers.cpp
+++ b/test/CodeGenCXX/member-function-pointers.cpp
@@ -1,5 +1,6 @@
// RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64-apple-darwin9 | FileCheck %s
// RUN: %clang_cc1 %s -emit-llvm -o - -triple=i386-apple-darwin9 | FileCheck -check-prefix LP32 %s
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple=armv7-unknown-unknown | FileCheck -check-prefix ARM %s
struct A { int a; void f(); virtual void vf1(); virtual void vf2(); };
struct B { int b; virtual void g(); };
@@ -190,3 +191,22 @@ namespace PR7027 {
struct X { void test( ); };
void testX() { &X::test; }
}
+
+namespace test7 {
+ struct A { void foo(); virtual void vfoo(); };
+ struct B { void foo(); virtual void vfoo(); };
+ struct C : A, B { void foo(); virtual void vfoo(); };
+
+ // CHECK-ARM: @_ZN5test74ptr0E = global {{.*}} { i32 ptrtoint ({{.*}}* @_ZN5test71A3fooEv to i32), i32 0 }
+ // CHECK-ARM: @_ZN5test74ptr1E = global {{.*}} { i32 ptrtoint ({{.*}}* @_ZN5test71B3fooEv to i32), i32 8 }
+ // CHECK-ARM: @_ZN5test74ptr2E = global {{.*}} { i32 ptrtoint ({{.*}}* @_ZN5test71C3fooEv to i32), i32 0 }
+ // CHECK-ARM: @_ZN5test74ptr3E = global {{.*}} { i32 0, i32 1 }
+ // CHECK-ARM: @_ZN5test74ptr4E = global {{.*}} { i32 0, i32 9 }
+ // CHECK-ARM: @_ZN5test74ptr5E = global {{.*}} { i32 0, i32 1 }
+ void (C::*ptr0)() = &A::foo;
+ void (C::*ptr1)() = &B::foo;
+ void (C::*ptr2)() = &C::foo;
+ void (C::*ptr3)() = &A::vfoo;
+ void (C::*ptr4)() = &B::vfoo;
+ void (C::*ptr5)() = &C::vfoo;
+}