[cfe-commits] r117540 - in /cfe/trunk: include/clang/Serialization/ASTReader.h include/clang/Serialization/ASTWriter.h lib/Serialization/ASTReader.cpp lib/Serialization/ASTWriterDecl.cpp lib/Serialization/ASTWriterStmt.cpp
Argyrios Kyrtzidis
akyrtzi at gmail.com
Thu Oct 28 02:29:32 PDT 2010
Author: akirtzidis
Date: Thu Oct 28 04:29:32 2010
New Revision: 117540
URL: http://llvm.org/viewvc/llvm-project?rev=117540&view=rev
Log:
Switch case IDs conflict between chained PCHs; since there is no need to be global, make them local to a decl.
Modified:
cfe/trunk/include/clang/Serialization/ASTReader.h
cfe/trunk/include/clang/Serialization/ASTWriter.h
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
Modified: cfe/trunk/include/clang/Serialization/ASTReader.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTReader.h?rev=117540&r1=117539&r2=117540&view=diff
==============================================================================
--- cfe/trunk/include/clang/Serialization/ASTReader.h (original)
+++ cfe/trunk/include/clang/Serialization/ASTReader.h Thu Oct 28 04:29:32 2010
@@ -1162,6 +1162,8 @@
/// deserialized and has the given ID.
void RecordLabelStmt(LabelStmt *S, unsigned ID);
+ void ClearSwitchCaseIDs();
+
/// \brief Set the label of the given statement to the label
/// identified by ID.
///
Modified: cfe/trunk/include/clang/Serialization/ASTWriter.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTWriter.h?rev=117540&r1=117539&r2=117540&view=diff
==============================================================================
--- cfe/trunk/include/clang/Serialization/ASTWriter.h (original)
+++ cfe/trunk/include/clang/Serialization/ASTWriter.h Thu Oct 28 04:29:32 2010
@@ -484,6 +484,8 @@
/// \brief Retrieve the ID for the given switch-case statement.
unsigned getSwitchCaseID(SwitchCase *S);
+ void ClearSwitchCaseIDs();
+
/// \brief Retrieve the ID for the given label statement, which may
/// or may not have been emitted yet.
unsigned GetLabelID(LabelStmt *S);
Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=117540&r1=117539&r2=117540&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Thu Oct 28 04:29:32 2010
@@ -3284,6 +3284,9 @@
/// 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 @@
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) {
Modified: cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriterDecl.cpp?rev=117540&r1=117539&r2=117540&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTWriterDecl.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriterDecl.cpp Thu Oct 28 04:29:32 2010
@@ -1128,6 +1128,9 @@
}
void ASTWriter::WriteDecl(ASTContext &Context, Decl *D) {
+ // Switch case IDs are per Decl.
+ ClearSwitchCaseIDs();
+
RecordData Record;
ASTDeclWriter W(*this, Context, Record);
Modified: cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriterStmt.cpp?rev=117540&r1=117539&r2=117540&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTWriterStmt.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriterStmt.cpp Thu Oct 28 04:29:32 2010
@@ -1311,6 +1311,10 @@
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) {
More information about the cfe-commits
mailing list