Commit be9b6c75 authored by Richard Smith's avatar Richard Smith
Browse files

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

llvm-svn: 244931
parent 184d94e0
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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,
+1 −1
Original line number Diff line number Diff line
@@ -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);
}
+7 −0
Original line number Diff line number Diff line
@@ -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