diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-10-28 09:29:32 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-10-28 09:29:32 +0000 |
commit | d9f526fc2e879c04d91e63f30bdd0c7eed9535d6 (patch) | |
tree | 8c37a8607bf64fa88e9fd33b4118fe0b510eb60c /clang/lib/Serialization | |
parent | 9de9160d553240d16b1825827d833021ada66598 (diff) | |
download | bcm5719-llvm-d9f526fc2e879c04d91e63f30bdd0c7eed9535d6.tar.gz bcm5719-llvm-d9f526fc2e879c04d91e63f30bdd0c7eed9535d6.zip |
Switch case IDs conflict between chained PCHs; since there is no need to be global, make them local to a decl.
llvm-svn: 117540
Diffstat (limited to 'clang/lib/Serialization')
-rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 7 | ||||
-rw-r--r-- | clang/lib/Serialization/ASTWriterDecl.cpp | 3 | ||||
-rw-r--r-- | clang/lib/Serialization/ASTWriterStmt.cpp | 4 |
3 files changed, 14 insertions, 0 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index f09873a0707..6497b787725 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -3284,6 +3284,9 @@ Decl *ASTReader::GetDecl(DeclID ID) { /// source each time it is called, and is meant to be used via a /// LazyOffsetPtr (which is used by Decls for the body of functions, etc). Stmt *ASTReader::GetExternalDeclStmt(uint64_t Offset) { + // Switch case IDs are per Decl. + ClearSwitchCaseIDs(); + // Offset here is a global offset across the entire chain. for (unsigned I = 0, N = Chain.size(); I != N; ++I) { PerFileData &F = *Chain[N - I - 1]; @@ -4252,6 +4255,10 @@ SwitchCase *ASTReader::getSwitchCaseWithID(unsigned ID) { return SwitchCaseStmts[ID]; } +void ASTReader::ClearSwitchCaseIDs() { + SwitchCaseStmts.clear(); +} + /// \brief Record that the given label statement has been /// deserialized and has the given ID. void ASTReader::RecordLabelStmt(LabelStmt *S, unsigned ID) { diff --git a/clang/lib/Serialization/ASTWriterDecl.cpp b/clang/lib/Serialization/ASTWriterDecl.cpp index 3c6dd9bbc20..37c7765dc89 100644 --- a/clang/lib/Serialization/ASTWriterDecl.cpp +++ b/clang/lib/Serialization/ASTWriterDecl.cpp @@ -1128,6 +1128,9 @@ static bool isRequiredDecl(const Decl *D, ASTContext &Context) { } void ASTWriter::WriteDecl(ASTContext &Context, Decl *D) { + // Switch case IDs are per Decl. + ClearSwitchCaseIDs(); + RecordData Record; ASTDeclWriter W(*this, Context, Record); diff --git a/clang/lib/Serialization/ASTWriterStmt.cpp b/clang/lib/Serialization/ASTWriterStmt.cpp index 33b70e98c06..fc8e9e0e595 100644 --- a/clang/lib/Serialization/ASTWriterStmt.cpp +++ b/clang/lib/Serialization/ASTWriterStmt.cpp @@ -1311,6 +1311,10 @@ unsigned ASTWriter::getSwitchCaseID(SwitchCase *S) { return SwitchCaseIDs[S]; } +void ASTWriter::ClearSwitchCaseIDs() { + SwitchCaseIDs.clear(); +} + /// \brief Retrieve the ID for the given label statement, which may /// or may not have been emitted yet. unsigned ASTWriter::GetLabelID(LabelStmt *S) { |