Eliminate obvious use-after-free. Fixes PR12433 / <rdar://problem/11168333>.

llvm-svn: 153982
This commit is contained in:
Douglas Gregor 2012-04-04 00:34:49 +00:00
parent 7e5b4c9328
commit 6a37784a35
3 changed files with 12 additions and 1 deletions

View File

@ -3898,9 +3898,9 @@ QualType ASTReader::readTypeRecord(unsigned Index) {
ExceptionSpecificationType EST =
static_cast<ExceptionSpecificationType>(Record[Idx++]);
EPI.ExceptionSpecType = EST;
SmallVector<QualType, 2> Exceptions;
if (EST == EST_Dynamic) {
EPI.NumExceptions = Record[Idx++];
SmallVector<QualType, 2> Exceptions;
for (unsigned I = 0; I != EPI.NumExceptions; ++I)
Exceptions.push_back(readType(*Loc.F, Record, Idx));
EPI.Exceptions = Exceptions.data();

View File

@ -0,0 +1,10 @@
// Test this without pch.
// RUN: %clang_cc1 -include %S/cxx-functions.h -fsyntax-only -verify %s
// RUN: %clang_cc1 -x c++-header -emit-pch -o %t %S/cxx-functions.h
// RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s
void test_foo() {
foo();
}

View File

@ -0,0 +1 @@
void foo() throw( int, short, char, float, double );