forked from OSchip/llvm-project
[PCH] We don't need to instantiate HeaderFileInfoTrait in ASTReader more than once.
We can just re-use the one from HeaderFileInfoLookupTable. llvm-svn: 176565
This commit is contained in:
parent
b42863e258
commit
61a3896d9f
|
@ -289,10 +289,6 @@ public:
|
||||||
/// the header files.
|
/// the header files.
|
||||||
void *HeaderFileInfoTable;
|
void *HeaderFileInfoTable;
|
||||||
|
|
||||||
/// \brief Actual data for the list of framework names used in the header
|
|
||||||
/// search information.
|
|
||||||
const char *HeaderFileFrameworkStrings;
|
|
||||||
|
|
||||||
// === Submodule information ===
|
// === Submodule information ===
|
||||||
/// \brief The number of submodules in this module.
|
/// \brief The number of submodules in this module.
|
||||||
unsigned LocalNumSubmodules;
|
unsigned LocalNumSubmodules;
|
||||||
|
|
|
@ -2476,7 +2476,6 @@ bool ASTReader::ReadASTBlock(ModuleFile &F) {
|
||||||
case HEADER_SEARCH_TABLE: {
|
case HEADER_SEARCH_TABLE: {
|
||||||
F.HeaderFileInfoTableData = Blob.data();
|
F.HeaderFileInfoTableData = Blob.data();
|
||||||
F.LocalNumHeaderFileInfos = Record[1];
|
F.LocalNumHeaderFileInfos = Record[1];
|
||||||
F.HeaderFileFrameworkStrings = Blob.data() + Record[2];
|
|
||||||
if (Record[0]) {
|
if (Record[0]) {
|
||||||
F.HeaderFileInfoTable
|
F.HeaderFileInfoTable
|
||||||
= HeaderFileInfoLookupTable::Create(
|
= HeaderFileInfoLookupTable::Create(
|
||||||
|
@ -4092,31 +4091,25 @@ Optional<bool> ASTReader::isPreprocessedEntityInFileID(unsigned Index,
|
||||||
namespace {
|
namespace {
|
||||||
/// \brief Visitor used to search for information about a header file.
|
/// \brief Visitor used to search for information about a header file.
|
||||||
class HeaderFileInfoVisitor {
|
class HeaderFileInfoVisitor {
|
||||||
ASTReader &Reader;
|
|
||||||
const FileEntry *FE;
|
const FileEntry *FE;
|
||||||
|
|
||||||
Optional<HeaderFileInfo> HFI;
|
Optional<HeaderFileInfo> HFI;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
HeaderFileInfoVisitor(ASTReader &Reader, const FileEntry *FE)
|
explicit HeaderFileInfoVisitor(const FileEntry *FE)
|
||||||
: Reader(Reader), FE(FE) { }
|
: FE(FE) { }
|
||||||
|
|
||||||
static bool visit(ModuleFile &M, void *UserData) {
|
static bool visit(ModuleFile &M, void *UserData) {
|
||||||
HeaderFileInfoVisitor *This
|
HeaderFileInfoVisitor *This
|
||||||
= static_cast<HeaderFileInfoVisitor *>(UserData);
|
= static_cast<HeaderFileInfoVisitor *>(UserData);
|
||||||
|
|
||||||
HeaderFileInfoTrait Trait(This->Reader, M,
|
|
||||||
&This->Reader.getPreprocessor().getHeaderSearchInfo(),
|
|
||||||
M.HeaderFileFrameworkStrings);
|
|
||||||
|
|
||||||
HeaderFileInfoLookupTable *Table
|
HeaderFileInfoLookupTable *Table
|
||||||
= static_cast<HeaderFileInfoLookupTable *>(M.HeaderFileInfoTable);
|
= static_cast<HeaderFileInfoLookupTable *>(M.HeaderFileInfoTable);
|
||||||
if (!Table)
|
if (!Table)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Look in the on-disk hash table for an entry for this file name.
|
// Look in the on-disk hash table for an entry for this file name.
|
||||||
HeaderFileInfoLookupTable::iterator Pos = Table->find(This->FE->getName(),
|
HeaderFileInfoLookupTable::iterator Pos = Table->find(This->FE->getName());
|
||||||
&Trait);
|
|
||||||
if (Pos == Table->end())
|
if (Pos == Table->end())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -4129,7 +4122,7 @@ namespace {
|
||||||
}
|
}
|
||||||
|
|
||||||
HeaderFileInfo ASTReader::GetHeaderFileInfo(const FileEntry *FE) {
|
HeaderFileInfo ASTReader::GetHeaderFileInfo(const FileEntry *FE) {
|
||||||
HeaderFileInfoVisitor Visitor(*this, FE);
|
HeaderFileInfoVisitor Visitor(FE);
|
||||||
ModuleMgr.visit(&HeaderFileInfoVisitor::visit, &Visitor);
|
ModuleMgr.visit(&HeaderFileInfoVisitor::visit, &Visitor);
|
||||||
if (Optional<HeaderFileInfo> HFI = Visitor.getHeaderFileInfo()) {
|
if (Optional<HeaderFileInfo> HFI = Visitor.getHeaderFileInfo()) {
|
||||||
if (Listener)
|
if (Listener)
|
||||||
|
|
|
@ -33,7 +33,7 @@ ModuleFile::ModuleFile(ModuleKind Kind, unsigned Generation)
|
||||||
PreprocessedEntityOffsets(0), NumPreprocessedEntities(0),
|
PreprocessedEntityOffsets(0), NumPreprocessedEntities(0),
|
||||||
LocalNumHeaderFileInfos(0),
|
LocalNumHeaderFileInfos(0),
|
||||||
HeaderFileInfoTableData(0), HeaderFileInfoTable(0),
|
HeaderFileInfoTableData(0), HeaderFileInfoTable(0),
|
||||||
HeaderFileFrameworkStrings(0), LocalNumSubmodules(0), BaseSubmoduleID(0),
|
LocalNumSubmodules(0), BaseSubmoduleID(0),
|
||||||
LocalNumSelectors(0), SelectorOffsets(0), BaseSelectorID(0),
|
LocalNumSelectors(0), SelectorOffsets(0), BaseSelectorID(0),
|
||||||
SelectorLookupTableData(0), SelectorLookupTable(0), LocalNumDecls(0),
|
SelectorLookupTableData(0), SelectorLookupTable(0), LocalNumDecls(0),
|
||||||
DeclOffsets(0), BaseDeclID(0),
|
DeclOffsets(0), BaseDeclID(0),
|
||||||
|
|
Loading…
Reference in New Issue