llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Jan Svoboda (jansvoboda11) <details> <summary>Changes</summary> The PR https://github.com/llvm/llvm-project/pull/216704 fixed repeated `#import` of a header that belongs to a module in textual builds. One omission was not setting the boolean we now use to make the decision to import or skip when we tried importing a submodule but figured out it's not covered by the umbrella. This PR fixes that. rdar://185417139 --- Full diff: https://github.com/llvm/llvm-project/pull/217691.diff 2 Files Affected: - (modified) clang/lib/Lex/PPDirectives.cpp (+1) - (added) clang/test/Modules/repeated-include-missing-submodule.c (+18) ``````````diff diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index 24e63b8bae711..8226c27742da3 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -2535,6 +2535,7 @@ Preprocessor::ImportAction Preprocessor::HandleHeaderIncludeOrImport( // actual module containing it exists (because the umbrella header is // incomplete). Treat this as a textual inclusion. ModuleToImport = nullptr; + UsableClangHeaderModule = false; } else if (Imported.isConfigMismatch()) { // On a configuration mismatch, enter the header textually. We still know // that it's part of the corresponding module. diff --git a/clang/test/Modules/repeated-include-missing-submodule.c b/clang/test/Modules/repeated-include-missing-submodule.c new file mode 100644 index 0000000000000..44f04cec07b92 --- /dev/null +++ b/clang/test/Modules/repeated-include-missing-submodule.c @@ -0,0 +1,18 @@ +// Check that multiple include-once of a header not covered by an umbrella work. + +// RUN: rm -rf %t +// RUN: split-file %s %t + +// RUN: %clang_cc1 -fsyntax-only %t/tu.c -fmodules -fimplicit-module-maps \ +// RUN: -fmodules-cache-path=%t/cache -verify + +//--- module.modulemap +module M { + umbrella header "M.h" + module * { export * } +} +//--- M.h +//--- NotCovered.h +//--- tu.c +#import "NotCovered.h" // expected-warning{{missing submodule 'M.NotCovered'}} +#import "NotCovered.h" // expected-warning{{missing submodule 'M.NotCovered'}} `````````` </details> https://github.com/llvm/llvm-project/pull/217691 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
