diff options
author | Reid Kleckner <reid@kleckner.net> | 2015-04-10 18:07:38 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2015-04-10 18:07:38 +0000 |
commit | 5522d815eb014b97bd734968848016eee4cffa37 (patch) | |
tree | 75c687dd02b2af7c9395080c476b5d8d77bb3ded /clang/test/CodeGenCXX/exceptions-seh.cpp | |
parent | 457bfc779a8d47ac70265923fde4b0072a9c4bcc (diff) | |
download | bcm5719-llvm-5522d815eb014b97bd734968848016eee4cffa37.tar.gz bcm5719-llvm-5522d815eb014b97bd734968848016eee4cffa37.zip |
[SEH] Add test for inline functions using SEH helpers
Such helpers should always be comdat with the parent function and have
internal linkage.
llvm-svn: 234618
Diffstat (limited to 'clang/test/CodeGenCXX/exceptions-seh.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/exceptions-seh.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/exceptions-seh.cpp b/clang/test/CodeGenCXX/exceptions-seh.cpp index 5f93cb1be3f..cb5f6dfad90 100644 --- a/clang/test/CodeGenCXX/exceptions-seh.cpp +++ b/clang/test/CodeGenCXX/exceptions-seh.cpp @@ -5,6 +5,7 @@ // RUN: -o - -mconstructor-aliases -O1 -disable-llvm-optzns | \ // RUN: FileCheck %s --check-prefix=CHECK --check-prefix=NOCXX +extern "C" unsigned long _exception_code(); extern "C" void might_throw(); struct HasCleanup { @@ -95,4 +96,47 @@ void use_seh_in_lambda() { // CHECK: invoke void @might_throw() #[[NOINLINE]] // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) +static int my_unique_global; + +extern "C" inline void use_seh_in_inline_func() { + __try { + might_throw(); + } __except(_exception_code() == 424242) { + } + __try { + might_throw(); + } __finally { + my_unique_global = 1234; + } +} + +void use_inline() { + use_seh_in_inline_func(); +} + +// CHECK-LABEL: define linkonce_odr void @use_seh_in_inline_func() #{{[0-9]+}} comdat { +// CHECK: invoke void @might_throw() +// +// CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) +// CHECK-NEXT: catch i8* bitcast (i32 (i8*, i8*)* @"\01?filt$0@0@use_seh_in_inline_func@@" to i8*) +// +// CHECK: invoke void @might_throw() +// +// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) +// CHECK: call void @"\01?fin$0@0@use_seh_in_inline_func@@"(i1 zeroext false, i8* %[[fp]]) +// CHECK: ret void +// +// CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) +// CHECK-NEXT: cleanup +// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) +// CHECK: call void @"\01?fin$0@0@use_seh_in_inline_func@@"(i1 zeroext true, i8* %[[fp]]) + +// CHECK-LABEL: define internal i32 @"\01?filt$0@0@use_seh_in_inline_func@@"(i8* %exception_pointers, i8* %frame_pointer) #{{[0-9]+}} comdat($use_seh_in_inline_func) +// CHECK: icmp eq i32 %{{.*}}, 424242 +// CHECK: zext i1 %{{.*}} to i32 +// CHECK: ret i32 + +// CHECK-LABEL: define internal void @"\01?fin$0@0@use_seh_in_inline_func@@"(i1 zeroext %abnormal_termination, i8* %frame_pointer) #{{[0-9]+}} comdat($use_seh_in_inline_func) +// CHECK: store i32 1234, i32* @my_unique_global + // CHECK: attributes #[[NOINLINE]] = { {{.*noinline.*}} } |