Index: include/clang/Basic/DiagnosticGroups.td =================================================================== --- include/clang/Basic/DiagnosticGroups.td +++ include/clang/Basic/DiagnosticGroups.td @@ -213,6 +213,7 @@ def MismatchedTags : DiagGroup<"mismatched-tags">; def MissingFieldInitializers : DiagGroup<"missing-field-initializers">; def ModuleConflict : DiagGroup<"module-conflict">; +def NeedImport : DiagGroup<"need-import">; def NewlineEOF : DiagGroup<"newline-eof">; def NullArithmetic : DiagGroup<"null-arithmetic">; def NullCharacter : DiagGroup<"null-character">; Index: include/clang/Basic/DiagnosticSemaKinds.td =================================================================== --- include/clang/Basic/DiagnosticSemaKinds.td +++ include/clang/Basic/DiagnosticSemaKinds.td @@ -6958,10 +6958,9 @@ def err_module_private_local_class : Error< "local %select{struct|interface|union|class|enum}0 cannot be declared " "__module_private__">; -def err_module_private_declaration : Error< - "declaration of %0 must be imported from module '%1' before it is required">; -def err_module_private_definition : Error< - "definition of %0 must be imported from module '%1' before it is required">; +def warn_need_module_import : Warning< + "use of identifier '%0' requires import/inclusion of the module '%1'">, + InGroup; def err_module_import_in_extern_c : Error< "import of C++ module '%0' appears within extern \"C\" language linkage " "specification">; Index: include/clang/Basic/LangOptions.def =================================================================== --- include/clang/Basic/LangOptions.def +++ include/clang/Basic/LangOptions.def @@ -96,6 +96,7 @@ BENIGN_LANGOPT(HeinousExtensions , 1, 0, "Extensions that we really don't like and may be ripped out at any time") LANGOPT(Modules , 1, 0, "modules extension to C") LANGOPT(ModulesDeclUse , 1, 0, "require declaration of module uses") +LANGOPT(ModulesSearchAll , 1, 1, "search even non-imported modules to find unresolved references") LANGOPT(Optimize , 1, 0, "__OPTIMIZE__ predefined macro") LANGOPT(OptimizeSize , 1, 0, "__OPTIMIZE_SIZE__ predefined macro") LANGOPT(Static , 1, 0, "__STATIC__ predefined macro (as opposed to __DYNAMIC__)") Index: include/clang/Driver/Options.td =================================================================== --- include/clang/Driver/Options.td +++ include/clang/Driver/Options.td @@ -579,6 +579,9 @@ def fmodules_prune_after : Joined<["-"], "fmodules-prune-after=">, Group, Flags<[CC1Option]>, MetaVarName<"">, HelpText<"Specify the interval (in seconds) after which a module file will be considered unused">; +def fmodules_search_all : Flag <["-"], "fmodules-search-all">, Group, + Flags<[DriverOption, CC1Option]>, + HelpText<"Search even non-imported modules to resolve references">; def fbuild_session_timestamp : Joined<["-"], "fbuild-session-timestamp=">, Group, Flags<[CC1Option]>, MetaVarName<"