diff options
author | Anders Carlsson <andersca@mac.com> | 2010-02-02 03:37:46 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2010-02-02 03:37:46 +0000 |
commit | 259688ce2984a648321d8d15284224854b967fac (patch) | |
tree | 88fd0fccaa12b4f16b33a934acd997385bad09af /clang/test/CodeGenCXX/pointers-to-data-members.cpp | |
parent | 6d404adc1be80cf9b7d5cba6bc2afd7ba8762238 (diff) | |
download | bcm5719-llvm-259688ce2984a648321d8d15284224854b967fac.tar.gz bcm5719-llvm-259688ce2984a648321d8d15284224854b967fac.zip |
Move pointer to data member emission to CodeGenModule and use it in CGExprConstant. Fixes PR5674.
llvm-svn: 95063
Diffstat (limited to 'clang/test/CodeGenCXX/pointers-to-data-members.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/pointers-to-data-members.cpp | 45 |
1 files changed, 28 insertions, 17 deletions
diff --git a/clang/test/CodeGenCXX/pointers-to-data-members.cpp b/clang/test/CodeGenCXX/pointers-to-data-members.cpp index c34bd5b114c..79a631c93ca 100644 --- a/clang/test/CodeGenCXX/pointers-to-data-members.cpp +++ b/clang/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) { } + } +} |