]> granicus.if.org Git - clang/commitdiff
[modules] Remove now-dead code for lazy loading of files specified by -fmodule-file=.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Sun, 9 Aug 2015 08:58:36 +0000 (08:58 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Sun, 9 Aug 2015 08:58:36 +0000 (08:58 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@244417 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Frontend/CompilerInstance.h
include/clang/Serialization/ASTBitCodes.h
include/clang/Serialization/ModuleManager.h
lib/Frontend/CompilerInstance.cpp
lib/Serialization/ASTReader.cpp
lib/Serialization/ASTWriter.cpp
lib/Serialization/ModuleManager.cpp

index 45e5ed12046ff2d8fd99a228634cd50c0969611b..99a9d733d2f74d47df3b5aa73abc22542265a8cb 100644 (file)
@@ -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;
index ea3a9c203b284333be67db68ab4dc78711e61325..7edf2704c857814c2f98d569b6726d11696e1b8b 100644 (file)
@@ -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
index 8b879ab18ea3fd76b279e584fba511217f147384..08e7d4049e556145efdff2eaf11d2c66ec1a1432 100644 (file)
@@ -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
index 7d9efd4e9be0646ab0e943b3c31a52219138b08e..740f1db825f40263a974533d37dada614b20505d 100644 (file)
@@ -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.
index 29a935c9099818abf64bbf5d6e915b6dc16c4fa2..b951b578abe5f940b9044b9c3313e9fc90051e1a 100644 (file)
@@ -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;
index 366d4b39fc50d44a6c453ccd8f4fce0b1b9f8073..0a731f0d942511c4429336226d12cc1b23a7f0b7 100644 (file)
@@ -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.
index 895743f60e8438e3ca1a2df31c62b00fa73188bc..f9d0fa469b25af539598e41fcea234d23feb4ebb 100644 (file)
@@ -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;