summaryrefslogtreecommitdiffstats
path: root/test/CodeGenCXX/pointers-to-data-members.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2010-02-02 03:37:46 +0000
committerAnders Carlsson <andersca@mac.com>2010-02-02 03:37:46 +0000
commit45147d0098a34c3705f74ca121b27d7736ac113a (patch)
treeb9b7bbb4c3f74db93afbe0de4e982f52db40e80d /test/CodeGenCXX/pointers-to-data-members.cpp
parent63b071f28ea936772634c176a34de2bf0301f79c (diff)
Move pointer to data member emission to CodeGenModule and use it in CGExprConstant. Fixes PR5674.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95063 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/pointers-to-data-members.cpp')
-rw-r--r--test/CodeGenCXX/pointers-to-data-members.cpp45
1 files changed, 28 insertions, 17 deletions
diff --git a/test/CodeGenCXX/pointers-to-data-members.cpp b/test/CodeGenCXX/pointers-to-data-members.cpp
index c34bd5b114..79a631c93c 100644
--- a/test/CodeGenCXX/pointers-to-data-members.cpp
+++ b/test/CodeGenCXX/pointers-to-data-members.cpp
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64-apple-darwin10 | FileCheck %s
-struct A { int a; };
+struct A { int a; int b; };
struct B { int b; };
struct C : B, A { };
@@ -17,23 +17,12 @@ namespace ZeroInit {
// CHECK: @_ZN8ZeroInit1bE = global i64 -1,
int A::* b = 0;
-
- void f() {
- // CHECK: icmp ne i64 {{.*}}, -1
- if (a) { }
-
- // CHECK: icmp ne i64 {{.*}}, -1
- if (a != 0) { }
-
- // CHECK: icmp ne i64 -1, {{.*}}
- if (0 != a) { }
-
- // CHECK: icmp eq i64 {{.*}}, -1
- if (a == 0) { }
+}
- // CHECK: icmp eq i64 -1, {{.*}}
- if (0 == a) { }
- }
+// PR5674
+namespace PR5674 {
+ // CHECK: @_ZN6PR56742pbE = global i64 4
+ int A::*pb = &A::b;
}
// Casts.
@@ -56,3 +45,25 @@ void f() {
}
}
+
+// Comparisons
+namespace Comparisons {
+ void f() {
+ int A::*a;
+
+ // CHECK: icmp ne i64 {{.*}}, -1
+ if (a) { }
+
+ // CHECK: icmp ne i64 {{.*}}, -1
+ if (a != 0) { }
+
+ // CHECK: icmp ne i64 -1, {{.*}}
+ if (0 != a) { }
+
+ // CHECK: icmp eq i64 {{.*}}, -1
+ if (a == 0) { }
+
+ // CHECK: icmp eq i64 -1, {{.*}}
+ if (0 == a) { }
+ }
+}