|
| 1 | +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -Wno-unused-value -fclangir -emit-cir %s -o %t.cir |
| 2 | +// RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR |
| 3 | +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -Wno-unused-value -fclangir -emit-llvm %s -o %t-cir.ll |
| 4 | +// RUN: FileCheck --input-file=%t-cir.ll %s -check-prefix=LLVM |
| 5 | +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -Wno-unused-value -emit-llvm %s -o %t.ll |
| 6 | +// RUN: FileCheck --input-file=%t.ll %s -check-prefix=OGCG |
| 7 | + |
| 8 | +void function_may_throw(); |
| 9 | + |
| 10 | +void function_no_except() noexcept; |
| 11 | + |
| 12 | +void no_except() { |
| 13 | + bool a = noexcept(1); |
| 14 | + bool b = noexcept(function_may_throw()); |
| 15 | + bool c = noexcept(function_no_except()); |
| 16 | +} |
| 17 | + |
| 18 | +// CIR: %[[A_ADDR:.*]] = cir.alloca !cir.bool, !cir.ptr<!cir.bool>, ["a", init] |
| 19 | +// CIR: %[[B_ADDR:.*]] = cir.alloca !cir.bool, !cir.ptr<!cir.bool>, ["b", init] |
| 20 | +// CIR: %[[C_ADDR:.*]] = cir.alloca !cir.bool, !cir.ptr<!cir.bool>, ["c", init] |
| 21 | +// CIR: %[[CONST_TRUE:.*]] = cir.const #true |
| 22 | +// CIR: cir.store {{.*}} %[[CONST_TRUE]], %[[A_ADDR]] : !cir.bool, !cir.ptr<!cir.bool> |
| 23 | +// CIR: %[[CONST_FALSE:.*]] = cir.const #false |
| 24 | +// CIR: cir.store {{.*}} %[[CONST_FALSE]], %[[B_ADDR]] : !cir.bool, !cir.ptr<!cir.bool> |
| 25 | +// CIR: %[[CONST_TRUE:.*]] = cir.const #true |
| 26 | +// CIR: cir.store {{.*}} %[[CONST_TRUE]], %[[C_ADDR]] : !cir.bool, !cir.ptr<!cir.bool> |
| 27 | + |
| 28 | +// LLVM: %[[A_ADDR:.*]] = alloca i8, i64 1, align 1 |
| 29 | +// LLVM: %[[B_ADDR:.*]] = alloca i8, i64 1, align 1 |
| 30 | +// LLVM: %[[C_ADDR:.*]] = alloca i8, i64 1, align 1 |
| 31 | +// LLVM: store i8 1, ptr %[[A_ADDR]], align 1 |
| 32 | +// LLVM: store i8 0, ptr %[[B_ADDR]], align 1 |
| 33 | +// LLVM: store i8 1, ptr %[[C_ADDR]], align 1 |
| 34 | + |
| 35 | +// OGCG: %[[A_ADDR:.*]] = alloca i8, align 1 |
| 36 | +// OGCG: %[[B_ADDR:.*]] = alloca i8, align 1 |
| 37 | +// OGCG: %[[C_ADDR:.*]] = alloca i8, align 1 |
| 38 | +// OGCG: store i8 1, ptr %[[A_ADDR]], align 1 |
| 39 | +// OGCG: store i8 0, ptr %[[B_ADDR]], align 1 |
| 40 | +// OGCG: store i8 1, ptr %[[C_ADDR]], align 1 |
0 commit comments