From: Chandler Carruth Date: Tue, 24 Mar 2015 21:44:25 +0000 (+0000) Subject: [Modules] Stop creating timestamps for the modules cache and trying to X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3865f6b88eeaacffebef02a13617a9708cb92ed3;p=clang [Modules] Stop creating timestamps for the modules cache and trying to prune it when we have disabled implicit module generation and thus are not using any cached modules. Also update a test of explicitly generated modules to pass this CC1 flag correctly. This fixes an issue where Clang was dropping files into the source tree while running its tests. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233117 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp index b23baa5dbb..1c5b322230 100644 --- a/lib/Frontend/CompilerInstance.cpp +++ b/lib/Frontend/CompilerInstance.cpp @@ -1239,9 +1239,10 @@ void CompilerInstance::createModuleManager() { if (!hasASTContext()) createASTContext(); - // If we're not recursively building a module, check whether we - // need to prune the module cache. - if (getSourceManager().getModuleBuildStack().empty() && + // If we're implicitly building modules but not currently recursively + // building a module, check whether we need to prune the module cache. + if (getLangOpts().ImplicitModules && + getSourceManager().getModuleBuildStack().empty() && getHeaderSearchOpts().ModuleCachePruneInterval > 0 && getHeaderSearchOpts().ModuleCachePruneAfter > 0) { pruneModuleCache(getHeaderSearchOpts()); diff --git a/test/Modules/relative-dep-gen.cpp b/test/Modules/relative-dep-gen.cpp index 1aa4e2a382..86c4651477 100644 --- a/test/Modules/relative-dep-gen.cpp +++ b/test/Modules/relative-dep-gen.cpp @@ -2,17 +2,17 @@ // RUN: rm -rf %t // RUN: mkdir %t // -// RUN: %clang_cc1 -cc1 -fmodule-name=relative-dep-gen -emit-module -x c++ Inputs/relative-dep-gen.modulemap -dependency-file %t/build.d -MT mod.pcm -o %t/mod.pcm -// RUN: %clang_cc1 -cc1 -fmodule-map-file=Inputs/relative-dep-gen.modulemap -fmodule-file=%t/mod.pcm -dependency-file %t/use-explicit.d -MT use.o relative-dep-gen.cpp -fsyntax-only -// RUN: %clang_cc1 -cc1 -fmodule-map-file=Inputs/relative-dep-gen.modulemap -dependency-file %t/use-implicit.d relative-dep-gen.cpp -MT use.o -fsyntax-only +// RUN: %clang_cc1 -cc1 -fno-implicit-modules -fmodule-name=relative-dep-gen -emit-module -x c++ Inputs/relative-dep-gen.modulemap -dependency-file %t/build.d -MT mod.pcm -o %t/mod.pcm +// RUN: %clang_cc1 -cc1 -fno-implicit-modules -fmodule-map-file=Inputs/relative-dep-gen.modulemap -fmodule-file=%t/mod.pcm -dependency-file %t/use-explicit.d -MT use.o relative-dep-gen.cpp -fsyntax-only +// RUN: %clang_cc1 -cc1 -fno-implicit-modules -fmodule-map-file=Inputs/relative-dep-gen.modulemap -dependency-file %t/use-implicit.d relative-dep-gen.cpp -MT use.o -fsyntax-only // // RUN: FileCheck --check-prefix=CHECK-BUILD %s < %t/build.d // RUN: FileCheck --check-prefix=CHECK-USE %s < %t/use-explicit.d // RUN: FileCheck --check-prefix=CHECK-USE %s < %t/use-implicit.d // -// RUN: %clang_cc1 -cc1 -fmodule-name=relative-dep-gen -emit-module -x c++ Inputs/relative-dep-gen-cwd.modulemap -dependency-file %t/build-cwd.d -MT mod.pcm -o %t/mod-cwd.pcm -fmodule-map-file-home-is-cwd -// RUN: %clang_cc1 -cc1 -fmodule-map-file=Inputs/relative-dep-gen-cwd.modulemap -fmodule-file=%t/mod-cwd.pcm -dependency-file %t/use-explicit-cwd.d -MT use.o relative-dep-gen.cpp -fsyntax-only -fmodule-map-file-home-is-cwd -// RUN: %clang_cc1 -cc1 -fmodule-map-file=Inputs/relative-dep-gen-cwd.modulemap -dependency-file %t/use-implicit-cwd.d relative-dep-gen.cpp -MT use.o -fsyntax-only -fmodule-map-file-home-is-cwd +// RUN: %clang_cc1 -cc1 -fno-implicit-modules -fmodule-name=relative-dep-gen -emit-module -x c++ Inputs/relative-dep-gen-cwd.modulemap -dependency-file %t/build-cwd.d -MT mod.pcm -o %t/mod-cwd.pcm -fmodule-map-file-home-is-cwd +// RUN: %clang_cc1 -cc1 -fno-implicit-modules -fmodule-map-file=Inputs/relative-dep-gen-cwd.modulemap -fmodule-file=%t/mod-cwd.pcm -dependency-file %t/use-explicit-cwd.d -MT use.o relative-dep-gen.cpp -fsyntax-only -fmodule-map-file-home-is-cwd +// RUN: %clang_cc1 -cc1 -fno-implicit-modules -fmodule-map-file=Inputs/relative-dep-gen-cwd.modulemap -dependency-file %t/use-implicit-cwd.d relative-dep-gen.cpp -MT use.o -fsyntax-only -fmodule-map-file-home-is-cwd // // RUN: FileCheck --check-prefix=CHECK-BUILD %s < %t/build-cwd.d // RUN: FileCheck --check-prefix=CHECK-USE %s < %t/use-explicit-cwd.d