summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2015-11-03 01:20:54 +0000
committerDouglas Gregor <dgregor@apple.com>2015-11-03 01:20:54 +0000
commit7dd37e52b17371ba8d88065651e432d84cfb5f9c (patch)
tree7aebdb90d452f14afb71ff9fa4212b688987e036 /clang/lib/Serialization
parentcc86d824d5d8f5751319618843ee86a7afe1b466 (diff)
downloadbcm5719-llvm-7dd37e52b17371ba8d88065651e432d84cfb5f9c.tar.gz
bcm5719-llvm-7dd37e52b17371ba8d88065651e432d84cfb5f9c.zip
Eliminate "rewritten decls" from the AST writer. NFC
llvm-svn: 251877
Diffstat (limited to 'clang/lib/Serialization')
-rw-r--r--clang/lib/Serialization/ASTWriter.cpp19
-rw-r--r--clang/lib/Serialization/ASTWriterDecl.cpp14
2 files changed, 10 insertions, 23 deletions
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index 4399fdcb2f9..01e9f220f97 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -3513,11 +3513,11 @@ ASTWriter::GenerateNameLookupTable(const DeclContext *ConstDC,
auto &Name = Lookup.first;
auto &Result = Lookup.second;
- // If there are no local declarations in our lookup result, we don't
- // need to write an entry for the name at all unless we're rewriting
- // the decl context. If we can't write out a lookup set without
- // performing more deserialization, just skip this entry.
- if (isLookupResultExternal(Result, DC) && !isRewritten(cast<Decl>(DC)) &&
+ // If there are no local declarations in our lookup result, we
+ // don't need to write an entry for the name at all. If we can't
+ // write out a lookup set without performing more deserialization,
+ // just skip this entry.
+ if (isLookupResultExternal(Result, DC) &&
isLookupResultEntirelyExternal(Result, DC))
continue;
@@ -3758,9 +3758,6 @@ uint64_t ASTWriter::WriteDeclContextVisibleBlock(ASTContext &Context,
/// (in C++), for namespaces, and for classes with forward-declared unscoped
/// enumeration members (in C++11).
void ASTWriter::WriteDeclContextVisibleUpdate(const DeclContext *DC) {
- if (isRewritten(cast<Decl>(DC)))
- return;
-
StoredDeclsMap *Map = DC->getLookupPtr();
if (!Map || Map->empty())
return;
@@ -4376,10 +4373,6 @@ uint64_t ASTWriter::WriteASTCore(Sema &SemaRef, StringRef isysroot,
Stream.EnterSubblock(DECLTYPES_BLOCK_ID, /*bits for abbreviations*/5);
WriteTypeAbbrevs();
WriteDeclAbbrevs();
- for (DeclsToRewriteTy::iterator I = DeclsToRewrite.begin(),
- E = DeclsToRewrite.end();
- I != E; ++I)
- DeclTypesToEmit.push(const_cast<Decl*>(*I));
do {
WriteDeclUpdatesBlocks(DeclUpdatesOffsetsRecord);
while (!DeclTypesToEmit.empty()) {
@@ -4545,8 +4538,6 @@ void ASTWriter::WriteDeclUpdatesBlocks(RecordDataImpl &OffsetsRecord) {
for (auto &DeclUpdate : LocalUpdates) {
const Decl *D = DeclUpdate.first;
- if (isRewritten(D))
- continue; // The decl will be written completely,no need to store updates.
bool HasUpdatedBody = false;
RecordData Record;
diff --git a/clang/lib/Serialization/ASTWriterDecl.cpp b/clang/lib/Serialization/ASTWriterDecl.cpp
index 49eacea44e6..cc67b172bef 100644
--- a/clang/lib/Serialization/ASTWriterDecl.cpp
+++ b/clang/lib/Serialization/ASTWriterDecl.cpp
@@ -2093,16 +2093,12 @@ void ASTWriter::WriteDecl(ASTContext &Context, Decl *D) {
// Determine the ID for this declaration.
serialization::DeclID ID;
- if (D->isFromASTFile()) {
- assert(isRewritten(D) && "should not be emitting imported decl");
- ID = getDeclID(D);
- } else {
- serialization::DeclID &IDR = DeclIDs[D];
- if (IDR == 0)
- IDR = NextDeclID++;
+ assert(!D->isFromASTFile() && "should not be emitting imported decl");
+ serialization::DeclID &IDR = DeclIDs[D];
+ if (IDR == 0)
+ IDR = NextDeclID++;
- ID = IDR;
- }
+ ID = IDR;
bool isReplacingADecl = ID < FirstDeclID;
OpenPOWER on IntegriCloud