@@ -859,13 +859,6 @@ class ModuleInterfaceLoaderImpl {
859859 prebuiltCacheDir,
860860 /* serializeDependencyHashes*/ false ,
861861 trackSystemDependencies);
862- // Set up a builder if we need to build the module. It'll also set up
863- // the genericSubInvocation we'll need to use to compute the cache paths.
864- ModuleInterfaceBuilder builder (
865- ctx.SourceMgr , ctx.Diags , astDelegate, interfacePath, moduleName, cacheDir,
866- prebuiltCacheDir,
867- Opts.disableInterfaceLock , diagnosticLoc,
868- dependencyTracker);
869862
870863 // Compute the output path if we're loading or emitting a cached module.
871864 llvm::SmallString<256 > cachedOutputPath;
@@ -908,6 +901,18 @@ class ModuleInterfaceLoaderImpl {
908901
909902 return std::move (module .moduleBuffer );
910903 }
904+ // If building from interface is disabled, return error.
905+ if (Opts.disableBuildingInterface ) {
906+ return std::make_error_code (std::errc::not_supported);
907+ }
908+
909+ // Set up a builder if we need to build the module. It'll also set up
910+ // the genericSubInvocation we'll need to use to compute the cache paths.
911+ ModuleInterfaceBuilder builder (
912+ ctx.SourceMgr , ctx.Diags , astDelegate, interfacePath, moduleName, cacheDir,
913+ prebuiltCacheDir,
914+ Opts.disableInterfaceLock , diagnosticLoc,
915+ dependencyTracker);
911916
912917 std::unique_ptr<llvm::MemoryBuffer> moduleBuffer;
913918
0 commit comments