[cfe-commits] r89989 - in /cfe/trunk/test/CodeGenCXX: member-function-pointers.cpp member-pointer-cast.cpp
Eli Friedman
eli.friedman at gmail.com
Thu Nov 26 20:56:41 PST 2009
Author: efriedma
Date: Thu Nov 26 22:56:40 2009
New Revision: 89989
URL: http://llvm.org/viewvc/llvm-project?rev=89989&view=rev
Log:
Some member pointer casting tests.
Added:
cfe/trunk/test/CodeGenCXX/member-pointer-cast.cpp
Modified:
cfe/trunk/test/CodeGenCXX/member-function-pointers.cpp
Modified: cfe/trunk/test/CodeGenCXX/member-function-pointers.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/member-function-pointers.cpp?rev=89989&r1=89988&r2=89989&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/member-function-pointers.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/member-function-pointers.cpp Thu Nov 26 22:56:40 2009
@@ -34,6 +34,11 @@
// CHECK: [[ADJ:%[a-zA-Z0-9\.]+]] = add i64 {{.*}}, 16
// CHECK: store i64 [[ADJ]], i64* getelementptr inbounds (%0* @pc, i32 0, i32 1)
pc = pa;
+
+ // CHECK: store i64 {{.*}}, i64* getelementptr inbounds (%0* @pa, i32 0, i32 0)
+ // CHECK: [[ADJ:%[a-zA-Z0-9\.]+]] = sub i64 {{.*}}, 16
+ // CHECK: store i64 [[ADJ]], i64* getelementptr inbounds (%0* @pa, i32 0, i32 1)
+ pa = static_cast<void (A::*)()>(pc);
}
void f2() {
Added: cfe/trunk/test/CodeGenCXX/member-pointer-cast.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/member-pointer-cast.cpp?rev=89989&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/member-pointer-cast.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/member-pointer-cast.cpp Thu Nov 26 22:56:40 2009
@@ -0,0 +1,21 @@
+// RUN: clang-cc %s -emit-llvm -o - -triple=x86_64-apple-darwin9 | FileCheck %s
+
+struct A { int a; };
+struct B { int b; };
+struct C : B, A { };
+
+int A::*pa;
+int C::*pc;
+
+void f() {
+ // CHECK: store i64 -1, i64* @pa
+ pa = 0;
+
+ // CHECK: [[ADJ:%[a-zA-Z0-9\.]+]] = add i64 {{.*}}, 4
+ // CHECK: store i64 [[ADJ]], i64* @pc
+ pc = pa;
+
+ // CHECK: [[ADJ:%[a-zA-Z0-9\.]+]] = sub i64 {{.*}}, 4
+ // CHECK: store i64 [[ADJ]], i64* @pa
+ pa = static_cast<int A::*>(pc);
+}
More information about the cfe-commits
mailing list