r229788 - Allow errors on use of a private module header to be disabled, to better support incremental transition to modules.

Richard Smith richard-llvm at metafoo.co.uk
Wed Feb 18 16:10:29 PST 2015


Author: rsmith
Date: Wed Feb 18 18:10:28 2015
New Revision: 229788

URL: http://llvm.org/viewvc/llvm-project?rev=229788&view=rev
Log:
Allow errors on use of a private module header to be disabled, to better support incremental transition to modules.

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
    cfe/trunk/lib/Lex/ModuleMap.cpp
    cfe/trunk/test/Modules/private.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td?rev=229788&r1=229787&r2=229788&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td Wed Feb 18 18:10:28 2015
@@ -625,9 +625,10 @@ def warn_uncovered_module_header : Warni
   InGroup<IncompleteUmbrella>;
 def err_expected_id_building_module : Error<
   "expected a module name in '__building_module' expression">;
-def error_use_of_private_header_outside_module : Error<
-  "use of private header from outside its module: '%0'">;
-def error_undeclared_use_of_module : Error<
+def warn_use_of_private_header_outside_module : Warning<
+  "use of private header from outside its module: '%0'">,
+  InGroup<DiagGroup<"private-header">>, DefaultError;
+def err_undeclared_use_of_module : Error<
   "module %0 does not depend on a module exporting '%1'">;
 def warn_non_modular_include_in_framework_module : Warning<
   "include of non-modular header inside framework module '%0'">,

Modified: cfe/trunk/lib/Lex/ModuleMap.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/ModuleMap.cpp?rev=229788&r1=229787&r2=229788&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/ModuleMap.cpp (original)
+++ cfe/trunk/lib/Lex/ModuleMap.cpp Wed Feb 18 18:10:28 2015
@@ -288,14 +288,14 @@ void ModuleMap::diagnoseHeaderInclusion(
 
   // We have found a header, but it is private.
   if (Private) {
-    Diags.Report(FilenameLoc, diag::error_use_of_private_header_outside_module)
+    Diags.Report(FilenameLoc, diag::warn_use_of_private_header_outside_module)
         << Filename;
     return;
   }
 
   // We have found a module, but we don't use it.
   if (NotUsed) {
-    Diags.Report(FilenameLoc, diag::error_undeclared_use_of_module)
+    Diags.Report(FilenameLoc, diag::err_undeclared_use_of_module)
         << RequestingModule->getFullModuleName() << Filename;
     return;
   }
@@ -306,7 +306,7 @@ void ModuleMap::diagnoseHeaderInclusion(
   // At this point, only non-modular includes remain.
 
   if (LangOpts.ModulesStrictDeclUse) {
-    Diags.Report(FilenameLoc, diag::error_undeclared_use_of_module)
+    Diags.Report(FilenameLoc, diag::err_undeclared_use_of_module)
         << RequestingModule->getFullModuleName() << Filename;
   } else if (RequestingModule) {
     diag::kind DiagID = RequestingModule->getTopLevelModule()->IsFramework ?

Modified: cfe/trunk/test/Modules/private.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/private.cpp?rev=229788&r1=229787&r2=229788&view=diff
==============================================================================
--- cfe/trunk/test/Modules/private.cpp (original)
+++ cfe/trunk/test/Modules/private.cpp Wed Feb 18 18:10:28 2015
@@ -1,5 +1,6 @@
 // RUN: rm -rf %t
 // RUN: %clang_cc1 -x objective-c -fmodules-cache-path=%t -fmodules -I %S/Inputs/private %s -verify
+// RUN: %clang_cc1 -x objective-c -fmodules-cache-path=%t -fmodules -I %S/Inputs/private %s -fsyntax-only -Wno-private-header
 
 #include "common.h"
 @import libPrivate1;





More information about the cfe-commits mailing list