diff options
author | Reid Kleckner <rnk@google.com> | 2018-06-20 21:12:20 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2018-06-20 21:12:20 +0000 |
commit | c8ae87839926f7e15db5c144752e1b4c80b739a3 (patch) | |
tree | 907691a7c11227bbac0f6ac8cd9f40558f626f36 | |
parent | 201d02c75c8ad92a295309833569bf49f4cf8511 (diff) | |
download | bcm5719-llvm-c8ae87839926f7e15db5c144752e1b4c80b739a3.tar.gz bcm5719-llvm-c8ae87839926f7e15db5c144752e1b4c80b739a3.zip |
[MS] Make sure __GetExceptionInfo works on types with no linkage
Fixes PR36327
llvm-svn: 335175
-rw-r--r-- | clang/lib/Sema/Sema.cpp | 2 | ||||
-rw-r--r-- | clang/test/CodeGenCXX/microsoft-abi-throw.cpp | 10 |
2 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp index aa4f6461b65..7a8cd1ca4e6 100644 --- a/clang/lib/Sema/Sema.cpp +++ b/clang/lib/Sema/Sema.cpp @@ -645,6 +645,8 @@ void Sema::getUndefinedButUsed( !isExternalWithNoLinkageType(FD) && !FD->getMostRecentDecl()->isInlined()) continue; + if (FD->getBuiltinID()) + continue; } else { auto *VD = cast<VarDecl>(ND); if (VD->hasDefinition() != VarDecl::DeclarationOnly) diff --git a/clang/test/CodeGenCXX/microsoft-abi-throw.cpp b/clang/test/CodeGenCXX/microsoft-abi-throw.cpp index 8800e97a03f..cbbce2daaad 100644 --- a/clang/test/CodeGenCXX/microsoft-abi-throw.cpp +++ b/clang/test/CodeGenCXX/microsoft-abi-throw.cpp @@ -22,6 +22,7 @@ // CHECK-DAG: @_TI1P6AXXZ = linkonce_odr unnamed_addr constant %eh.ThrowInfo { i32 0, i8* null, i8* null, i8* bitcast (%eh.CatchableTypeArray.1* @_CTA1P6AXXZ to i8*) }, section ".xdata", comdat // CHECK-DAG: @_TIU2PAPFAH = linkonce_odr unnamed_addr constant %eh.ThrowInfo { i32 4, i8* null, i8* null, i8* bitcast (%eh.CatchableTypeArray.2* @_CTA2PAPFAH to i8*) }, section ".xdata", comdat // CHECK-DAG: @_CTA2PAPFAH = linkonce_odr unnamed_addr constant %eh.CatchableTypeArray.2 { i32 2, [2 x %eh.CatchableType*] [%eh.CatchableType* @"_CT??_R0PAPFAH@84", %eh.CatchableType* @"_CT??_R0PAX@84"] }, section ".xdata", comdat +// CHECK-DAG: @"_TI1?AUFoo@?A@@" = internal unnamed_addr constant %eh.ThrowInfo { i32 0, i8* null, i8* null, i8* bitcast (%eh.CatchableTypeArray.1* @"_CTA1?AUFoo@?A@@" to i8*) }, section ".xdata" struct N { ~N(); }; @@ -128,3 +129,12 @@ void *GetExceptionInfo_test1() { // CHECK: ret i8* bitcast (%eh.ThrowInfo* @_TI1P6AXXZ to i8*) return __GetExceptionInfo<void (*)()>(&h); } + +// PR36327: Try an exception type with no linkage. +namespace { struct Foo { } foo_exc; } + +void *GetExceptionInfo_test2() { +// CHECK-LABEL: @"?GetExceptionInfo_test2@@YAPAXXZ" +// CHECK: ret i8* bitcast (%eh.ThrowInfo* @"_TI1?AUFoo@?A@@" to i8*) + return __GetExceptionInfo(foo_exc); +} |