Home | History | Annotate | Download | only in CodeGenCXX
      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
      3 
      4 // THROW-DAG: @"\01??_R0H@8" = linkonce_odr global %rtti.TypeDescriptor2 { i8** @"\01??_7type_info@@6B@", i8* null, [3 x i8] c".H\00" }, comdat
      5 // THROW-DAG: @"_CT??_R0H@84" = linkonce_odr unnamed_addr constant %eh.CatchableType { i32 1, i8* bitcast (%rtti.TypeDescriptor2* @"\01??_R0H@8" to i8*), i32 0, i32 -1, i32 0, i32 4, i8* null }, section ".xdata", comdat
      6 // THROW-DAG: @_CTA1H = linkonce_odr unnamed_addr constant %eh.CatchableTypeArray.1 { i32 1, [1 x %eh.CatchableType*] [%eh.CatchableType* @"_CT??_R0H@84"] }, section ".xdata", comdat
      7 // THROW-DAG: @_TI1H = linkonce_odr unnamed_addr constant %eh.ThrowInfo { i32 0, i8* null, i8* null, i8* bitcast (%eh.CatchableTypeArray.1* @_CTA1H to i8*) }, section ".xdata", comdat
      8 
      9 void external();
     10 
     11 inline void not_emitted() {
     12   throw int(13); // no error
     13 }
     14 
     15 int main() {
     16   int rv = 0;
     17 #ifdef TRY
     18   try {
     19     external(); // TRY: invoke void @"\01?external@@YAXXZ"
     20   } catch (int) {
     21     rv = 1;
     22     // TRY: catchpad within {{.*}} [%rtti.TypeDescriptor2* @"\01??_R0H@8", i32 0, i8* null]
     23     // TRY: catchret
     24   }
     25 #endif
     26 #ifdef THROW
     27   // THROW: store i32 42, i32* %[[mem_for_throw:.*]], align 4
     28   // THROW: %[[cast:.*]] = bitcast i32* %[[mem_for_throw]] to i8*
     29   // THROW: call void @_CxxThrowException(i8* %[[cast]], %eh.ThrowInfo* @_TI1H)
     30   throw int(42);
     31 #endif
     32   return rv;
     33 }
     34 
     35 #ifdef TRY
     36 // TRY-LABEL: define void @"\01?qual_catch@@YAXXZ"
     37 void qual_catch() {
     38   try {
     39     external();
     40   } catch (const int *) {
     41   }
     42   // TRY: catchpad within {{.*}} [%rtti.TypeDescriptor4* @"\01??_R0PAH@8", i32 1, i8* null]
     43   // TRY: catchret
     44 }
     45 #endif
     46