diff options
author | dim <dim@FreeBSD.org> | 2011-02-20 13:06:31 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2011-02-20 13:06:31 +0000 |
commit | 39fcc9a984e2820e4ea0fa2ac4abd17d9f3a31df (patch) | |
tree | a9243275843fbeaa590afc07ee888e006b8d54ea /test/CodeGenCXX/pointers-to-data-members.cpp | |
parent | 69b4eca4a4255ba43baa5c1d9bbdec3ec17f479e (diff) | |
download | FreeBSD-src-39fcc9a984e2820e4ea0fa2ac4abd17d9f3a31df.zip FreeBSD-src-39fcc9a984e2820e4ea0fa2ac4abd17d9f3a31df.tar.gz |
Vendor import of clang trunk r126079:
http://llvm.org/svn/llvm-project/cfe/trunk@126079
Diffstat (limited to 'test/CodeGenCXX/pointers-to-data-members.cpp')
-rw-r--r-- | test/CodeGenCXX/pointers-to-data-members.cpp | 59 |
1 files changed, 43 insertions, 16 deletions
diff --git a/test/CodeGenCXX/pointers-to-data-members.cpp b/test/CodeGenCXX/pointers-to-data-members.cpp index 38c7d28..40723a8 100644 --- a/test/CodeGenCXX/pointers-to-data-members.cpp +++ b/test/CodeGenCXX/pointers-to-data-members.cpp @@ -1,40 +1,47 @@ -// RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64-apple-darwin10 | FileCheck %s -// RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64-apple-darwin10 -O3 | FileCheck --check-prefix=CHECK-O3 %s +// RUN: %clang_cc1 %s -emit-llvm -o %t.ll -triple=x86_64-apple-darwin10 +// RUN: FileCheck %s < %t.ll +// RUN: FileCheck -check-prefix=CHECK-GLOBAL %s < %t.ll +// RUN: %clang_cc1 %s -emit-llvm -o %t-opt.ll -triple=x86_64-apple-darwin10 -O3 +// RUN: FileCheck --check-prefix=CHECK-O3 %s < %t-opt.ll + struct A { int a; int b; }; struct B { int b; }; struct C : B, A { }; // Zero init. namespace ZeroInit { - // CHECK: @_ZN8ZeroInit1aE = global i64 -1 + // CHECK-GLOBAL: @_ZN8ZeroInit1aE = global i64 -1 int A::* a; - // CHECK: @_ZN8ZeroInit2aaE = global [2 x i64] [i64 -1, i64 -1] + // CHECK-GLOBAL: @_ZN8ZeroInit2aaE = global [2 x i64] [i64 -1, i64 -1] int A::* aa[2]; - // CHECK: @_ZN8ZeroInit3aaaE = global [2 x [2 x i64]] {{\[}}[2 x i64] [i64 -1, i64 -1], [2 x i64] [i64 -1, i64 -1]] + // CHECK-GLOBAL: @_ZN8ZeroInit3aaaE = global [2 x [2 x i64]] {{\[}}[2 x i64] [i64 -1, i64 -1], [2 x i64] [i64 -1, i64 -1]] int A::* aaa[2][2]; - // CHECK: @_ZN8ZeroInit1bE = global i64 -1, + // CHECK-GLOBAL: @_ZN8ZeroInit1bE = global i64 -1, int A::* b = 0; - // CHECK: @_ZN8ZeroInit2saE = global %struct.anon { i64 -1 } + // CHECK-GLOBAL: @_ZN8ZeroInit2saE = internal global %struct.anon { i64 -1 } struct { int A::*a; } sa; + void test_sa() { (void) sa; } // force emission - // CHECK: @_ZN8ZeroInit3ssaE = - // CHECK: [2 x i64] [i64 -1, i64 -1] + // CHECK-GLOBAL: @_ZN8ZeroInit3ssaE = internal + // CHECK-GLOBAL: [2 x i64] [i64 -1, i64 -1] struct { int A::*aa[2]; } ssa[2]; + void test_ssa() { (void) ssa; } - // CHECK: @_ZN8ZeroInit2ssE = global %1 { %struct.anon { i64 -1 } } + // CHECK-GLOBAL: @_ZN8ZeroInit2ssE = internal global %1 { %struct.anon { i64 -1 } } struct { struct { int A::*pa; } s; } ss; + void test_ss() { (void) ss; } struct A { int A::*a; @@ -48,13 +55,13 @@ namespace ZeroInit { }; struct C : A, B { int j; }; - // CHECK: @_ZN8ZeroInit1cE = global %"struct.ZeroInit::C" { [16 x i8] c"\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00", [176 x i8] c"\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF", i32 0, [4 x i8] zeroinitializer } + // CHECK-GLOBAL: @_ZN8ZeroInit1cE = global {{%.*}} { [16 x i8] c"\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00", [176 x i8] c"\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF", i32 0, [4 x i8] zeroinitializer } C c; } // PR5674 namespace PR5674 { - // CHECK: @_ZN6PR56742pbE = global i64 4 + // CHECK-GLOBAL: @_ZN6PR56742pbE = global i64 4 int A::*pb = &A::b; } @@ -117,7 +124,7 @@ struct A { A(); }; -// CHECK: define void @_ZN9ValueInit1AC2Ev +// CHECK: define void @_ZN9ValueInit1AC2Ev(%"struct.ValueInit::A"* %this) unnamed_addr // CHECK: store i64 -1, i64* // CHECK: ret void A::A() : a() {} @@ -165,15 +172,15 @@ struct A { int A::*i; }; -// FIXME: A::i should be initialized to -1 here. +// CHECK-GLOBAL: @_ZN12VirtualBases1bE = global {{%.*}} { i32 (...)** null, [16 x i8] c"\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF" } struct B : virtual A { }; B b; -// FIXME: A::i should be initialized to -1 here. +// CHECK-GLOBAL: @_ZN12VirtualBases1cE = global {{%.*}} { i32 (...)** null, i64 -1, [16 x i8] c"\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF" } struct C : virtual A { int A::*i; }; C c; -// FIXME: C::A::i should be initialized to -1 here. + // CHECK-GLOBAL: @_ZN12VirtualBases1dE = global {{%.*}} { [16 x i8] c"\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF", i64 -1, [16 x i8] c"\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF" } struct D : C { int A::*i; }; D d; @@ -203,3 +210,23 @@ namespace BoolPtrToMember { return x.*member; } } + +namespace PR8507 { + +struct S; +void f(S* p, double S::*pm) { + if (0 < p->*pm) { + } +} + +} + +namespace test4 { + struct A { int A_i; }; + struct B : virtual A { int A::*B_p; }; + struct C : virtual B { int *C_p; }; + struct D : C { int *D_p; }; + + // CHECK-GLOBAL: @_ZN5test41dE = global {{%.*}} { [16 x i8] zeroinitializer, i32* null, [16 x i8] c"\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF", [4 x i8] zeroinitializer } + D d; +} |