summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/ASTReader.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-10-24 17:26:36 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-10-24 17:26:36 +0000
commit65ad5691fd48b2ad6982adb5f416ccc2a41fc8da (patch)
tree44234e8b6b6b87c006d9f23587074aad6c05905e /clang/lib/Serialization/ASTReader.cpp
parentad5f95cc4bcaf97debcd1cfd85d1110bfe3af4d3 (diff)
downloadbcm5719-llvm-65ad5691fd48b2ad6982adb5f416ccc2a41fc8da.tar.gz
bcm5719-llvm-65ad5691fd48b2ad6982adb5f416ccc2a41fc8da.zip
Put the mechanism in place to track modifications in an AST entity that were committed after
its initial creation/deserialization and store the changes in a chained PCH. The idea is that the AST entities call methods on the ASTMutationListener to give notifications of changes; the PCHWriter implements the ASTMutationListener interface and stores the incremental changes of the updated entity. WIP llvm-svn: 117235
Diffstat (limited to 'clang/lib/Serialization/ASTReader.cpp')
-rw-r--r--clang/lib/Serialization/ASTReader.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index 162fa26e2df..38e786bff10 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -454,8 +454,6 @@ void PCHValidator::ReadCounter(unsigned Value) {
void
ASTReader::setDeserializationListener(ASTDeserializationListener *Listener) {
DeserializationListener = Listener;
- if (DeserializationListener)
- DeserializationListener->SetReader(this);
}
@@ -1716,6 +1714,13 @@ ASTReader::ReadASTBlock(PerFileData &F) {
}
break;
+ case DECL_UPDATES_BLOCK_ID:
+ if (Stream.SkipBlock()) {
+ Error("malformed block record in AST file");
+ return Failure;
+ }
+ break;
+
case PREPROCESSOR_BLOCK_ID:
F.MacroCursor = Stream;
if (PP)
@@ -2043,6 +2048,17 @@ ASTReader::ReadASTBlock(PerFileData &F) {
F.LocalNumMacroDefinitions = Record[1];
break;
+ case DECL_UPDATE_OFFSETS: {
+ if (Record.size() % 2 != 0) {
+ Error("invalid DECL_UPDATE_OFFSETS block in AST file");
+ return Failure;
+ }
+ for (unsigned I = 0, N = Record.size(); I != N; I += 2)
+ DeclUpdateOffsets[static_cast<DeclID>(Record[I])]
+ .push_back(std::make_pair(&F, Record[I+1]));
+ break;
+ }
+
case DECL_REPLACEMENTS: {
if (Record.size() % 2 != 0) {
Error("invalid DECL_REPLACEMENTS block in AST file");
@@ -2164,6 +2180,9 @@ ASTReader::ASTReadResult ASTReader::ReadAST(const std::string &FileName,
if (Context)
InitializeContext(*Context);
+ if (DeserializationListener)
+ DeserializationListener->ReaderInitialized(this);
+
return Success;
}
OpenPOWER on IntegriCloud