From 145abde152ec206aa6857cfed2b6dd785c395cc8 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Tue, 26 Jan 2016 01:12:17 +0000 Subject: [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. llvm-svn: 258762 --- clang/lib/Sema/SemaDecl.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'clang/lib/Sema/SemaDecl.cpp') diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 6adbc3fab6f..e3365b559a7 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -1748,6 +1748,9 @@ NamedDecl *Sema::LazilyCreateBuiltin(IdentifierInfo *II, unsigned ID, << Context.BuiltinInfo.getName(ID); } + if (R.isNull()) + return nullptr; + DeclContext *Parent = Context.getTranslationUnitDecl(); if (getLangOpts().CPlusPlus) { LinkageSpecDecl *CLinkageDecl = -- cgit v1.2.3