aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Serialization/ASTWriterDecl.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2016-03-27 05:52:25 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2016-03-27 05:52:25 +0000
commit34da7514843016409da42513b668242600b0b45f (patch)
treec5a095c26a7300c11527a74151a6e6c85878fd95 /clang/lib/Serialization/ASTWriterDecl.cpp
parent0b37175ca6822aafdbf5352cbbf469f2bf0bf1bd (diff)
downloadllvm-34da7514843016409da42513b668242600b0b45f.zip
llvm-34da7514843016409da42513b668242600b0b45f.tar.gz
llvm-34da7514843016409da42513b668242600b0b45f.tar.bz2
Remove unused support for replacing declarations from chained AST files.
llvm-svn: 264533
Diffstat (limited to 'clang/lib/Serialization/ASTWriterDecl.cpp')
-rw-r--r--clang/lib/Serialization/ASTWriterDecl.cpp42
1 files changed, 14 insertions, 28 deletions
diff --git a/clang/lib/Serialization/ASTWriterDecl.cpp b/clang/lib/Serialization/ASTWriterDecl.cpp
index 7523736..77e8952 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() + "'");