forked from OSchip/llvm-project
[Modules] Make r180934 more efficient by only loading top-level module maps in system header directories.
llvm-svn: 181643
This commit is contained in:
parent
783c79446b
commit
64a1fa5cda
|
@ -493,6 +493,9 @@ public:
|
||||||
/// \param Modules Will be filled with the set of known, top-level modules.
|
/// \param Modules Will be filled with the set of known, top-level modules.
|
||||||
void collectAllModules(SmallVectorImpl<Module *> &Modules);
|
void collectAllModules(SmallVectorImpl<Module *> &Modules);
|
||||||
|
|
||||||
|
/// \brief Load all known, top-level system modules.
|
||||||
|
void loadTopLevelSystemModules();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// \brief Retrieve a module with the given name, which may be part of the
|
/// \brief Retrieve a module with the given name, which may be part of the
|
||||||
/// given framework.
|
/// given framework.
|
||||||
|
|
|
@ -1146,6 +1146,20 @@ void HeaderSearch::collectAllModules(SmallVectorImpl<Module *> &Modules) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HeaderSearch::loadTopLevelSystemModules() {
|
||||||
|
// Load module maps for each of the header search directories.
|
||||||
|
for (unsigned Idx = 0, N = SearchDirs.size(); Idx != N; ++Idx) {
|
||||||
|
// We only care about normal system header directories.
|
||||||
|
if (!SearchDirs[Idx].isNormalDir() ||
|
||||||
|
SearchDirs[Idx].getDirCharacteristic() != SrcMgr::C_System) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try to load a module map file for the search directory.
|
||||||
|
loadModuleMapFile(SearchDirs[Idx].getDir());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void HeaderSearch::loadSubdirectoryModuleMaps(DirectoryLookup &SearchDir) {
|
void HeaderSearch::loadSubdirectoryModuleMaps(DirectoryLookup &SearchDir) {
|
||||||
if (SearchDir.haveSearchedAllModuleMaps())
|
if (SearchDir.haveSearchedAllModuleMaps())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -183,8 +183,7 @@ Module *ModuleMap::findModuleForHeader(const FileEntry *File) {
|
||||||
// specific module (e.g., in /usr/include).
|
// specific module (e.g., in /usr/include).
|
||||||
if (File->getDir() == BuiltinIncludeDir &&
|
if (File->getDir() == BuiltinIncludeDir &&
|
||||||
isBuiltinHeader(llvm::sys::path::filename(File->getName()))) {
|
isBuiltinHeader(llvm::sys::path::filename(File->getName()))) {
|
||||||
SmallVector<Module *, 4> AllModules;
|
HeaderInfo.loadTopLevelSystemModules();
|
||||||
HeaderInfo.collectAllModules(AllModules);
|
|
||||||
|
|
||||||
// Check again.
|
// Check again.
|
||||||
Known = Headers.find(File);
|
Known = Headers.find(File);
|
||||||
|
|
Loading…
Reference in New Issue