diff options
| author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-05-04 01:49:36 +0000 |
|---|---|---|
| committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-05-04 01:49:36 +0000 |
| commit | 0f7d7ab968d32605acd47c3413f028aa5ae543a9 (patch) | |
| tree | 219dac1caeedeecee09579e6f125c67eef5cc898 /clang/lib | |
| parent | 57c70506759429ddcbe9d3b8f3eab0f804829987 (diff) | |
| download | bcm5719-llvm-0f7d7ab968d32605acd47c3413f028aa5ae543a9.tar.gz bcm5719-llvm-0f7d7ab968d32605acd47c3413f028aa5ae543a9.zip | |
[PCH] Really, pinky swear, fix for PR12689
rdar://11353109
llvm-svn: 156145
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 14 | ||||
| -rw-r--r-- | clang/lib/Serialization/ASTReaderDecl.cpp | 7 |
2 files changed, 13 insertions, 8 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index f1ea091627f..736d93470fb 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -6248,18 +6248,19 @@ IdentifierTable &ASTReader::getIdentifierTable() { /// \brief Record that the given ID maps to the given switch-case /// statement. void ASTReader::RecordSwitchCaseID(SwitchCase *SC, unsigned ID) { - assert(SwitchCaseStmts[ID] == 0 && "Already have a SwitchCase with this ID"); - SwitchCaseStmts[ID] = SC; + assert((*CurrSwitchCaseStmts)[ID] == 0 && + "Already have a SwitchCase with this ID"); + (*CurrSwitchCaseStmts)[ID] = SC; } /// \brief Retrieve the switch-case statement with the given ID. SwitchCase *ASTReader::getSwitchCaseWithID(unsigned ID) { - assert(SwitchCaseStmts[ID] != 0 && "No SwitchCase with this ID"); - return SwitchCaseStmts[ID]; + assert((*CurrSwitchCaseStmts)[ID] != 0 && "No SwitchCase with this ID"); + return (*CurrSwitchCaseStmts)[ID]; } void ASTReader::ClearSwitchCaseIDs() { - SwitchCaseStmts.clear(); + CurrSwitchCaseStmts->clear(); } void ASTReader::finishPendingActions() { @@ -6374,7 +6375,8 @@ ASTReader::ASTReader(Preprocessor &PP, ASTContext &Context, DisableValidation(DisableValidation), DisableStatCache(DisableStatCache), AllowASTWithCompilerErrors(AllowASTWithCompilerErrors), - CurrentGeneration(0), NumStatHits(0), NumStatMisses(0), + CurrentGeneration(0), CurrSwitchCaseStmts(&SwitchCaseStmts), + NumStatHits(0), NumStatMisses(0), NumSLocEntriesRead(0), TotalNumSLocEntries(0), NumStatementsRead(0), TotalNumStatements(0), NumMacrosRead(0), TotalNumMacros(0), NumSelectorsRead(0), NumMethodPoolEntriesRead(0), diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp index 15aa90b3516..dc315f095c0 100644 --- a/clang/lib/Serialization/ASTReaderDecl.cpp +++ b/clang/lib/Serialization/ASTReaderDecl.cpp @@ -25,6 +25,7 @@ #include "clang/AST/DeclCXX.h" #include "clang/AST/DeclTemplate.h" #include "clang/AST/Expr.h" +#include "llvm/Support/SaveAndRestore.h" using namespace clang; using namespace clang::serialization; @@ -629,8 +630,10 @@ void ASTDeclReader::VisitObjCMethodDecl(ObjCMethodDecl *MD) { if (Record[Idx++]) { // In practice, this won't be executed (since method definitions // don't occur in header files). - // Switch case IDs are per method body. - Reader.ClearSwitchCaseIDs(); + // Switch case IDs for this method body. + std::map<unsigned, SwitchCase *> SwitchCaseStmtsForObjCMethod; + SaveAndRestore<std::map<unsigned, SwitchCase *> *> + SCFOM(Reader.CurrSwitchCaseStmts, &SwitchCaseStmtsForObjCMethod); MD->setBody(Reader.ReadStmt(F)); MD->setSelfDecl(ReadDeclAs<ImplicitParamDecl>(Record, Idx)); MD->setCmdDecl(ReadDeclAs<ImplicitParamDecl>(Record, Idx)); |

