diff options
Diffstat (limited to 'clang/test/CIR/CodeGen/try-catch.cpp')
-rw-r--r-- | clang/test/CIR/CodeGen/try-catch.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/clang/test/CIR/CodeGen/try-catch.cpp b/clang/test/CIR/CodeGen/try-catch.cpp new file mode 100644 index 0000000..8f0b3c4 --- /dev/null +++ b/clang/test/CIR/CodeGen/try-catch.cpp @@ -0,0 +1,32 @@ +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fcxx-exceptions -fexceptions -fclangir -emit-cir %s -o %t.cir +// RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fcxx-exceptions -fexceptions -fclangir -emit-llvm %s -o %t-cir.ll +// RUN: FileCheck --input-file=%t-cir.ll %s -check-prefix=LLVM +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fcxx-exceptions -fexceptions -emit-llvm %s -o %t.ll +// RUN: FileCheck --input-file=%t.ll %s -check-prefix=OGCG + +void empty_try_block_with_catch_all() { + try {} catch (...) {} +} + +// CIR: cir.func{{.*}} @_Z30empty_try_block_with_catch_allv() +// CIR: cir.return + +// LLVM: define{{.*}} void @_Z30empty_try_block_with_catch_allv() +// LLVM: ret void + +// OGCG: define{{.*}} void @_Z30empty_try_block_with_catch_allv() +// OGCG: ret void + +void empty_try_block_with_catch_with_int_exception() { + try {} catch (int e) {} +} + +// CIR: cir.func{{.*}} @_Z45empty_try_block_with_catch_with_int_exceptionv() +// CIR: cir.return + +// LLVM: define{{.*}} void @_Z45empty_try_block_with_catch_with_int_exceptionv() +// LLVM: ret void + +// OGCG: define{{.*}} void @_Z45empty_try_block_with_catch_with_int_exceptionv() +// OGCG: ret void |