diff options
author | David Majnemer <david.majnemer@gmail.com> | 2016-01-26 01:12:17 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2016-01-26 01:12:17 +0000 |
commit | 3398078a417447cf6ab55a999b88871b8dae9ec0 (patch) | |
tree | 4bf2c9d187741c5f932ff76baf48fa0c9e4fe563 /test | |
parent | 32fea4edd4ffff0d1b829b85534f3712f48d343f (diff) | |
download | clang-3398078a417447cf6ab55a999b88871b8dae9ec0.tar.gz |
[MS Compat] Don't crash if __GetExceptionInfo is in global scope
__GetExceptionInfo triggered Sema::LazilyCreateBuiltin which tries to
create a non-templated function decl. This is unnecessary and
ill-advised, there is no need for us to create a declaration for such a
builtin.
This fixes PR26298.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258762 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/CodeGenCXX/microsoft-abi-throw.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/test/CodeGenCXX/microsoft-abi-throw.cpp b/test/CodeGenCXX/microsoft-abi-throw.cpp index 080f1a025c..f013c8aeb1 100644 --- a/test/CodeGenCXX/microsoft-abi-throw.cpp +++ b/test/CodeGenCXX/microsoft-abi-throw.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -emit-llvm -o - -triple=i386-pc-win32 -std=c++11 %s -fcxx-exceptions -fms-extensions | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -o - -triple=i386-pc-win32 -std=c++11 %s -fcxx-exceptions -fms-extensions -DSTD | FileCheck %s // CHECK-DAG: @"\01??_R0?AUY@@@8" = linkonce_odr global %rtti.TypeDescriptor7 { i8** @"\01??_7type_info@@6B@", i8* null, [8 x i8] c".?AUY@@\00" }, comdat // CHECK-DAG: @"_CT??_R0?AUY@@@8??0Y@@QAE@ABU0@@Z8" = linkonce_odr unnamed_addr constant %eh.CatchableType { i32 4, i8* bitcast (%rtti.TypeDescriptor7* @"\01??_R0?AUY@@@8" to i8*), i32 0, i32 -1, i32 0, i32 8, i8* bitcast (%struct.Y* (%struct.Y*, %struct.Y*, i32)* @"\01??0Y@@QAE@ABU0@@Z" to i8*) }, section ".xdata", comdat @@ -97,19 +98,25 @@ void h() { throw nullptr; } +#ifdef STD namespace std { template <typename T> void *__GetExceptionInfo(T); } +#else +template <typename T> +void *__GetExceptionInfo(T); +#endif +using namespace std; void *GetExceptionInfo_test0() { // CHECK-LABEL: @"\01?GetExceptionInfo_test0@@YAPAXXZ" // CHECK: ret i8* bitcast (%eh.ThrowInfo* @_TI1H to i8*) - return std::__GetExceptionInfo(0); + return __GetExceptionInfo(0); } void *GetExceptionInfo_test1() { // CHECK-LABEL: @"\01?GetExceptionInfo_test1@@YAPAXXZ" // CHECK: ret i8* bitcast (%eh.ThrowInfo* @_TI1P6AXXZ to i8*) - return std::__GetExceptionInfo<void (*)()>(&h); + return __GetExceptionInfo<void (*)()>(&h); } |