brintos

brintos / llvm-project-archived public Read only

0
0
Text · 804 B · 45400c2 Raw
23 lines · cpp
1// RUN: %clang_cc1 %s -fexceptions -fcxx-exceptions -std=c++11 -O1 -triple x86_64 -emit-llvm -o - | FileCheck %s2 3// lifetime.end should be invoked even if the destructor doesn't run due to an4// exception thrown from previous ctor call.5 6struct A { A(); ~A(); };7A Baz(const A&);8 9void Test1() {10  // CHECK-LABEL: @_Z5Test1v(11  // CHECK: call void @llvm.lifetime.start.p0(ptr nonnull [[TMP:[^ ]+]])12  // CHECK: call void @llvm.lifetime.start.p0(ptr nonnull [[TMP1:[^ ]+]])13 14  // Normal exit15  // CHECK: call void @llvm.lifetime.end.p0(ptr nonnull [[TMP1]])16  // CHECK-NEXT: call void @llvm.lifetime.end.p0(ptr nonnull [[TMP]])17 18  // Exception exit19  // CHECK: call void @llvm.lifetime.end.p0(ptr nonnull [[TMP1]])20  // CHECK-NEXT: call void @llvm.lifetime.end.p0(ptr nonnull [[TMP]])21  Baz(Baz(A()));22}23