From c78cfbe23e95ab14c4c2f81bcd43c1b15ef6ca44 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Thu, 19 Feb 2015 00:10:28 +0000 Subject: [PATCH] Allow errors on use of a private module header to be disabled, to better support incremental transition to modules. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@229788 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/DiagnosticLexKinds.td | 7 ++++--- lib/Lex/ModuleMap.cpp | 6 +++--- test/Modules/private.cpp | 1 + 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/include/clang/Basic/DiagnosticLexKinds.td b/include/clang/Basic/DiagnosticLexKinds.td index 93cc7c2978..3fa9bcf419 100644 --- a/include/clang/Basic/DiagnosticLexKinds.td +++ b/include/clang/Basic/DiagnosticLexKinds.td @@ -625,9 +625,10 @@ def warn_uncovered_module_header : Warning< InGroup; 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>, 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'">, diff --git a/lib/Lex/ModuleMap.cpp b/lib/Lex/ModuleMap.cpp index 018a0b8825..0bb98568b2 100644 --- a/lib/Lex/ModuleMap.cpp +++ b/lib/Lex/ModuleMap.cpp @@ -288,14 +288,14 @@ void ModuleMap::diagnoseHeaderInclusion(Module *RequestingModule, // 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(Module *RequestingModule, // 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 ? diff --git a/test/Modules/private.cpp b/test/Modules/private.cpp index 93b4b9457f..31e60e47e3 100644 --- a/test/Modules/private.cpp +++ b/test/Modules/private.cpp @@ -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; -- 2.40.0