Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / CodeGen / temporary-lifetime-exceptions.cpp
blob50e4a0f56cb2d75ba9ec96fd527c7e12cf640bfa
1 // RUN: %clang_cc1 %s -fexceptions -fcxx-exceptions -std=c++11 -O1 -triple x86_64 -emit-llvm -o - | FileCheck %s
3 // lifetime.end should be invoked even if the destructor doesn't run due to an
4 // exception thrown from previous ctor call.
6 struct A { A(); ~A(); };
7 A Baz(const A&);
9 void Test1() {
10 // CHECK-LABEL: @_Z5Test1v(
11 // CHECK: call void @llvm.lifetime.start.p0(i64 1, ptr nonnull [[TMP:[^ ]+]])
12 // CHECK: call void @llvm.lifetime.start.p0(i64 1, ptr nonnull [[TMP1:[^ ]+]])
14 // Normal exit
15 // CHECK: call void @llvm.lifetime.end.p0(i64 1, ptr nonnull [[TMP1]])
16 // CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 1, ptr nonnull [[TMP]])
18 // Exception exit
19 // CHECK: call void @llvm.lifetime.end.p0(i64 1, ptr nonnull [[TMP1]])
20 // CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 1, ptr nonnull [[TMP]])
21 Baz(Baz(A()));