Skip to content
Snippets Groups Projects
Commit 3d49db3a authored by Richard Smith's avatar Richard Smith
Browse files

[modules] Don't leak -M flags for dependency file generation into the module

build process when we implicitly build a module. Previously, we'd create the
specified .d file once for each implicitly-built module and then finally
overwrite it with the correct contents after the requested build completes.
(This fails if you use stdout as a dependency file, which is what the provided
testcase does, and is how I discovered this brokenness.)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@244412 91177308-0d34-0410-b5e6-96231b3b80d8
parent 3d48296e
No related branches found
No related tags found
No related merge requests found
...@@ -944,8 +944,10 @@ static bool compileModuleImpl(CompilerInstance &ImportingInstance, ...@@ -944,8 +944,10 @@ static bool compileModuleImpl(CompilerInstance &ImportingInstance,
FullSourceLoc(ImportLoc, ImportingInstance.getSourceManager())); FullSourceLoc(ImportLoc, ImportingInstance.getSourceManager()));
// If we're collecting module dependencies, we need to share a collector // If we're collecting module dependencies, we need to share a collector
// between all of the module CompilerInstances. // between all of the module CompilerInstances. Other than that, we don't
// want to produce any dependency output from the module build.
Instance.setModuleDepCollector(ImportingInstance.getModuleDepCollector()); Instance.setModuleDepCollector(ImportingInstance.getModuleDepCollector());
Invocation->getDependencyOutputOpts() = DependencyOutputOptions();
// Get or create the module map that we'll use to build this module. // Get or create the module map that we'll use to build this module.
std::string InferredModuleMapContent; std::string InferredModuleMapContent;
......
// RUN: cd %S // RUN: cd %S
// RUN: rm -f %t.cpm %t-base.pcm %t-base.d %t.d // RUN: rm -rf %t
// RUN: %clang_cc1 -I. -x c++ -fmodule-name=test-base -fmodules -emit-module -fno-validate-pch -fmodules-strict-decluse Inputs/dependency-gen-base.modulemap -dependency-file %t-base.d -MT %t-base.pcm -o %t-base.pcm -fmodule-map-file-home-is-cwd //
// RUN: %clang_cc1 -I. -x c++ -fmodule-name=test -fmodules -emit-module -fno-validate-pch -fmodules-strict-decluse -fmodule-file=%t-base.pcm %s -dependency-file %t.d -MT %t.pcm -o %t.pcm -fmodules-cache-path=%t -fmodule-map-file-home-is-cwd // RUN: %clang_cc1 -I. -x c++ -fmodule-name=test -fmodules -emit-module -fno-validate-pch -fmodules-strict-decluse %s -dependency-file - -MT implicit.pcm -o %t/implicit.pcm -fmodules-cache-path=%t -fmodule-map-file-home-is-cwd | FileCheck %s
//
// RUN: %clang_cc1 -I. -x c++ -fmodule-name=test-base -fmodules -emit-module -fno-validate-pch -fmodules-strict-decluse Inputs/dependency-gen-base.modulemap -o %t/base.pcm -fmodule-map-file-home-is-cwd
// RUN: %clang_cc1 -I. -x c++ -fmodule-name=test -fmodules -emit-module -fno-validate-pch -fmodules-strict-decluse -fmodule-file=%t/base.pcm %s -dependency-file - -MT explicit.pcm -o %t/explicit.pcm -fmodules-cache-path=%t -fmodule-map-file-home-is-cwd | FileCheck %s
// RUN: FileCheck %s < %t.d // RUN: FileCheck %s < %t.d
module "test" { module "test" {
export * export *
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment