diff options
author | Vassil Vassilev <v.g.vassilev@gmail.com> | 2016-07-22 21:08:24 +0000 |
---|---|---|
committer | Vassil Vassilev <v.g.vassilev@gmail.com> | 2016-07-22 21:08:24 +0000 |
commit | 19765fb68c67df88ad03bfa6e56b1f1f39ee6ffc (patch) | |
tree | 573203ffb0e3ba2d332498ef3ad6791b14138de3 /clang/lib/Serialization/ASTReaderDecl.cpp | |
parent | b73d7aed71c3f750f2ca64b93eed83eac10e1458 (diff) | |
download | bcm5719-llvm-19765fb68c67df88ad03bfa6e56b1f1f39ee6ffc.tar.gz bcm5719-llvm-19765fb68c67df88ad03bfa6e56b1f1f39ee6ffc.zip |
[modules] Teach the ASTWriter to ignore mutations coming from the ASTReader.
Processing update records (and loading a module, in general) might trigger
unexpected calls to the ASTWriter (being a mutation listener). Now we have a
mechanism to suppress those calls to the ASTWriter but notify other possible
mutation listeners.
Fixes https://llvm.org/bugs/show_bug.cgi?id=28332
Patch by Cristina Cristescu and me.
Reviewed by Richard Smith (D21800).
llvm-svn: 276473
Diffstat (limited to 'clang/lib/Serialization/ASTReaderDecl.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTReaderDecl.cpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp index 184e7efe84f..b5384bbc39e 100644 --- a/clang/lib/Serialization/ASTReaderDecl.cpp +++ b/clang/lib/Serialization/ASTReaderDecl.cpp @@ -3489,6 +3489,7 @@ void ASTReader::loadDeclUpdateRecords(serialization::DeclID ID, Decl *D) { // The declaration may have been modified by files later in the chain. // If this is the case, read the record containing the updates from each file // and pass it to ASTDeclReader to make the modifications. + ProcessingUpdatesRAIIObj ProcessingUpdates(*this); DeclUpdateOffsetsMap::iterator UpdI = DeclUpdateOffsets.find(ID); if (UpdI != DeclUpdateOffsets.end()) { auto UpdateOffsets = std::move(UpdI->second); @@ -3907,11 +3908,8 @@ void ASTDeclReader::UpdateDecl(Decl *D, ModuleFile &ModuleFile, } case UPD_DECL_MARKED_USED: { - // FIXME: This doesn't send the right notifications if there are - // ASTMutationListeners other than an ASTWriter. - // Maintain AST consistency: any later redeclarations are used too. - D->setIsUsed(); + D->markUsed(Reader.Context); break; } @@ -3935,11 +3933,8 @@ void ASTDeclReader::UpdateDecl(Decl *D, ModuleFile &ModuleFile, Exported = TD->getDefinition(); Module *Owner = SubmoduleID ? Reader.getSubmodule(SubmoduleID) : nullptr; if (Reader.getContext().getLangOpts().ModulesLocalVisibility) { - // FIXME: This doesn't send the right notifications if there are - // ASTMutationListeners other than an ASTWriter. - Reader.getContext().mergeDefinitionIntoModule( - cast<NamedDecl>(Exported), Owner, - /*NotifyListeners*/ false); + Reader.getContext().mergeDefinitionIntoModule(cast<NamedDecl>(Exported), + Owner); Reader.PendingMergedDefinitionsToDeduplicate.insert( cast<NamedDecl>(Exported)); } else if (Owner && Owner->NameVisibility != Module::AllVisible) { |