[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / CodeGenCXX / microsoft-abi-try-throw.cpp
blob9364a425b135626b3910cf854fe4f16807de1c43
1 // RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-pc-win32 -mconstructor-aliases -fcxx-exceptions -fexceptions -fno-rtti -DTRY | FileCheck %s -check-prefix=TRY
2 // RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-pc-win32 -mconstructor-aliases -fcxx-exceptions -fexceptions -fno-rtti -DTHROW | FileCheck %s -check-prefix=THROW
4 // THROW-DAG: @"??_R0H@8" = linkonce_odr global %rtti.TypeDescriptor2 { ptr @"??_7type_info@@6B@", ptr null, [3 x i8] c".H\00" }, comdat
5 // THROW-DAG: @"_CT??_R0H@84" = linkonce_odr unnamed_addr constant %eh.CatchableType { i32 1, ptr @"??_R0H@8", i32 0, i32 -1, i32 0, i32 4, ptr null }, section ".xdata", comdat
6 // THROW-DAG: @_CTA1H = linkonce_odr unnamed_addr constant %eh.CatchableTypeArray.1 { i32 1, [1 x ptr] [ptr @"_CT??_R0H@84"] }, section ".xdata", comdat
7 // THROW-DAG: @_TI1H = linkonce_odr unnamed_addr constant %eh.ThrowInfo { i32 0, ptr null, ptr null, ptr @_CTA1H }, section ".xdata", comdat
9 void external();
11 inline void not_emitted() {
12 throw int(13); // no error
15 int main() {
16 int rv = 0;
17 #ifdef TRY
18 try {
19 external(); // TRY: invoke void @"?external@@YAXXZ"
20 } catch (int) {
21 rv = 1;
22 // TRY: catchpad within {{.*}} [ptr @"??_R0H@8", i32 0, ptr null]
23 // TRY: catchret
25 #endif
26 #ifdef THROW
27 // THROW: store i32 42, ptr %[[mem_for_throw:.*]], align 4
28 // THROW: call void @_CxxThrowException(ptr %[[mem_for_throw]], ptr @_TI1H)
29 throw int(42);
30 #endif
31 return rv;
34 #ifdef TRY
35 // TRY-LABEL: define dso_local void @"?qual_catch@@YAXXZ"
36 void qual_catch() {
37 try {
38 external();
39 } catch (const int *) {
41 // TRY: catchpad within {{.*}} [ptr @"??_R0PAH@8", i32 1, ptr null]
42 // TRY: catchret
44 #endif