summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/exceptions-seh-finally.c
diff options
context:
space:
mode:
authorShoaib Meenai <smeenai@fb.com>2018-04-11 18:17:35 +0000
committerShoaib Meenai <smeenai@fb.com>2018-04-11 18:17:35 +0000
commit34aa13169b5aed623c227191bb36fa118d766ba1 (patch)
tree9bede0c60bdd05f74664f1abe32092638434099c /clang/test/CodeGen/exceptions-seh-finally.c
parentb24953bbfbc99b21d01ffaf673e11a44b4951b90 (diff)
downloadbcm5719-llvm-34aa13169b5aed623c227191bb36fa118d766ba1.tar.gz
bcm5719-llvm-34aa13169b5aed623c227191bb36fa118d766ba1.zip
[CodeGen] Handle __func__ inside __finally
When we enter a __finally block, the CGF's CurCodeDecl will be null (because CodeGenFunction::StartFunction is given an empty GlobalDecl for a __finally block), and so the dyn_cast here will result in an assertion failure. Change it to dyn_cast_or_null to handle this case. Differential Revision: https://reviews.llvm.org/D45523 llvm-svn: 329836
Diffstat (limited to 'clang/test/CodeGen/exceptions-seh-finally.c')
-rw-r--r--clang/test/CodeGen/exceptions-seh-finally.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/test/CodeGen/exceptions-seh-finally.c b/clang/test/CodeGen/exceptions-seh-finally.c
index 555e3ac25a8..d863eb1bb47 100644
--- a/clang/test/CodeGen/exceptions-seh-finally.c
+++ b/clang/test/CodeGen/exceptions-seh-finally.c
@@ -268,6 +268,18 @@ void finally_within_finally() {
// CHECK-LABEL: define internal void @"?fin$1@0@finally_within_finally@@"({{[^)]*}})
// CHECK-SAME: [[finally_attrs]]
+void cleanup_with_func(const char *);
+void finally_with_func() {
+ __try {
+ might_crash();
+ } __finally {
+ cleanup_with_func(__func__);
+ }
+}
+
+// CHECK-LABEL: define internal void @"?fin$0@0@finally_with_func@@"({{[^)]*}})
+// CHECK: call void @cleanup_with_func(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @"??_C@_0BC@COAGBPGM@finally_with_func?$AA@", i32 0, i32 0))
+
// Look for the absence of noinline. Enum attributes come first, so check that
// a string attribute is the first to verify that no enum attributes are
// present.
OpenPOWER on IntegriCloud