diff options
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 3 | ||||
-rw-r--r-- | clang/lib/Frontend/DependencyFile.cpp | 2 | ||||
-rw-r--r-- | clang/test/Modules/dependency-gen.modulemap | 7 |
3 files changed, 11 insertions, 1 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index ae1ccd75bda..73febb463ec 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -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, diff --git a/clang/lib/Frontend/DependencyFile.cpp b/clang/lib/Frontend/DependencyFile.cpp index ec47781887b..c5c34490d71 100644 --- a/clang/lib/Frontend/DependencyFile.cpp +++ b/clang/lib/Frontend/DependencyFile.cpp @@ -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); } diff --git a/clang/test/Modules/dependency-gen.modulemap b/clang/test/Modules/dependency-gen.modulemap index c98a5ec60da..00a3308569c 100644 --- a/clang/test/Modules/dependency-gen.modulemap +++ b/clang/test/Modules/dependency-gen.modulemap @@ -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 |