diff options
author | dim <dim@FreeBSD.org> | 2015-05-27 18:47:56 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2015-05-27 18:47:56 +0000 |
commit | 3191b2b32a96e1a6ee833fcca73e5c8e0c67ba65 (patch) | |
tree | dbbd4047878da71c1a706e26ce05b4e7791b14cc /test/CodeGenCXX/cxx0x-initializer-references.cpp | |
parent | 38d6f2e7f2ce51a5b3836d26596c6c34a3288752 (diff) | |
download | FreeBSD-src-3191b2b32a96e1a6ee833fcca73e5c8e0c67ba65.zip FreeBSD-src-3191b2b32a96e1a6ee833fcca73e5c8e0c67ba65.tar.gz |
Vendor import of clang trunk r238337:
https://llvm.org/svn/llvm-project/cfe/trunk@238337
Diffstat (limited to 'test/CodeGenCXX/cxx0x-initializer-references.cpp')
-rw-r--r-- | test/CodeGenCXX/cxx0x-initializer-references.cpp | 54 |
1 files changed, 46 insertions, 8 deletions
diff --git a/test/CodeGenCXX/cxx0x-initializer-references.cpp b/test/CodeGenCXX/cxx0x-initializer-references.cpp index 10586c1..318c8ea 100644 --- a/test/CodeGenCXX/cxx0x-initializer-references.cpp +++ b/test/CodeGenCXX/cxx0x-initializer-references.cpp @@ -35,22 +35,30 @@ namespace reference { // CHECK-NEXT: ret } - void reference_to_aggregate() { + void reference_to_aggregate(int i) { // CHECK: getelementptr {{.*}}, i32 0, i32 0 // CHECK-NEXT: store i32 1 // CHECK-NEXT: getelementptr {{.*}}, i32 0, i32 1 - // CHECK-NEXT: store i32 2 + // CHECK-NEXT: %[[I1:.*]] = load i32, i32* + // CHECK-NEXT: store i32 %[[I1]] // CHECK-NEXT: store %{{.*}}* %{{.*}}, %{{.*}}** %{{.*}}, align - const A &ra1{1, 2}; + const A &ra1{1, i}; - // CHECK-NEXT: getelementptr inbounds [3 x i32]* %{{.*}}, i{{32|64}} 0, i{{32|64}} 0 + // CHECK-NEXT: getelementptr inbounds [3 x i32], [3 x i32]* %{{.*}}, i{{32|64}} 0, i{{32|64}} 0 // CHECK-NEXT: store i32 1 - // CHECK-NEXT: getelementptr inbounds i32* %{{.*}}, i{{32|64}} 1 + // CHECK-NEXT: getelementptr inbounds i32, i32* %{{.*}}, i{{32|64}} 1 // CHECK-NEXT: store i32 2 - // CHECK-NEXT: getelementptr inbounds i32* %{{.*}}, i{{32|64}} 1 - // CHECK-NEXT: store i32 3 + // CHECK-NEXT: getelementptr inbounds i32, i32* %{{.*}}, i{{32|64}} 1 + // CHECK-NEXT: %[[I2:.*]] = load i32, i32* + // CHECK-NEXT: store i32 %[[I2]] // CHECK-NEXT: store [3 x i32]* %{{.*}}, [3 x i32]** %{{.*}}, align - const int (&arrayRef)[] = {1, 2, 3}; + const int (&arrayRef)[] = {1, 2, i}; + + // CHECK: store %{{.*}}* @{{.*}}, %{{.*}}** %{{.*}}, align + const A &constra1{1, 2}; + + // CHECK-NEXT: store [3 x i32]* @{{.*}}, [3 x i32]** %{{.*}}, align + const int (&constarrayRef)[] = {1, 2, 3}; // CHECK-NEXT: ret } @@ -71,3 +79,33 @@ namespace reference { } } + +namespace PR23165 { +struct AbstractClass { + virtual void foo() const = 0; +}; + +struct ChildClass : public AbstractClass { + virtual void foo() const {} +}; + +void helper(const AbstractClass ¶m) { + param.foo(); +} + +void foo() { +// CHECK-LABEL: @_ZN7PR231653fooEv +// CHECK: call {{.*}} @_ZN7PR2316510ChildClassC1Ev +// CHECK: call void @_ZN7PR231656helperERKNS_13AbstractClassE + helper(ChildClass()); +} + +struct S { struct T { int a; } t; mutable int b; }; +void f() { +// CHECK-LABEL: _ZN7PR231651fEv +// CHECK: alloca +// CHECK: alloca +// CHECK: store + const S::T &r = S().t; +} +} |