diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Sema/SemaDeclObjC.cpp | 7 | ||||
-rw-r--r-- | lib/Serialization/ASTWriter.cpp | 16 |
2 files changed, 13 insertions, 10 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 3d1f5bd064..592d7c231e 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -21,6 +21,7 @@ #include "clang/AST/ExprObjC.h" #include "clang/AST/ASTContext.h" #include "clang/AST/DeclObjC.h" +#include "clang/AST/ASTMutationListener.h" #include "clang/Basic/SourceManager.h" #include "clang/Sema/DeclSpec.h" #include "llvm/ADT/DenseSet.h" @@ -701,8 +702,10 @@ Sema::ActOnForwardProtocolDeclaration(SourceLocation AtProtocolLoc, } if (attrList) { ProcessDeclAttributeList(TUScope, PDecl, attrList); - if (!isNew) - PDecl->setChangedSinceDeserialization(true); + if (!isNew) { + if (ASTMutationListener *L = Context.getASTMutationListener()) + L->UpdatedAttributeList(PDecl); + } } Protocols.push_back(PDecl); ProtoLocs.push_back(IdentList[i].second); diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp index a98c4cc82b..3618c4b4be 100644 --- a/lib/Serialization/ASTWriter.cpp +++ b/lib/Serialization/ASTWriter.cpp @@ -2960,8 +2960,6 @@ void ASTWriter::WriteASTCore(Sema &SemaRef, MemorizeStatCalls *StatCalls, I != E; ++I) { if (!(*I)->isFromASTFile()) NewGlobalDecls.push_back(std::make_pair((*I)->getKind(), GetDeclRef(*I))); - else if ((*I)->isChangedSinceDeserialization()) - (void)GetDeclRef(*I); // Make sure it's written, but don't record it. } llvm::BitCodeAbbrev *Abv = new llvm::BitCodeAbbrev(); @@ -3454,12 +3452,6 @@ DeclID ASTWriter::GetDeclRef(const Decl *D) { // enqueue it in the list of declarations to emit. ID = NextDeclID++; DeclTypesToEmit.push(const_cast<Decl *>(D)); - } else if (ID < FirstDeclID && D->isChangedSinceDeserialization()) { - // We don't add it to the replacement collection here, because we don't - // have the offset yet. - DeclTypesToEmit.push(const_cast<Decl *>(D)); - // Reset the flag, so that we don't add this decl multiple times. - const_cast<Decl *>(D)->setChangedSinceDeserialization(false); } return ID; @@ -4135,3 +4127,11 @@ void ASTWriter::CompletedObjCForwardRef(const ObjCContainerDecl *D) { RewriteDecl(D); } + +void ASTWriter::UpdatedAttributeList(const Decl *D) { + assert(!WritingAST && "Already writing the AST!"); + if (!D->isFromASTFile()) + return; // Declaration not imported from PCH. + + RewriteDecl(D); +} |