From 674ce2410c40b833bb0afdb19a3c217ff6b01b3e Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Wed, 26 Oct 2016 12:51:45 +0000 Subject: [PATCH] Fix use-after-scope in ASTContext. Extend lifetime of ExceptionTypeStorage, as it is referenced by CanonicalEPI and used outside the block (ExceptionSpec.Exceptions is an ArrayRef) Patch by Sam McCall! Differential Revision: https://reviews.llvm.org/D25983 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@285192 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AST/ASTContext.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 9faded7dc9..d2c35851ee 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -3230,13 +3230,13 @@ QualType ASTContext::getFunctionTypeInternal( for (unsigned i = 0; i != NumArgs; ++i) CanonicalArgs.push_back(getCanonicalParamType(ArgArray[i])); + llvm::SmallVector ExceptionTypeStorage; FunctionProtoType::ExtProtoInfo CanonicalEPI = EPI; CanonicalEPI.HasTrailingReturn = false; if (IsCanonicalExceptionSpec) { // Exception spec is already OK. } else if (NoexceptInType) { - llvm::SmallVector ExceptionTypeStorage; switch (EPI.ExceptionSpec.Type) { case EST_Unparsed: case EST_Unevaluated: case EST_Uninstantiated: // We don't know yet. It shouldn't matter what we pick here; no-one -- 2.40.0