diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-03-11 03:10:46 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-03-11 03:10:46 +0000 |
commit | d91747980a97f8f6bc4ae365823d707ba972ef65 (patch) | |
tree | 927c64081e6fc0b56ae02e021341ad10d2f820e8 /clang/lib/Serialization/ASTReader.cpp | |
parent | 1108cb3682bb7d39bd4516dc6fec31d61fe57f49 (diff) | |
download | bcm5719-llvm-d91747980a97f8f6bc4ae365823d707ba972ef65.tar.gz bcm5719-llvm-d91747980a97f8f6bc4ae365823d707ba972ef65.zip |
If a visibility update record is found for a DeclContext after that Decl has
already been loaded, apply that update record to the Decl immediately, rather
than adding it to a pending list and never applying it.
llvm-svn: 203534
Diffstat (limited to 'clang/lib/Serialization/ASTReader.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 6f4dc9bfb58..487283c421c 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -457,6 +457,11 @@ ASTReader::setDeserializationListener(ASTDeserializationListener *Listener) { } +void NameLookupTableDataDeleter:: +operator()(ASTDeclContextNameLookupTable *Ptr) const { + delete Ptr; +} + unsigned ASTSelectorLookupTrait::ComputeHash(Selector Sel) { return serialization::ComputeHash(Sel); @@ -836,11 +841,10 @@ bool ASTReader::ReadDeclContextStorage(ModuleFile &M, Error("Expected visible lookup table block"); return true; } - Info.NameLookupTableData - = ASTDeclContextNameLookupTable::Create( - (const unsigned char *)Blob.data() + Record[0], - (const unsigned char *)Blob.data(), - ASTDeclContextNameLookupTrait(*this, M)); + Info.NameLookupTableData.reset(ASTDeclContextNameLookupTable::Create( + (const unsigned char *)Blob.data() + Record[0], + (const unsigned char *)Blob.data(), + ASTDeclContextNameLookupTrait(*this, M))); } return false; @@ -2493,8 +2497,12 @@ bool ASTReader::ReadASTBlock(ModuleFile &F) { ASTDeclContextNameLookupTrait(*this, F)); if (ID == PREDEF_DECL_TRANSLATION_UNIT_ID) { // Is it the TU? DeclContext *TU = Context.getTranslationUnitDecl(); - F.DeclContextInfos[TU].NameLookupTableData = Table; + F.DeclContextInfos[TU].NameLookupTableData.reset(Table); TU->setHasExternalVisibleStorage(true); + } else if (Decl *D = DeclsLoaded[ID - NUM_PREDEF_DECL_IDS]) { + auto *DC = cast<DeclContext>(D); + DC->getPrimaryContext()->setHasExternalVisibleStorage(true); + F.DeclContextInfos[DC].NameLookupTableData.reset(Table); } else PendingVisibleUpdates[ID].push_back(std::make_pair(Table, &F)); break; @@ -6078,7 +6086,7 @@ namespace { return false; // Look for this name within this module. - ASTDeclContextNameLookupTable *LookupTable = + const auto &LookupTable = Info->second.NameLookupTableData; ASTDeclContextNameLookupTable::iterator Pos = LookupTable->find(This->Name); @@ -6208,7 +6216,7 @@ namespace { if (!FoundInfo) return false; - ASTDeclContextNameLookupTable *LookupTable = + const auto &LookupTable = Info->second.NameLookupTableData; bool FoundAnything = false; for (ASTDeclContextNameLookupTable::data_iterator |