diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-03-27 05:52:25 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-03-27 05:52:25 +0000 |
commit | 34da7514843016409da42513b668242600b0b45f (patch) | |
tree | c5a095c26a7300c11527a74151a6e6c85878fd95 /clang/lib/Serialization | |
parent | 0b37175ca6822aafdbf5352cbbf469f2bf0bf1bd (diff) | |
download | bcm5719-llvm-34da7514843016409da42513b668242600b0b45f.tar.gz bcm5719-llvm-34da7514843016409da42513b668242600b0b45f.zip |
Remove unused support for replacing declarations from chained AST files.
llvm-svn: 264533
Diffstat (limited to 'clang/lib/Serialization')
-rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 11 | ||||
-rw-r--r-- | clang/lib/Serialization/ASTReaderDecl.cpp | 11 | ||||
-rw-r--r-- | clang/lib/Serialization/ASTWriter.cpp | 15 | ||||
-rw-r--r-- | clang/lib/Serialization/ASTWriterDecl.cpp | 42 |
4 files changed, 16 insertions, 63 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index d05cbeb2a1c..180b65bf16a 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -3033,17 +3033,6 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { break; } - case DECL_REPLACEMENTS: { - if (Record.size() % 3 != 0) { - Error("invalid DECL_REPLACEMENTS block in AST file"); - return Failure; - } - for (unsigned I = 0, N = Record.size(); I != N; I += 3) - ReplacedDecls[getGlobalDeclID(F, Record[I])] - = ReplacedDeclInfo(&F, Record[I+1], Record[I+2]); - break; - } - case OBJC_CATEGORIES_MAP: { if (F.LocalNumObjCCategoriesInMap != 0) { Error("duplicate OBJC_CATEGORIES_MAP record in AST file"); diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp index abfee00cf3a..dad3a1450e3 100644 --- a/clang/lib/Serialization/ASTReaderDecl.cpp +++ b/clang/lib/Serialization/ASTReaderDecl.cpp @@ -2482,18 +2482,11 @@ static bool isConsumerInterestedIn(Decl *D, bool HasBody) { /// \brief Get the correct cursor and offset for loading a declaration. ASTReader::RecordLocation ASTReader::DeclCursorForID(DeclID ID, unsigned &RawLocation) { - // See if there's an override. - DeclReplacementMap::iterator It = ReplacedDecls.find(ID); - if (It != ReplacedDecls.end()) { - RawLocation = It->second.RawLoc; - return RecordLocation(It->second.Mod, It->second.Offset); - } - GlobalDeclMapType::iterator I = GlobalDeclMap.find(ID); assert(I != GlobalDeclMap.end() && "Corrupted global declaration map"); ModuleFile *M = I->second; - const DeclOffset & - DOffs = M->DeclOffsets[ID - M->BaseDeclID - NUM_PREDEF_DECL_IDS]; + const DeclOffset &DOffs = + M->DeclOffsets[ID - M->BaseDeclID - NUM_PREDEF_DECL_IDS]; RawLocation = DOffs.Loc; return RecordLocation(M, DOffs.BitOffset); } diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index d0b3d279a2a..89a54a18d3d 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -937,7 +937,6 @@ void ASTWriter::WriteBlockInfoBlock() { RECORD(SEMA_DECL_REFS); RECORD(WEAK_UNDECLARED_IDENTIFIERS); RECORD(PENDING_IMPLICIT_INSTANTIATIONS); - RECORD(DECL_REPLACEMENTS); RECORD(UPDATE_VISIBLE); RECORD(DECL_UPDATE_OFFSETS); RECORD(DECL_UPDATES); @@ -4621,7 +4620,6 @@ uint64_t ASTWriter::WriteASTCore(Sema &SemaRef, StringRef isysroot, } } - WriteDeclReplacementsBlock(); WriteObjCCategories(); if(!WritingModule) { WriteOptimizePragmaOptions(SemaRef); @@ -4783,19 +4781,6 @@ void ASTWriter::WriteDeclUpdatesBlocks(RecordDataImpl &OffsetsRecord) { } } -void ASTWriter::WriteDeclReplacementsBlock() { - if (ReplacedDecls.empty()) - return; - - RecordData Record; - for (const auto &I : ReplacedDecls) { - Record.push_back(I.ID); - Record.push_back(I.Offset); - Record.push_back(I.Loc); - } - Stream.EmitRecord(DECL_REPLACEMENTS, Record); -} - void ASTWriter::AddSourceLocation(SourceLocation Loc, RecordDataImpl &Record) { Record.push_back(Loc.getRawEncoding()); } diff --git a/clang/lib/Serialization/ASTWriterDecl.cpp b/clang/lib/Serialization/ASTWriterDecl.cpp index 752373646e6..77e89522ebf 100644 --- a/clang/lib/Serialization/ASTWriterDecl.cpp +++ b/clang/lib/Serialization/ASTWriterDecl.cpp @@ -2158,7 +2158,7 @@ void ASTWriter::WriteDecl(ASTContext &Context, Decl *D) { ID = IDR; - bool isReplacingADecl = ID < FirstDeclID; + assert(ID >= FirstDeclID && "invalid decl ID"); // If this declaration is also a DeclContext, write blocks for the // declarations that lexically stored inside its context and those @@ -2169,14 +2169,6 @@ void ASTWriter::WriteDecl(ASTContext &Context, Decl *D) { uint64_t VisibleOffset = 0; DeclContext *DC = dyn_cast<DeclContext>(D); if (DC) { - if (isReplacingADecl) { - // It is replacing a decl from a chained PCH; make sure that the - // DeclContext is fully loaded. - if (DC->hasExternalLexicalStorage()) - DC->LoadLexicalDeclsFromExternalStorage(); - if (DC->hasExternalVisibleStorage()) - Chain->completeVisibleDeclsMap(DC); - } LexicalOffset = WriteDeclContextLexicalBlock(Context, DC); VisibleOffset = WriteDeclContextVisibleBlock(Context, DC); } @@ -2188,28 +2180,22 @@ void ASTWriter::WriteDecl(ASTContext &Context, Decl *D) { W.Visit(D); if (DC) W.VisitDeclContext(DC, LexicalOffset, VisibleOffset); - if (isReplacingADecl) { - // We're replacing a decl in a previous file. - ReplacedDecls.push_back(ReplacedDeclInfo(ID, Stream.GetCurrentBitNo(), - D->getLocation())); - } else { - unsigned Index = ID - FirstDeclID; - - // Record the offset for this declaration - SourceLocation Loc = D->getLocation(); - if (DeclOffsets.size() == Index) - DeclOffsets.push_back(DeclOffset(Loc, Stream.GetCurrentBitNo())); - else if (DeclOffsets.size() < Index) { - DeclOffsets.resize(Index+1); - DeclOffsets[Index].setLocation(Loc); - DeclOffsets[Index].BitOffset = Stream.GetCurrentBitNo(); - } + unsigned Index = ID - FirstDeclID; - SourceManager &SM = Context.getSourceManager(); - if (Loc.isValid() && SM.isLocalSourceLocation(Loc)) - associateDeclWithFile(D, ID); + // Record the offset for this declaration + SourceLocation Loc = D->getLocation(); + if (DeclOffsets.size() == Index) + DeclOffsets.push_back(DeclOffset(Loc, Stream.GetCurrentBitNo())); + else if (DeclOffsets.size() < Index) { + DeclOffsets.resize(Index+1); + DeclOffsets[Index].setLocation(Loc); + DeclOffsets[Index].BitOffset = Stream.GetCurrentBitNo(); } + SourceManager &SM = Context.getSourceManager(); + if (Loc.isValid() && SM.isLocalSourceLocation(Loc)) + associateDeclWithFile(D, ID); + if (!W.Code) llvm::report_fatal_error(StringRef("unexpected declaration kind '") + D->getDeclKindName() + "'"); |