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

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 13 11:30:25 PDT 2015


Author: rsmith
Date: Thu Aug 13 13:30:25 2015
New Revision: 244931

URL: http://llvm.org/viewvc/llvm-project?rev=244931&view=rev
Log:
[modules] For explicit module file dependencies, only list direct dependency module files.

Modified:
    cfe/trunk/lib/Frontend/CompilerInvocation.cpp
    cfe/trunk/lib/Frontend/DependencyFile.cpp
    cfe/trunk/test/Modules/dependency-gen.modulemap

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=244931&r1=244930&r2=244931&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Thu Aug 13 13:30:25 2015
@@ -709,6 +709,9 @@ static void ParseDependencyOutputArgs(De
   // 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,

Modified: cfe/trunk/lib/Frontend/DependencyFile.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/DependencyFile.cpp?rev=244931&r1=244930&r2=244931&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/DependencyFile.cpp (original)
+++ cfe/trunk/lib/Frontend/DependencyFile.cpp Thu Aug 13 13:30:25 2015
@@ -486,6 +486,6 @@ bool DFGASTReaderListener::visitInputFil
 
 void DFGASTReaderListener::visitModuleFile(llvm::StringRef Filename,
                                            serialization::ModuleKind Kind) {
-  if (Parent.includeModuleFiles() || Kind == serialization::MK_ExplicitModule)
+  if (Parent.includeModuleFiles())
     Parent.AddFilename(Filename);
 }

Modified: cfe/trunk/test/Modules/dependency-gen.modulemap
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/dependency-gen.modulemap?rev=244931&r1=244930&r2=244931&view=diff
==============================================================================
--- cfe/trunk/test/Modules/dependency-gen.modulemap (original)
+++ cfe/trunk/test/Modules/dependency-gen.modulemap Thu Aug 13 13:30:25 2015
@@ -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




More information about the cfe-commits mailing list