[modules] For explicit module file dependencies, only list direct dependency module files.

llvm-svn: 244931
This commit is contained in:
Richard Smith 2015-08-13 18:30:25 +00:00
parent 184d94e009
commit be9b6c75c3
3 changed files with 11 additions and 1 deletions

View File

@ -709,6 +709,9 @@ static void ParseDependencyOutputArgs(DependencyOutputOptions &Opts,
// They won't be discovered by the regular preprocessor, so
// we let make / ninja to know about this implicit dependency.
Opts.ExtraDeps = Args.getAllArgValues(OPT_fsanitize_blacklist);
auto ModuleFiles = Args.getAllArgValues(OPT_fmodule_file);
Opts.ExtraDeps.insert(Opts.ExtraDeps.end(), ModuleFiles.begin(),
ModuleFiles.end());
}
bool clang::ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args,

View File

@ -486,6 +486,6 @@ bool DFGASTReaderListener::visitInputFile(llvm::StringRef Filename,
void DFGASTReaderListener::visitModuleFile(llvm::StringRef Filename,
serialization::ModuleKind Kind) {
if (Parent.includeModuleFiles() || Kind == serialization::MK_ExplicitModule)
if (Parent.includeModuleFiles())
Parent.AddFilename(Filename);
}

View File

@ -5,6 +5,8 @@
//
// 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 -fmodule-map-file=%S/Inputs/dependency-gen-base.modulemap
// 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 --check-prefix=EXPLICIT
//
// RUN: %clang_cc1 -I. -x c++ -fmodules -include Inputs/dependency-gen.h -x c++ /dev/null -fmodule-file=%t/explicit.pcm -MT main.o -fsyntax-only -dependency-file - | FileCheck %s --check-prefix=EXPLICIT-USE
module "test" {
export *
header "Inputs/dependency-gen.h"
@ -34,3 +36,8 @@ module "test" {
// EXPLICIT-NOT: dependency-gen-
// EXPLICIT: {{ |\.[/\\]}}Inputs{{[/\\]}}dependency-gen.h
// EXPLICIT-NOT: dependency-gen-
// EXPLICIT-USE: main.o:
// EXPLICIT-USE-NOT: base.pcm
// EXPLICIT-USE: explicit.pcm
// EXPLICIT-USE-NOT: base.pcm