/// 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.
///
/// \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);
/// 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];
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) {
}
void ASTWriter::WriteDecl(ASTContext &Context, Decl *D) {
+ // Switch case IDs are per Decl.
+ ClearSwitchCaseIDs();
+
RecordData Record;
ASTDeclWriter W(*this, Context, Record);
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) {