From 29cafa66ad3878dbb9f82615f19fa0bded2e443c Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 12 Jun 2011 15:46:16 +0000 Subject: Vendor import of clang trunk r132879: http://llvm.org/svn/llvm-project/cfe/trunk@132879 --- test/CodeGenCXX/PR5050-constructor-conversion.cpp | 1 + test/CodeGenCXX/abstract-class-ctors-dtors.cpp | 16 ++ test/CodeGenCXX/arm.cpp | 8 +- test/CodeGenCXX/array-construction.cpp | 1 + test/CodeGenCXX/array-operator-delete-call.cpp | 1 + test/CodeGenCXX/call-arg-zero-temp.cpp | 1 + test/CodeGenCXX/cast-conversion.cpp | 1 + test/CodeGenCXX/constructor-conversion.cpp | 1 + test/CodeGenCXX/constructor-default-arg.cpp | 1 + test/CodeGenCXX/constructor-for-array-members.cpp | 1 + test/CodeGenCXX/constructor-template.cpp | 1 + test/CodeGenCXX/convert-to-fptr.cpp | 1 + test/CodeGenCXX/copy-assign-synthesis-1.cpp | 1 + test/CodeGenCXX/cxx0x-defaulted-templates.cpp | 19 ++ test/CodeGenCXX/cxx0x-delegating-ctors.cpp | 42 +++-- test/CodeGenCXX/debug-info-pubtypes.cpp | 15 ++ test/CodeGenCXX/decl-ref-init.cpp | 1 + .../CodeGenCXX/default-constructor-for-members.cpp | 1 + test/CodeGenCXX/derived-to-base-conv.cpp | 1 + test/CodeGenCXX/destructors.cpp | 4 +- test/CodeGenCXX/eh.cpp | 22 ++- test/CodeGenCXX/exceptions.cpp | 2 + test/CodeGenCXX/global-array-destruction.cpp | 1 + test/CodeGenCXX/global-llvm-constant.cpp | 22 +++ test/CodeGenCXX/goto.cpp | 1 + test/CodeGenCXX/instrument-functions.cpp | 30 ++++ test/CodeGenCXX/internal-linkage.cpp | 8 + test/CodeGenCXX/mangle-alias-template.cpp | 41 +++++ test/CodeGenCXX/mangle-exprs.cpp | 16 ++ test/CodeGenCXX/mangle-subst-std.cpp | 1 + test/CodeGenCXX/mangle-unnameable-conversions.cpp | 14 ++ test/CodeGenCXX/mangle.cpp | 43 ++++- test/CodeGenCXX/member-init-ctor.cpp | 14 ++ test/CodeGenCXX/new.cpp | 52 +++++- test/CodeGenCXX/nrvo.cpp | 2 +- test/CodeGenCXX/pr9965.cpp | 12 ++ test/CodeGenCXX/ptr-to-member-function.cpp | 1 + test/CodeGenCXX/scoped-enums.cpp | 9 + .../skip-vtable-pointer-initialization.cpp | 200 +++++++++++++++++++++ test/CodeGenCXX/static-init-2.cpp | 2 +- test/CodeGenCXX/template-instantiation.cpp | 30 ++++ test/CodeGenCXX/threadsafe-statics-exceptions.cpp | 2 +- test/CodeGenCXX/thunks.cpp | 30 +++- test/CodeGenCXX/vararg-non-pod.cpp | 16 ++ test/CodeGenCXX/virtual-base-destructor-call.cpp | 10 +- test/CodeGenCXX/x86_32-arguments.cpp | 4 +- 46 files changed, 652 insertions(+), 51 deletions(-) create mode 100644 test/CodeGenCXX/abstract-class-ctors-dtors.cpp create mode 100644 test/CodeGenCXX/cxx0x-defaulted-templates.cpp create mode 100644 test/CodeGenCXX/debug-info-pubtypes.cpp create mode 100644 test/CodeGenCXX/instrument-functions.cpp create mode 100644 test/CodeGenCXX/mangle-alias-template.cpp create mode 100644 test/CodeGenCXX/mangle-unnameable-conversions.cpp create mode 100644 test/CodeGenCXX/member-init-ctor.cpp create mode 100644 test/CodeGenCXX/pr9965.cpp create mode 100644 test/CodeGenCXX/scoped-enums.cpp create mode 100644 test/CodeGenCXX/skip-vtable-pointer-initialization.cpp create mode 100644 test/CodeGenCXX/vararg-non-pod.cpp (limited to 'test/CodeGenCXX') diff --git a/test/CodeGenCXX/PR5050-constructor-conversion.cpp b/test/CodeGenCXX/PR5050-constructor-conversion.cpp index aa75ea45929e7..9b993f2506c69 100644 --- a/test/CodeGenCXX/PR5050-constructor-conversion.cpp +++ b/test/CodeGenCXX/PR5050-constructor-conversion.cpp @@ -1,3 +1,4 @@ +// REQUIRES: x86-registered-target,x86-64-registered-target // RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s // RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s diff --git a/test/CodeGenCXX/abstract-class-ctors-dtors.cpp b/test/CodeGenCXX/abstract-class-ctors-dtors.cpp new file mode 100644 index 0000000000000..e1c1a75e47904 --- /dev/null +++ b/test/CodeGenCXX/abstract-class-ctors-dtors.cpp @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s + +// Check that we dont emit the complete constructor/destructor for this class. +struct A { + virtual void f() = 0; + A(); + ~A(); +}; + +// CHECK-NOT: define void @_ZN1AC1Ev +// CHECK: define void @_ZN1AC2Ev +// CHECK-NOT: define void @_ZN1AD1Ev +// CHECK: define void @_ZN1AD2Ev +A::A() { } + +A::~A() { } diff --git a/test/CodeGenCXX/arm.cpp b/test/CodeGenCXX/arm.cpp index 8d74d003c3d69..dcb27ce0dab32 100644 --- a/test/CodeGenCXX/arm.cpp +++ b/test/CodeGenCXX/arm.cpp @@ -136,8 +136,8 @@ namespace test3 { void d(int n) { // CHECK: define void @_ZN5test31dEi( // CHECK: [[N:%.*]] = load i32* - // CHECK: [[NE:%.*]] = mul i32 [[N]], 20 // CHECK: @llvm.umul.with.overflow.i32(i32 [[N]], i32 80) + // CHECK: [[NE:%.*]] = mul i32 [[N]], 20 // CHECK: @llvm.uadd.with.overflow.i32(i32 {{.*}}, i32 8) // CHECK: [[SZ:%.*]] = select // CHECK: call noalias i8* @_Znam(i32 [[SZ]]) @@ -208,8 +208,8 @@ namespace test4 { void d(int n) { // CHECK: define void @_ZN5test41dEi( // CHECK: [[N:%.*]] = load i32* - // CHECK: [[NE:%.*]] = mul i32 [[N]], 20 // CHECK: @llvm.umul.with.overflow.i32(i32 [[N]], i32 80) + // CHECK: [[NE:%.*]] = mul i32 [[N]], 20 // CHECK: @llvm.uadd.with.overflow.i32(i32 {{.*}}, i32 8) // CHECK: [[SZ:%.*]] = select // CHECK: call noalias i8* @_Znam(i32 [[SZ]]) @@ -310,7 +310,7 @@ namespace test7 { // CHECK: call i8* @llvm.eh.exception() // CHECK: call void @__cxa_guard_abort(i32* @_ZGVZN5test74testEvE1x) - // CHECK: call void @_Unwind_Resume_or_Rethrow + // CHECK: call void @llvm.eh.resume( } } @@ -349,7 +349,7 @@ namespace test8 { // CHECK: call i8* @llvm.eh.exception() // CHECK: call void @__cxa_guard_abort(i32* @_ZGVZN5test84testEvE1x) - // CHECK: call void @_Unwind_Resume_or_Rethrow + // CHECK: call void @llvm.eh.resume( } } diff --git a/test/CodeGenCXX/array-construction.cpp b/test/CodeGenCXX/array-construction.cpp index d044ac5978284..5efe18322d858 100644 --- a/test/CodeGenCXX/array-construction.cpp +++ b/test/CodeGenCXX/array-construction.cpp @@ -1,3 +1,4 @@ +// REQUIRES: x86-registered-target,x86-64-registered-target // RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s // RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s diff --git a/test/CodeGenCXX/array-operator-delete-call.cpp b/test/CodeGenCXX/array-operator-delete-call.cpp index ad60cf6a67330..41b0118fe8a94 100644 --- a/test/CodeGenCXX/array-operator-delete-call.cpp +++ b/test/CodeGenCXX/array-operator-delete-call.cpp @@ -1,3 +1,4 @@ +// REQUIRES: x86-registered-target,x86-64-registered-target // RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s // RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s diff --git a/test/CodeGenCXX/call-arg-zero-temp.cpp b/test/CodeGenCXX/call-arg-zero-temp.cpp index 88e74523f5323..101e81f8ef796 100644 --- a/test/CodeGenCXX/call-arg-zero-temp.cpp +++ b/test/CodeGenCXX/call-arg-zero-temp.cpp @@ -1,3 +1,4 @@ +// REQUIRES: x86-registered-target,x86-64-registered-target // RUN: %clang_cc1 -triple x86_64-apple-darwin -S %s -o %t-64.s // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s // RUN: %clang_cc1 -triple i386-apple-darwin -S %s -o %t-32.s diff --git a/test/CodeGenCXX/cast-conversion.cpp b/test/CodeGenCXX/cast-conversion.cpp index 27e34b9d32f5c..b7a9740ddf1c9 100644 --- a/test/CodeGenCXX/cast-conversion.cpp +++ b/test/CodeGenCXX/cast-conversion.cpp @@ -1,3 +1,4 @@ +// REQUIRES: x86-registered-target,x86-64-registered-target // RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s // RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s diff --git a/test/CodeGenCXX/constructor-conversion.cpp b/test/CodeGenCXX/constructor-conversion.cpp index 405bba67e862d..58d0d39c8107b 100644 --- a/test/CodeGenCXX/constructor-conversion.cpp +++ b/test/CodeGenCXX/constructor-conversion.cpp @@ -1,3 +1,4 @@ +// REQUIRES: x86-registered-target,x86-64-registered-target // RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s // RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s diff --git a/test/CodeGenCXX/constructor-default-arg.cpp b/test/CodeGenCXX/constructor-default-arg.cpp index 0c08c7694e39f..dc0ab50ba5c60 100644 --- a/test/CodeGenCXX/constructor-default-arg.cpp +++ b/test/CodeGenCXX/constructor-default-arg.cpp @@ -1,3 +1,4 @@ +// REQUIRES: x86-registered-target,x86-64-registered-target // RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s // RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s diff --git a/test/CodeGenCXX/constructor-for-array-members.cpp b/test/CodeGenCXX/constructor-for-array-members.cpp index fd6dc6dc15dc3..ef5900e59c114 100644 --- a/test/CodeGenCXX/constructor-for-array-members.cpp +++ b/test/CodeGenCXX/constructor-for-array-members.cpp @@ -1,3 +1,4 @@ +// REQUIRES: x86-registered-target,x86-64-registered-target // RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s // RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s diff --git a/test/CodeGenCXX/constructor-template.cpp b/test/CodeGenCXX/constructor-template.cpp index a3f38a6984ac5..7472d7e5bc63a 100644 --- a/test/CodeGenCXX/constructor-template.cpp +++ b/test/CodeGenCXX/constructor-template.cpp @@ -1,3 +1,4 @@ +// REQUIRES: x86-registered-target,x86-64-registered-target // RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s // RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s diff --git a/test/CodeGenCXX/convert-to-fptr.cpp b/test/CodeGenCXX/convert-to-fptr.cpp index f895dbcaf6f04..c1c9f63079f9b 100644 --- a/test/CodeGenCXX/convert-to-fptr.cpp +++ b/test/CodeGenCXX/convert-to-fptr.cpp @@ -1,3 +1,4 @@ +// REQUIRES: x86-registered-target,x86-64-registered-target // RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s // RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s diff --git a/test/CodeGenCXX/copy-assign-synthesis-1.cpp b/test/CodeGenCXX/copy-assign-synthesis-1.cpp index eb761c27367d5..17abeb90d4b39 100644 --- a/test/CodeGenCXX/copy-assign-synthesis-1.cpp +++ b/test/CodeGenCXX/copy-assign-synthesis-1.cpp @@ -1,3 +1,4 @@ +// REQUIRES: x86-registered-target,x86-64-registered-target // RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s // RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s diff --git a/test/CodeGenCXX/cxx0x-defaulted-templates.cpp b/test/CodeGenCXX/cxx0x-defaulted-templates.cpp new file mode 100644 index 0000000000000..3d4000e4994cf --- /dev/null +++ b/test/CodeGenCXX/cxx0x-defaulted-templates.cpp @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -std=c++0x -emit-llvm -o - %s | FileCheck %s + +template +struct X { + X(); +}; + +// CHECK: define void @_ZN1XIbEC1Ev +// CHECK: define void @_ZN1XIbEC2Ev +template <> X::X() = default; + +// CHECK: define weak_odr void @_ZN1XIiEC1Ev +// CHECK: define weak_odr void @_ZN1XIiEC2Ev +template X::X() = default; +template X::X(); + +// CHECK: define linkonce_odr void @_ZN1XIcEC1Ev +// CHECK: define linkonce_odr void @_ZN1XIcEC2Ev +X x; diff --git a/test/CodeGenCXX/cxx0x-delegating-ctors.cpp b/test/CodeGenCXX/cxx0x-delegating-ctors.cpp index 5b432c769016c..15c8e7f5d8273 100644 --- a/test/CodeGenCXX/cxx0x-delegating-ctors.cpp +++ b/test/CodeGenCXX/cxx0x-delegating-ctors.cpp @@ -2,10 +2,10 @@ struct non_trivial { non_trivial(); - ~non_trivial(); + ~non_trivial() noexcept(false); }; non_trivial::non_trivial() {} -non_trivial::~non_trivial() {} +non_trivial::~non_trivial() noexcept(false) {} // We use a virtual base to ensure that the constructor // delegation optimization (complete->base) can't be @@ -22,27 +22,35 @@ delegator::delegator() { throw 0; } -// CHECK: define void @_ZN9delegatorC1Ei -// CHECK: call void @_ZN9delegatorC1Ev -// CHECK-NOT: lpad -// CHECK: ret -// CHECK-NOT: lpad -// CHECK: define void @_ZN9delegatorC2Ei -// CHECK: call void @_ZN9delegatorC2Ev -// CHECK-NOT: lpad -// CHECK: ret -// CHECK-NOT: lpad -delegator::delegator(int) - : delegator() -{} delegator::delegator(bool) {} +// CHECK: define void @_ZN9delegatorC1Ec +// CHECK: void @_ZN9delegatorC1Eb +// CHECK: void @__cxa_throw +// CHECK: void @_ZSt9terminatev +// CHECK: void @_ZN9delegatorD1Ev // CHECK: define void @_ZN9delegatorC2Ec -// CHECK: call void @_ZN9delegatorC2Eb -// CHECK: call void @__cxa_throw +// CHECK: void @_ZN9delegatorC2Eb +// CHECK: void @__cxa_throw +// CHECK: void @_ZSt9terminatev +// CHECK: void @_ZN9delegatorD2Ev delegator::delegator(char) : delegator(true) { throw 0; } + +// CHECK: define void @_ZN9delegatorC1Ei +// CHECK: void @_ZN9delegatorC1Ev +// CHECK-NOT: void @_ZSt9terminatev +// CHECK: ret +// CHECK-NOT: void @_ZSt9terminatev +// CHECK: define void @_ZN9delegatorC2Ei +// CHECK: void @_ZN9delegatorC2Ev +// CHECK-NOT: void @_ZSt9terminatev +// CHECK: ret +// CHECK-NOT: void @_ZSt9terminatev +delegator::delegator(int) + : delegator() +{} diff --git a/test/CodeGenCXX/debug-info-pubtypes.cpp b/test/CodeGenCXX/debug-info-pubtypes.cpp new file mode 100644 index 0000000000000..35ba90b13f87d --- /dev/null +++ b/test/CodeGenCXX/debug-info-pubtypes.cpp @@ -0,0 +1,15 @@ +// REQUIRES: x86-64-registered-target +// RUN: %clang -cc1 -triple x86_64-apple-darwin10 -g -S %s -o %t +// RUN: FileCheck %s < %t + +//CHECK: .asciz "G" +//CHECK-NEXT: .long 0 +//CHECK-NEXT: Lpubtypes_end1: + +class G { +public: + void foo(); +}; + +void G::foo() { +} diff --git a/test/CodeGenCXX/decl-ref-init.cpp b/test/CodeGenCXX/decl-ref-init.cpp index 58fdedabc3334..a066fbb3f3ea7 100644 --- a/test/CodeGenCXX/decl-ref-init.cpp +++ b/test/CodeGenCXX/decl-ref-init.cpp @@ -1,3 +1,4 @@ +// REQUIRES: x86-registered-target,x86-64-registered-target // RUN: %clang_cc1 -triple x86_64-apple-darwin -S %s -o %t-64.s // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s // RUN: %clang_cc1 -triple i386-apple-darwin -S %s -o %t-32.s diff --git a/test/CodeGenCXX/default-constructor-for-members.cpp b/test/CodeGenCXX/default-constructor-for-members.cpp index a97764ddcf02e..714811f37b140 100644 --- a/test/CodeGenCXX/default-constructor-for-members.cpp +++ b/test/CodeGenCXX/default-constructor-for-members.cpp @@ -1,3 +1,4 @@ +// REQUIRES: x86-registered-target,x86-64-registered-target // RUN: %clang_cc1 -triple x86_64-apple-darwin -S %s -o %t-64.s // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s // RUN: %clang_cc1 -triple i386-apple-darwin -S %s -o %t-32.s diff --git a/test/CodeGenCXX/derived-to-base-conv.cpp b/test/CodeGenCXX/derived-to-base-conv.cpp index 006f264337123..c47c83180906b 100644 --- a/test/CodeGenCXX/derived-to-base-conv.cpp +++ b/test/CodeGenCXX/derived-to-base-conv.cpp @@ -1,3 +1,4 @@ +// REQUIRES: x86-registered-target,x86-64-registered-target // RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s // RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s diff --git a/test/CodeGenCXX/destructors.cpp b/test/CodeGenCXX/destructors.cpp index 353b61061ad1c..94d88334f85b7 100644 --- a/test/CodeGenCXX/destructors.cpp +++ b/test/CodeGenCXX/destructors.cpp @@ -334,7 +334,7 @@ namespace test7 { // CHECK: ret void // CHECK: call i8* @llvm.eh.exception( // CHECK: call void @_ZdlPv({{.*}}) nounwind - // CHECK: call void @_Unwind_Resume_or_Rethrow + // CHECK: call void @llvm.eh.resume( // Checked at top of file: // @_ZN5test312_GLOBAL__N_11DD1Ev = alias internal {{.*}} @_ZN5test312_GLOBAL__N_11DD2Ev @@ -364,7 +364,7 @@ namespace test7 { // CHECK: ret void // CHECK: call i8* @llvm.eh.exception() // CHECK: call void @_ZdlPv({{.*}}) nounwind - // CHECK: call void @_Unwind_Resume_or_Rethrow( + // CHECK: call void @llvm.eh.resume( // CHECK: define internal void @_ZThn8_N5test312_GLOBAL__N_11CD1Ev( // CHECK: getelementptr inbounds i8* {{.*}}, i64 -8 diff --git a/test/CodeGenCXX/eh.cpp b/test/CodeGenCXX/eh.cpp index 6c44c76129662..44219b4f1754a 100644 --- a/test/CodeGenCXX/eh.cpp +++ b/test/CodeGenCXX/eh.cpp @@ -30,7 +30,8 @@ void test2() { } // CHECK: define void @_Z5test2v() -// CHECK: [[EXNSLOTVAR:%.*]] = alloca i8* +// CHECK: [[EXNVAR:%.*]] = alloca i8* +// CHECK-NEXT: [[SELECTORVAR:%.*]] = alloca i32 // CHECK-NEXT: [[CLEANUPDESTVAR:%.*]] = alloca i32 // CHECK-NEXT: [[EXNOBJ:%.*]] = call i8* @__cxa_allocate_exception(i64 16) // CHECK-NEXT: [[EXN:%.*]] = bitcast i8* [[EXNOBJ]] to [[DSTAR:%[^*]*\*]] @@ -104,6 +105,7 @@ namespace test7 { // CHECK: define i32 @_ZN5test73fooEv() int foo() { // CHECK: [[CAUGHTEXNVAR:%.*]] = alloca i8* +// CHECK-NEXT: [[SELECTORVAR:%.*]] = alloca i32 // CHECK-NEXT: [[INTCATCHVAR:%.*]] = alloca i32 // CHECK-NEXT: [[EHCLEANUPDESTVAR:%.*]] = alloca i32 try { @@ -117,7 +119,8 @@ namespace test7 { // CHECK: [[CAUGHTEXN:%.*]] = call i8* @llvm.eh.exception() // CHECK-NEXT: store i8* [[CAUGHTEXN]], i8** [[CAUGHTEXNVAR]] -// CHECK-NEXT: call i32 (i8*, i8*, ...)* @llvm.eh.selector(i8* [[CAUGHTEXN]], i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i8* bitcast (i8** @_ZTIi to i8*), i8* null) +// CHECK-NEXT: [[SELECTOR:%.*]] = call i32 (i8*, i8*, ...)* @llvm.eh.selector(i8* [[CAUGHTEXN]], i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i8* bitcast (i8** @_ZTIi to i8*), i8* null) +// CHECK-NEXT: store i32 [[SELECTOR]], i32* [[SELECTORVAR]] // CHECK-NEXT: call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @_ZTIi to i8*)) // CHECK-NEXT: icmp eq // CHECK-NEXT: br i1 @@ -130,7 +133,8 @@ namespace test7 { } // CHECK: [[CAUGHTEXN:%.*]] = call i8* @llvm.eh.exception() // CHECK-NEXT: store i8* [[CAUGHTEXN]], i8** [[CAUGHTEXNVAR]] -// CHECK-NEXT: call i32 (i8*, i8*, ...)* @llvm.eh.selector(i8* [[CAUGHTEXN]], i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i8* null) +// CHECK-NEXT: [[SELECTOR:%.*]] = call i32 (i8*, i8*, ...)* @llvm.eh.selector(i8* [[CAUGHTEXN]], i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i8* null) +// CHECK-NEXT: store i32 [[SELECTOR]], i32* [[SELECTORVAR]] // CHECK-NEXT: store i32 1, i32* [[EHCLEANUPDESTVAR]] // CHECK-NEXT: call void @__cxa_end_catch() // CHECK-NEXT: br label @@ -159,7 +163,7 @@ namespace test8 { // CHECK-NEXT: bitcast // CHECK-NEXT: invoke void @_ZN5test81AC1ERKS0_( // CHECK: call i8* @__cxa_begin_catch - // CHECK-NEXT: invoke void @_ZN5test81AD1Ev( + // CHECK-NEXT: call void @_ZN5test81AD1Ev( // CHECK: call void @__cxa_end_catch() // CHECK: ret void } @@ -190,7 +194,7 @@ namespace test9 { // landing pad from first call to invoke // CHECK: call i8* @llvm.eh.exception - // CHECK: call i32 (i8*, i8*, ...)* @llvm.eh.selector(i8* {{.*}}, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i8* bitcast (i8** @_ZTIi to i8*), i8* null) + // CHECK: call i32 (i8*, i8*, ...)* @llvm.eh.selector(i8* {{.*}}, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i8* bitcast (i8** @_ZTIi to i8*)) } // __cxa_end_catch can throw for some kinds of caught exceptions. @@ -255,6 +259,7 @@ namespace test11 { void bar() { try { // CHECK: [[EXNSLOT:%.*]] = alloca i8* + // CHECK-NEXT: [[SELECTORSLOT:%.*]] = alloca i32 // CHECK-NEXT: [[P:%.*]] = alloca [[A:%.*]]**, // CHECK-NEXT: [[TMP:%.*]] = alloca [[A]]* // CHECK-NEXT: invoke void @_ZN6test116opaqueEv() @@ -272,7 +277,7 @@ namespace test11 { // PR7686 namespace test12 { - struct A { ~A(); }; + struct A { ~A() noexcept(false); }; bool opaque(const A&); // CHECK: define void @_ZN6test124testEv() @@ -392,8 +397,8 @@ namespace test15 { } namespace test16 { - struct A { A(); ~A(); }; - struct B { int x; B(const A &); ~B(); }; + struct A { A(); ~A() noexcept(false); }; + struct B { int x; B(const A &); ~B() noexcept(false); }; void foo(); bool cond(); @@ -403,6 +408,7 @@ namespace test16 { // CHECK-NEXT: [[EXN_ACTIVE:%.*]] = alloca i1 // CHECK-NEXT: [[TEMP:%.*]] = alloca [[A:%.*]], // CHECK-NEXT: [[EXNSLOT:%.*]] = alloca i8* + // CHECK-NEXT: [[SELECTORSLOT:%.*]] = alloca i32 // CHECK-NEXT: [[EHDEST:%.*]] = alloca i32 // CHECK-NEXT: [[TEMP_ACTIVE:%.*]] = alloca i1 diff --git a/test/CodeGenCXX/exceptions.cpp b/test/CodeGenCXX/exceptions.cpp index d9b850672cd11..b32b90bf74127 100644 --- a/test/CodeGenCXX/exceptions.cpp +++ b/test/CodeGenCXX/exceptions.cpp @@ -273,6 +273,7 @@ namespace test5 { // CHECK: define void @_ZN5test54testEv() // CHECK: [[EXNSLOT:%.*]] = alloca i8* + // CHECK-NEXT: [[SELECTORSLOT:%.*]] = alloca i32 // CHECK-NEXT: [[A:%.*]] = alloca [[A_T:%.*]], align 1 // CHECK-NEXT: [[T:%.*]] = alloca [[T_T:%.*]], align 1 // CHECK-NEXT: alloca i32 @@ -324,6 +325,7 @@ namespace test7 { // CHECK-NEXT: alloca [[A:%.*]], // CHECK-NEXT: alloca i8* // CHECK-NEXT: alloca i32 + // CHECK-NEXT: alloca i32 // CHECK-NEXT: [[OUTER_A:%.*]] = alloca i1 // CHECK-NEXT: alloca i8* // CHECK-NEXT: [[INNER_NEW:%.*]] = alloca i1 diff --git a/test/CodeGenCXX/global-array-destruction.cpp b/test/CodeGenCXX/global-array-destruction.cpp index c77551cb32d1f..bbe574daa588d 100644 --- a/test/CodeGenCXX/global-array-destruction.cpp +++ b/test/CodeGenCXX/global-array-destruction.cpp @@ -1,3 +1,4 @@ +// REQUIRES: x86-64-registered-target // RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s diff --git a/test/CodeGenCXX/global-llvm-constant.cpp b/test/CodeGenCXX/global-llvm-constant.cpp index ef1dcf0c59bf2..2bd43b99a5d94 100644 --- a/test/CodeGenCXX/global-llvm-constant.cpp +++ b/test/CodeGenCXX/global-llvm-constant.cpp @@ -8,3 +8,25 @@ struct A { const A x; // CHECK: @_ZL1x = internal global + +struct X { + int (*fp)(int, int); +}; + +int add(int x, int y) { return x + y; } + +// CHECK: @x2 = constant +extern const X x2; +const X x2 = { &add }; + +struct X1 { + mutable int i; +}; + +struct X2 { + X1 array[3]; +}; + +// CHECK: @x2b = global +extern const X2 x2b; +const X2 x2b = { { { 1 }, { 2 }, { 3 } } }; diff --git a/test/CodeGenCXX/goto.cpp b/test/CodeGenCXX/goto.cpp index 3286b228b25fb..9a12a9125398f 100644 --- a/test/CodeGenCXX/goto.cpp +++ b/test/CodeGenCXX/goto.cpp @@ -12,6 +12,7 @@ namespace test0 { // CHECK-NEXT: [[Y:%.*]] = alloca [[A:%.*]], // CHECK-NEXT: [[Z:%.*]] = alloca [[A]] // CHECK-NEXT: [[EXN:%.*]] = alloca i8* + // CHECK-NEXT: [[SEL:%.*]] = alloca i32 // CHECK-NEXT: alloca i32 // CHECK-NEXT: [[V:%.*]] = alloca [[V:%.*]]*, // CHECK-NEXT: [[TMP:%.*]] = alloca [[A]] diff --git a/test/CodeGenCXX/instrument-functions.cpp b/test/CodeGenCXX/instrument-functions.cpp new file mode 100644 index 0000000000000..253e096108930 --- /dev/null +++ b/test/CodeGenCXX/instrument-functions.cpp @@ -0,0 +1,30 @@ +// RUN: %clang_cc1 -S -emit-llvm -o - %s -finstrument-functions | FileCheck %s + +// CHECK: @_Z5test1i +int test1(int x) { +// CHECK: __cyg_profile_func_enter +// CHECK: __cyg_profile_func_exit +// CHECK: ret + return x; +} + +// CHECK: @_Z5test2i +int test2(int) __attribute__((no_instrument_function)); +int test2(int x) { +// CHECK-NOT: __cyg_profile_func_enter +// CHECK-NOT: __cyg_profile_func_exit +// CHECK: ret + return x; +} + +// This test case previously crashed code generation. It exists solely +// to test -finstrument-function does not crash codegen for this trivial +// case. +namespace rdar9445102 { + class Rdar9445102 { + public: + Rdar9445102(); + }; +} +static rdar9445102::Rdar9445102 s_rdar9445102Initializer; + diff --git a/test/CodeGenCXX/internal-linkage.cpp b/test/CodeGenCXX/internal-linkage.cpp index 39bce8545ff5d..56cb81030922c 100644 --- a/test/CodeGenCXX/internal-linkage.cpp +++ b/test/CodeGenCXX/internal-linkage.cpp @@ -54,3 +54,11 @@ char const * *test4() // CHECK: @extern_nonconst_xyzzy = global return &extern_nonconst_xyzzy; } + +// PR10120 +template class klass { + virtual void f(); +}; +namespace { struct S; } +void foo () { klass x; } +// CHECK: @_ZTV5klassIN12_GLOBAL__N_11SEE = internal unnamed_addr constant diff --git a/test/CodeGenCXX/mangle-alias-template.cpp b/test/CodeGenCXX/mangle-alias-template.cpp new file mode 100644 index 0000000000000..2020a0a584e1d --- /dev/null +++ b/test/CodeGenCXX/mangle-alias-template.cpp @@ -0,0 +1,41 @@ +// RUN: %clang_cc1 -std=c++0x -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s + +template struct alloc {}; +template using Alloc = alloc; +template> struct vector {}; + +template using Vec = vector; + +template void f(Vec v); +template void g(T); + +template class F> void h(F); + +// CHECK: define void @_Z1zv( +void z() { + vector VI; + f(VI); + // CHECK: call void @_Z1fIiEv6vectorIT_5allocIS1_EE( + + Vec VD; + g(VD); + // CHECK: call void @_Z1gI6vectorId5allocIdEEEvT_( + + h(VI); + // CHECK: call void @_Z1hI3VecEvT_IiE( + + Alloc AC; + h(AC); + // CHECK: call void @_Z1hI5allocEvT_IiE( + + h(AC); + // CHECK: call void @_Z1hI5AllocEvT_IiE( + + Vec VC; + g>(VC); + // CHECK: call void @_Z1gI6vectorIc5allocIcEEEvT_( + + Vec> VVI; + g(VVI); + // CHECK: call void @_Z1gI6vectorIS0_Ii5allocIiEES1_IS3_EEEvT_( +} diff --git a/test/CodeGenCXX/mangle-exprs.cpp b/test/CodeGenCXX/mangle-exprs.cpp index 46c46f04a8a24..75294e059c558 100644 --- a/test/CodeGenCXX/mangle-exprs.cpp +++ b/test/CodeGenCXX/mangle-exprs.cpp @@ -109,3 +109,19 @@ namespace test2 { // CHECK: store float {{.*}}, float* @_ZZN5test21gIPFfvEEEvT_DTclfL0p_EEE8variable, } + +namespace test3 { + template void a(T x, U y, decltype(x.*y) z) {} + + struct X { + int *member; + }; + + // CHECK: define void @_ZN5test311instantiateEv + void instantiate() { + X x; + int *ip; + // CHECK: call void @_ZN5test31aINS_1XEMS1_PiEEvT_T0_DTdsfL0p_fL0p0_E + a(x, &X::member, ip); + } +} diff --git a/test/CodeGenCXX/mangle-subst-std.cpp b/test/CodeGenCXX/mangle-subst-std.cpp index fea3582d321a3..837d4fa8570de 100644 --- a/test/CodeGenCXX/mangle-subst-std.cpp +++ b/test/CodeGenCXX/mangle-subst-std.cpp @@ -11,6 +11,7 @@ // CHECK: @_ZTVSo = linkonce_odr unnamed_addr constant // CHECK: @_ZTTSi = linkonce_odr unnamed_addr constant // CHECK: @_ZTVSi = linkonce_odr unnamed_addr constant + namespace std { struct A { A(); }; diff --git a/test/CodeGenCXX/mangle-unnameable-conversions.cpp b/test/CodeGenCXX/mangle-unnameable-conversions.cpp new file mode 100644 index 0000000000000..2132eff5e511f --- /dev/null +++ b/test/CodeGenCXX/mangle-unnameable-conversions.cpp @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -std=c++0x -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s + +template using id = T; +struct S { + template + operator id&(); + template + operator id() const; +}; + +void f() { + int (&a)[42] = S(); // CHECK: @_ZN1ScvRAT0__T_IiLi42EEEv( + char (S::*fp)() = S(); // CHECK: @_ZNK1ScvMT0_FT_vEIcS_EEv( +}; diff --git a/test/CodeGenCXX/mangle.cpp b/test/CodeGenCXX/mangle.cpp index 27777a51c4f1f..01dcf8b2305af 100644 --- a/test/CodeGenCXX/mangle.cpp +++ b/test/CodeGenCXX/mangle.cpp @@ -397,16 +397,16 @@ namespace test3 { struct Path2 : AmbiguousBase { double p; }; struct Derived : Path1, Path2 { }; - // CHECK: define linkonce_odr i32 @_ZN5test38get_ab_1INS_7DerivedEEEDtptcvPT_Li0EsrNS_5Path1E2abERS2_( + // CHECK: define linkonce_odr i32 @_ZN5test38get_ab_1INS_7DerivedEEEDtptcvPT_Li0Esr5Path1E2abERS2_( template decltype(((T*) 0)->Path1::ab) get_ab_1(T &ref) { return ref.Path1::ab; } - // CHECK: define linkonce_odr i32 @_ZN5test38get_ab_2INS_7DerivedEEEDtptcvPT_Li0EsrNS_5Path2E2abERS2_( + // CHECK: define linkonce_odr i32 @_ZN5test38get_ab_2INS_7DerivedEEEDtptcvPT_Li0Esr5Path2E2abERS2_( template decltype(((T*) 0)->Path2::ab) get_ab_2(T &ref) { return ref.Path2::ab; } - // CHECK: define linkonce_odr float @_ZN5test37get_p_1INS_7DerivedEEEDtptcvPT_Li0EsrNS_5Path1E1pERS2_( + // CHECK: define linkonce_odr float @_ZN5test37get_p_1INS_7DerivedEEEDtptcvPT_Li0Esr5Path1E1pERS2_( template decltype(((T*) 0)->Path1::p) get_p_1(T &ref) { return ref.Path1::p; } - // CHECK: define linkonce_odr double @_ZN5test37get_p_2INS_7DerivedEEEDtptcvPT_Li0EsrNS_5Path2E1pERS2_( + // CHECK: define linkonce_odr double @_ZN5test37get_p_2INS_7DerivedEEEDtptcvPT_Li0Esr5Path2E1pERS2_( template decltype(((T*) 0)->Path2::p) get_p_2(T &ref) { return ref.Path2::p; } Derived obj; @@ -676,3 +676,38 @@ namespace test25 { A::call(); } } + +namespace test26 { + template