[modules] Remove now-dead code for lazy loading of files specified by -fmodule-file=.
llvm-svn: 244417
This commit is contained in:
parent
0f99d6a441
commit
86cc82906f
|
@ -126,13 +126,6 @@ class CompilerInstance : public ModuleLoader {
|
|||
/// along with the module map
|
||||
llvm::DenseMap<const IdentifierInfo *, Module *> KnownModules;
|
||||
|
||||
/// \brief Module names that have an override for the target file.
|
||||
llvm::StringMap<std::string> ModuleFileOverrides;
|
||||
|
||||
/// \brief Module files that we've explicitly loaded via \ref loadModuleFile,
|
||||
/// and their dependencies.
|
||||
llvm::StringSet<> ExplicitlyLoadedModuleFiles;
|
||||
|
||||
/// \brief The location of the module-import keyword for the last module
|
||||
/// import.
|
||||
SourceLocation LastModuleImportLoc;
|
||||
|
|
|
@ -296,10 +296,6 @@ namespace clang {
|
|||
|
||||
/// \brief Record code for the module build directory.
|
||||
MODULE_DIRECTORY = 16,
|
||||
|
||||
/// \brief Record code for the list of other AST files made available by
|
||||
/// this AST file but not actually used by it.
|
||||
KNOWN_MODULE_FILES = 17,
|
||||
};
|
||||
|
||||
/// \brief Record types that occur within the input-files block
|
||||
|
|
|
@ -46,12 +46,6 @@ class ModuleManager {
|
|||
/// \brief All loaded modules, indexed by name.
|
||||
llvm::DenseMap<const FileEntry *, ModuleFile *> Modules;
|
||||
|
||||
typedef llvm::SetVector<const FileEntry *> AdditionalKnownModuleFileSet;
|
||||
|
||||
/// \brief Additional module files that are known but not loaded. Tracked
|
||||
/// here so that we can re-export them if necessary.
|
||||
AdditionalKnownModuleFileSet AdditionalKnownModuleFiles;
|
||||
|
||||
/// \brief FileManager that handles translating between filenames and
|
||||
/// FileEntry *.
|
||||
FileManager &FileMgr;
|
||||
|
@ -242,19 +236,6 @@ public:
|
|||
/// has been "accepted", and will not (can not) be unloaded.
|
||||
void moduleFileAccepted(ModuleFile *MF);
|
||||
|
||||
/// \brief Notification from the frontend that the given module file is
|
||||
/// part of this compilation (even if not imported) and, if this compilation
|
||||
/// is exported, should be made available to importers of it.
|
||||
bool addKnownModuleFile(StringRef FileName);
|
||||
|
||||
/// \brief Get a list of additional module files that are not currently
|
||||
/// loaded but are considered to be part of the current compilation.
|
||||
llvm::iterator_range<AdditionalKnownModuleFileSet::const_iterator>
|
||||
getAdditionalKnownModuleFiles() {
|
||||
return llvm::make_range(AdditionalKnownModuleFiles.begin(),
|
||||
AdditionalKnownModuleFiles.end());
|
||||
}
|
||||
|
||||
/// \brief Visit each of the modules.
|
||||
///
|
||||
/// This routine visits each of the modules, starting with the
|
||||
|
|
|
@ -1372,13 +1372,8 @@ CompilerInstance::loadModule(SourceLocation ImportLoc,
|
|||
return ModuleLoadResult();
|
||||
}
|
||||
|
||||
// FIXME: Rmove ModuleFileOverrides
|
||||
auto Override = ModuleFileOverrides.find(ModuleName);
|
||||
bool Explicit = Override != ModuleFileOverrides.end();
|
||||
|
||||
std::string ModuleFileName =
|
||||
Explicit ? Override->second
|
||||
: PP->getHeaderSearchInfo().getModuleFileName(Module);
|
||||
PP->getHeaderSearchInfo().getModuleFileName(Module);
|
||||
if (ModuleFileName.empty()) {
|
||||
getDiagnostics().Report(ModuleNameLoc, diag::err_module_build_disabled)
|
||||
<< ModuleName;
|
||||
|
@ -1396,24 +1391,15 @@ CompilerInstance::loadModule(SourceLocation ImportLoc,
|
|||
llvm::TimeRegion TimeLoading(FrontendTimerGroup ? &Timer : nullptr);
|
||||
|
||||
// Try to load the module file.
|
||||
unsigned ARRFlags =
|
||||
Explicit ? 0 : ASTReader::ARR_OutOfDate | ASTReader::ARR_Missing;
|
||||
unsigned ARRFlags = ASTReader::ARR_OutOfDate | ASTReader::ARR_Missing;
|
||||
switch (ModuleManager->ReadAST(ModuleFileName,
|
||||
Explicit ? serialization::MK_ExplicitModule
|
||||
: serialization::MK_ImplicitModule,
|
||||
serialization::MK_ImplicitModule,
|
||||
ImportLoc, ARRFlags)) {
|
||||
case ASTReader::Success:
|
||||
break;
|
||||
|
||||
case ASTReader::OutOfDate:
|
||||
case ASTReader::Missing: {
|
||||
if (Explicit) {
|
||||
// ReadAST has already complained for us.
|
||||
ModuleLoader::HadFatalFailure = true;
|
||||
KnownModules[Path[0].first] = nullptr;
|
||||
return ModuleLoadResult();
|
||||
}
|
||||
|
||||
// The module file is missing or out-of-date. Build it.
|
||||
assert(Module && "missing module file");
|
||||
// Check whether there is a cycle in the module graph.
|
||||
|
|
|
@ -2227,9 +2227,6 @@ ASTReader::ReadControlBlock(ModuleFile &F,
|
|||
break;
|
||||
}
|
||||
|
||||
case KNOWN_MODULE_FILES:
|
||||
break;
|
||||
|
||||
case LANGUAGE_OPTIONS: {
|
||||
bool Complain = (ClientLoadCapabilities & ARR_ConfigurationMismatch) == 0;
|
||||
// FIXME: The &F == *ModuleMgr.begin() check is wrong for modules.
|
||||
|
@ -4215,20 +4212,6 @@ bool ASTReader::readASTFileControlBlock(
|
|||
break;
|
||||
}
|
||||
|
||||
case KNOWN_MODULE_FILES: {
|
||||
// Known-but-not-technically-used module files are treated as imports.
|
||||
if (!NeedsImports)
|
||||
break;
|
||||
|
||||
unsigned Idx = 0, N = Record.size();
|
||||
while (Idx < N) {
|
||||
std::string Filename = ReadString(Record, Idx);
|
||||
ResolveImportedPath(Filename, ModuleDir);
|
||||
Listener.visitImport(Filename);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
// No other validation to perform.
|
||||
break;
|
||||
|
|
|
@ -877,7 +877,6 @@ void ASTWriter::WriteBlockInfoBlock() {
|
|||
RECORD(MODULE_NAME);
|
||||
RECORD(MODULE_MAP_FILE);
|
||||
RECORD(IMPORTS);
|
||||
RECORD(KNOWN_MODULE_FILES);
|
||||
RECORD(LANGUAGE_OPTIONS);
|
||||
RECORD(TARGET_OPTIONS);
|
||||
RECORD(ORIGINAL_FILE);
|
||||
|
@ -1245,15 +1244,6 @@ void ASTWriter::WriteControlBlock(Preprocessor &PP, ASTContext &Context,
|
|||
AddPath(M->FileName, Record);
|
||||
}
|
||||
Stream.EmitRecord(IMPORTS, Record);
|
||||
|
||||
// Also emit a list of known module files that were not imported,
|
||||
// but are made available by this module.
|
||||
// FIXME: Should we also include a signature here?
|
||||
Record.clear();
|
||||
for (auto *E : Mgr.getAdditionalKnownModuleFiles())
|
||||
AddPath(E->getName(), Record);
|
||||
if (!Record.empty())
|
||||
Stream.EmitRecord(KNOWN_MODULE_FILES, Record);
|
||||
}
|
||||
|
||||
// Language options.
|
||||
|
|
|
@ -249,15 +249,6 @@ ModuleManager::addInMemoryBuffer(StringRef FileName,
|
|||
InMemoryBuffers[Entry] = std::move(Buffer);
|
||||
}
|
||||
|
||||
bool ModuleManager::addKnownModuleFile(StringRef FileName) {
|
||||
const FileEntry *File;
|
||||
if (lookupModuleFile(FileName, 0, 0, File))
|
||||
return true;
|
||||
if (!Modules.count(File))
|
||||
AdditionalKnownModuleFiles.insert(File);
|
||||
return false;
|
||||
}
|
||||
|
||||
ModuleManager::VisitState *ModuleManager::allocateVisitState() {
|
||||
// Fast path: if we have a cached state, use it.
|
||||
if (FirstVisitState) {
|
||||
|
@ -294,8 +285,6 @@ void ModuleManager::setGlobalIndex(GlobalModuleIndex *Index) {
|
|||
}
|
||||
|
||||
void ModuleManager::moduleFileAccepted(ModuleFile *MF) {
|
||||
AdditionalKnownModuleFiles.remove(MF->File);
|
||||
|
||||
if (!GlobalIndex || GlobalIndex->loadedModuleFile(MF))
|
||||
return;
|
||||
|
||||
|
|
Loading…
Reference in New Issue