|
| 1 | +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fcxx-exceptions -fexceptions -I%S/../Inputs -fclangir -emit-cir %s -o %t.cir |
| 2 | +// RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s |
| 3 | +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fcxx-exceptions -fexceptions -I%S/../Inputs -fclangir -emit-llvm %s -o %t.ll |
| 4 | +// RUN: FileCheck --check-prefix=LLVM --input-file=%t.ll %s |
| 5 | + |
| 6 | +#include "std-cxx.h" |
| 7 | + |
| 8 | +// CIR-LABEL: @_Z3fooPKc |
| 9 | +// LLVM-LABEL: @_Z3fooPKc |
| 10 | + |
| 11 | +void foo(const char* path) { |
| 12 | + std::string str = path; |
| 13 | + str = path; |
| 14 | + str = path; |
| 15 | +} |
| 16 | + |
| 17 | +// CIR: cir.try synthetic cleanup { |
| 18 | +// CIR: cir.call exception @_ZNSbIcEC1EPKcRKNS_9AllocatorE({{.*}}, {{.*}}, {{.*}}) : (!cir.ptr<!ty_std3A3Abasic_string3Cchar3E>, !cir.ptr<!s8i>, !cir.ptr<!ty_std3A3Abasic_string3Cchar3E3A3AAllocator>) -> () cleanup { |
| 19 | +// CIR: cir.call @_ZNSbIcED1Ev({{.*}}) : (!cir.ptr<!ty_std3A3Abasic_string3Cchar3E>) -> () |
| 20 | +// CIR: cir.yield |
| 21 | +// CIR: } |
| 22 | +// CIR: cir.yield |
| 23 | +// CIR: } catch [#cir.unwind { |
| 24 | +// CIR: cir.resume |
| 25 | +// CIR: }] |
| 26 | +// CIR: cir.try synthetic cleanup { |
| 27 | +// CIR: {{.*}} = cir.call exception @_ZNSbIcEaSERKS_({{.*}}, {{.*}}) : (!cir.ptr<!ty_std3A3Abasic_string3Cchar3E>, !cir.ptr<!ty_std3A3Abasic_string3Cchar3E>) -> !cir.ptr<!ty_std3A3Abasic_string3Cchar3E> cleanup { |
| 28 | +// CIR: cir.call @_ZNSbIcED1Ev({{.*}}) : (!cir.ptr<!ty_std3A3Abasic_string3Cchar3E>) -> () |
| 29 | +// CIR: cir.yield |
| 30 | +// CIR: } |
| 31 | +// CIR: cir.store {{.*}}, {{.*}} : !cir.ptr<!ty_std3A3Abasic_string3Cchar3E>, !cir.ptr<!cir.ptr<!ty_std3A3Abasic_string3Cchar3E>> |
| 32 | +// CIR: cir.yield |
| 33 | +// CIR: } catch [#cir.unwind { |
| 34 | +// CIR: cir.resume |
| 35 | +// CIR: }] |
| 36 | +// CIR: {{.*}} = cir.load {{.*}} : !cir.ptr<!cir.ptr<!ty_std3A3Abasic_string3Cchar3E>>, !cir.ptr<!ty_std3A3Abasic_string3Cchar3E> |
| 37 | +// CIR: cir.call @_ZNSbIcED1Ev({{.*}}) : (!cir.ptr<!ty_std3A3Abasic_string3Cchar3E>) -> () |
| 38 | +// CIR: cir.try synthetic cleanup { |
| 39 | +// CIR: cir.call exception @_ZNSbIcEC1EPKcRKNS_9AllocatorE({{.*}}, {{.*}}, {{.*}}) : (!cir.ptr<!ty_std3A3Abasic_string3Cchar3E>, !cir.ptr<!s8i>, !cir.ptr<!ty_std3A3Abasic_string3Cchar3E3A3AAllocator>) -> () |
| 40 | +// CIR: cir.yield |
| 41 | +// CIR: } catch [#cir.unwind { |
| 42 | +// CIR: cir.resume |
| 43 | +// CIR: }] |
| 44 | +// CIR: cir.try synthetic cleanup { |
| 45 | +// CIR: {{.*}} = cir.call exception @_ZNSbIcEaSERKS_({{.*}}, {{.*}}) : (!cir.ptr<!ty_std3A3Abasic_string3Cchar3E>, !cir.ptr<!ty_std3A3Abasic_string3Cchar3E>) -> !cir.ptr<!ty_std3A3Abasic_string3Cchar3E> cleanup { |
| 46 | +// CIR: cir.call @_ZNSbIcED1Ev({{.*}}) : (!cir.ptr<!ty_std3A3Abasic_string3Cchar3E>) -> () |
| 47 | +// CIR: cir.call @_ZNSbIcED1Ev({{.*}}) : (!cir.ptr<!ty_std3A3Abasic_string3Cchar3E>) -> () |
| 48 | +// CIR: cir.yield |
| 49 | +// CIR: } |
| 50 | +// CIR: cir.store {{.*}}, {{.*}} : !cir.ptr<!ty_std3A3Abasic_string3Cchar3E>, !cir.ptr<!cir.ptr<!ty_std3A3Abasic_string3Cchar3E>> |
| 51 | +// CIR: cir.yield |
| 52 | +// CIR: } catch [#cir.unwind { |
| 53 | +// CIR: cir.resume |
| 54 | +// CIR: }] |
| 55 | + |
| 56 | +// LLVM: invoke void @_ZNSbIcEC1EPKcRKNS_9AllocatorE(ptr {{.*}}, ptr {{.*}}, ptr {{.*}}) |
| 57 | +// LLVM: to label {{.*}} unwind label %[[B18:.*]] |
| 58 | +// LLVM: [[B18]] |
| 59 | +// LLVM: call void @_ZNSbIcED1Ev(ptr {{.*}}) |
| 60 | +// LLVM: br label %[[B22:.*]] |
| 61 | +// LLVM: [[B22]] |
| 62 | +// LLVM: resume { ptr, i32 } {{.*}} |
| 63 | +// LLVM: {{.*}}: |
| 64 | +// LLVM: {{.*}} = invoke ptr @_ZNSbIcEaSERKS_(ptr {{.*}}, ptr {{.*}}) |
| 65 | +// LLVM: to label {{.*}} unwind label %[[B31:.*]] |
| 66 | +// LLVM: [[B31]] |
| 67 | +// LLVM: call void @_ZNSbIcED1Ev(ptr {{.*}}) |
| 68 | +// LLVM: br label %[[B35:.*]] |
| 69 | +// LLVM: [[B35]] |
| 70 | +// LLVM: resume { ptr, i32 } {{.*}} |
| 71 | +// LLVM: {{.*}}: |
| 72 | +// LLVM: call void @_ZNSbIcED1Ev(ptr {{.*}}) |
| 73 | +// LLVM: br label {{.*}} |
| 74 | +// LLVM: {{.*}}: |
| 75 | +// LLVM: invoke void @_ZNSbIcEC1EPKcRKNS_9AllocatorE(ptr {{.*}}, ptr {{.*}}, ptr {{.*}}) |
| 76 | +// LLVM: to label {{.*}} unwind label %[[B46:.*]] |
| 77 | +// LLVM: [[B46]] |
| 78 | +// LLVM: br label %[[B50:.*]] |
| 79 | +// LLVM: [[B50]] |
| 80 | +// LLVM: resume { ptr, i32 } {{.*}} |
| 81 | +// LLVM: {{.*}}: |
| 82 | +// LLVM: {{.*}} = invoke ptr @_ZNSbIcEaSERKS_(ptr {{.*}}, ptr {{.*}}) |
| 83 | +// LLVM: to label {{.*}} unwind label %[[B59:.*]] |
| 84 | +// LLVM: [[B59]] |
| 85 | +// LLVM: call void @_ZNSbIcED1Ev(ptr {{.*}}) |
| 86 | +// LLVM: call void @_ZNSbIcED1Ev(ptr {{.*}}) |
| 87 | +// LLVM: br label %[[B63:.*]] |
| 88 | +// LLVM: [[B63]] |
| 89 | +// LLVM: resume { ptr, i32 } {{.*}} |
0 commit comments