Sean, thanks for adding Daniel.

Daniel, thanks for the review.  I've updated accordingly per your comments.  
But note that I had to have at least one include in the test, or the check is 
not performed.  It seems like this should be okay, since any code using modules 
will have some include or import.  Otherwise I would need to do the check 
earlier when options are processed.

http://reviews.llvm.org/D6324

Files:
  include/clang/Basic/DiagnosticGroups.td
  include/clang/Basic/DiagnosticLexKinds.td
  lib/Lex/HeaderSearch.cpp
  test/Modules/pr21217.cpp
Index: test/Modules/pr21217.cpp
===================================================================
--- test/Modules/pr21217.cpp
+++ test/Modules/pr21217.cpp
@@ -0,0 +1,6 @@
+// RUN: not %clang_cc1 -fmodules -fmodule-map-file=does-not-exist.modulemap -verify %s 2>&1 | \
+// RUN: FileCheck %s
+
+// CHECK: File 'does-not-exist.modulemap' specified via -fmodule-map-file not found
+
+#include "Inputs/private/common.h"
Index: include/clang/Basic/DiagnosticGroups.td
===================================================================
--- include/clang/Basic/DiagnosticGroups.td
+++ include/clang/Basic/DiagnosticGroups.td
@@ -207,6 +207,7 @@
                                           [NonModularIncludeInFrameworkModule]>;
 def IncompleteModule : DiagGroup<"incomplete-module",
     [IncompleteUmbrella, NonModularIncludeInModule]>;
+def ModuleMapMissing : DiagGroup<"module-map-missing">;
 
 def InvalidNoreturn : DiagGroup<"invalid-noreturn">;
 def InvalidSourceEncoding : DiagGroup<"invalid-source-encoding">;
Index: include/clang/Basic/DiagnosticLexKinds.td
===================================================================
--- include/clang/Basic/DiagnosticLexKinds.td
+++ include/clang/Basic/DiagnosticLexKinds.td
@@ -611,6 +611,9 @@
 def err_mmap_expected_attribute : Error<"expected an attribute name">;
 def warn_mmap_unknown_attribute : Warning<"unknown attribute '%0'">,
   InGroup<IgnoredAttributes>;
+def warn_module_map_not_found : Warning<
+  "File '%0' specified via -fmodule-map-file not found">,
+  InGroup<ModuleMapMissing>;
 
 def warn_auto_module_import : Warning<
   "treating #%select{include|import|include_next|__include_macros}0 as an "
Index: lib/Lex/HeaderSearch.cpp
===================================================================
--- lib/Lex/HeaderSearch.cpp
+++ lib/Lex/HeaderSearch.cpp
@@ -578,7 +578,9 @@
     for (const auto &Filename : HSOpts->ModuleMapFiles)
       if (const FileEntry *File = FileMgr.getFile(Filename))
         loadModuleMapFile(File, /*IsSystem=*/false);
-    HSOpts->ModuleMapFiles.clear();
+      else
+        Diags.Report(diag::warn_module_map_not_found) << Filename;
+	  HSOpts->ModuleMapFiles.clear();
   }
 
   if (SuggestedModule)
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to