Fix stack-use-after-scope in EvaluateImplicitExceptionSpec
authorVitaly Buka <vitalybuka@google.com>
Mon, 5 Dec 2016 18:30:22 +0000 (18:30 +0000)
committerVitaly Buka <vitalybuka@google.com>
Mon, 5 Dec 2016 18:30:22 +0000 (18:30 +0000)
Summary:
getExceptionSpec returns structure with pointers to temporarily object created
by computeImplicitExceptionSpec.

Reviewers: rsmith

Subscribers: aizatsky, cfe-commits

Differential Revision: https://reviews.llvm.org/D27420

llvm-svn: 288685

clang/lib/Sema/SemaDeclCXX.cpp

index c147341..f5a2c0d 100644 (file)
@@ -6100,7 +6100,8 @@ void Sema::EvaluateImplicitExceptionSpec(SourceLocation Loc, CXXMethodDecl *MD)
     return;
 
   // Evaluate the exception specification.
-  auto ESI = computeImplicitExceptionSpec(*this, Loc, MD).getExceptionSpec();
+  auto IES = computeImplicitExceptionSpec(*this, Loc, MD);
+  auto ESI = IES.getExceptionSpec();
 
   // Update the type of the special member to use it.
   UpdateExceptionSpec(MD, ESI);