summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/goto.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-10-05 22:36:42 +0000
committerJohn McCall <rjmccall@apple.com>2010-10-05 22:36:42 +0000
commit09d1369964f1f071bdede1d74c94a2d3247b28fa (patch)
treea7401c0c15ec68a9fc94c74b26f6dda3b6263331 /clang/test/CodeGenCXX/goto.cpp
parent0ad137e98e1f001f24178cf5c06ab2d4c4fa8737 (diff)
downloadbcm5719-llvm-09d1369964f1f071bdede1d74c94a2d3247b28fa.tar.gz
bcm5719-llvm-09d1369964f1f071bdede1d74c94a2d3247b28fa.zip
When instantiating a new-expression, force a rebuild if there were default
arguments in either the placement or constructor arguments. This is important if the default arguments refer to a declaration or create a temporary. llvm-svn: 115700
Diffstat (limited to 'clang/test/CodeGenCXX/goto.cpp')
-rw-r--r--clang/test/CodeGenCXX/goto.cpp54
1 files changed, 34 insertions, 20 deletions
diff --git a/clang/test/CodeGenCXX/goto.cpp b/clang/test/CodeGenCXX/goto.cpp
index 2104b89b74e..2a44d726c17 100644
--- a/clang/test/CodeGenCXX/goto.cpp
+++ b/clang/test/CodeGenCXX/goto.cpp
@@ -1,29 +1,43 @@
-// RUN: %clang-cc1 %s -fexceptions -emit-llvm-only
+// RUN: %clang-cc1 %s -triple=x86_64-apple-darwin10 -fexceptions -emit-llvm -o - | FileCheck %s
// Reduced from a crash on boost::interprocess's node_allocator_test.cpp.
namespace test0 {
struct A { A(); ~A(); };
struct V { V(const A &a = A()); ~V(); };
- template<int X> int vector_test()
- {
- A process_name;
- try {
- A segment;
+ // CHECK: define linkonce_odr i32 @_ZN5test04testILi0EEEii
+ template<int X> int test(int x) {
+ // CHECK: [[RET:%.*]] = alloca i32
+ // CHECK-NEXT: [[X:%.*]] = alloca i32
+ // CHECK-NEXT: [[Y:%.*]] = alloca [[A:%.*]],
+ // CHECK-NEXT: [[Z:%.*]] = alloca [[A]]
+ // CHECK-NEXT: [[EXN:%.*]] = alloca i8*
+ // CHECK-NEXT: alloca i32
+ // CHECK-NEXT: [[V:%.*]] = alloca [[V:%.*]]*,
+ // CHECK-NEXT: [[TMP:%.*]] = alloca [[A]]
+ // CHECK-NEXT: [[CLEANUPACTIVE:%.*]] = alloca i1
+ // CHECK: store i1 true, i1* [[CLEANUPACTIVE]]
+ // CHECK: call void @_ZN5test01AC1Ev([[A]]* [[Y]])
+ // CHECK-NEXT: invoke void @_ZN5test01AC1Ev([[A]]* [[Z]])
+ // CHECK: [[NEW:%.*]] = invoke noalias i8* @_Znwm(i64 1)
+ // CHECK: [[NEWCAST:%.*]] = bitcast i8* [[NEW]] to [[V]]*
+ // CHECK-NEXT: invoke void @_ZN5test01AC1Ev([[A]]* [[TMP]])
+ // CHECK: invoke void @_ZN5test01VC1ERKNS_1AE([[V]]* [[NEWCAST]], [[A]]* [[TMP]])
+ // CHECK: store i1 false, i1* [[CLEANUPACTIVE]]
+ // CHECK-NEXT: invoke void @_ZN5test01AD1Ev([[A]]* [[TMP]])
+ A y;
+ try {
+ A z;
+ V *v = new V();
- V *stdvector = new V();
+ if (x) return 1;
+ } catch (int ex) {
+ return 1;
+ }
+ return 0;
+ }
- int x = 5, y = 7;
- if(x == y) return 1;
- }
- catch(int ex){
- return 1;
- }
- return 0;
-}
-
-int main ()
-{
- return vector_test<0>();
-}
+ int test() {
+ return test<0>(5);
+ }
}
OpenPOWER on IntegriCloud