aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Lex/ModuleMap.cpp
diff options
context:
space:
mode:
authorVolodymyr Sapsai <vsapsai@apple.com>2025-05-08 09:07:33 -0700
committerGitHub <noreply@github.com>2025-05-08 09:07:33 -0700
commit64bb60a471a5ddc9c9bec413c65fdab730a1e4b0 (patch)
treefd5ae4ba175adced3b705d90259dd3f8aaca0f66 /clang/lib/Lex/ModuleMap.cpp
parent5b7ccdc2a29f3be4b01f0eadca8f52d5dcdd9846 (diff)
downloadllvm-64bb60a471a5ddc9c9bec413c65fdab730a1e4b0.zip
llvm-64bb60a471a5ddc9c9bec413c65fdab730a1e4b0.tar.gz
llvm-64bb60a471a5ddc9c9bec413c65fdab730a1e4b0.tar.bz2
[Modules] Don't fail when an unused textual header is missing. (#138227)
According to the documentation > A header declaration that does not contain `exclude` nor `textual` specifies a header that contributes to the enclosing module. Which means that `exclude` and `textual` header don't contribute to the enclosing module and their presence isn't required to build such a module. The keywords tell clang how a header should be treated in a context of the module but they don't add headers to the module. When a textual header *is* used, clang still emits "file not found" error pointing to the location where the missing file is included.
Diffstat (limited to 'clang/lib/Lex/ModuleMap.cpp')
-rw-r--r--clang/lib/Lex/ModuleMap.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp
index 81a74d5..d073237 100644
--- a/clang/lib/Lex/ModuleMap.cpp
+++ b/clang/lib/Lex/ModuleMap.cpp
@@ -310,8 +310,10 @@ void ModuleMap::resolveHeader(Module *Mod,
} else if (Header.HasBuiltinHeader && !Header.Size && !Header.ModTime) {
// There's a builtin header but no corresponding on-disk header. Assume
// this was supposed to modularize the builtin header alone.
- } else if (Header.Kind == Module::HK_Excluded) {
- // Ignore missing excluded header files. They're optional anyway.
+ } else if ((Header.Kind == Module::HK_Excluded) ||
+ (Header.Kind == Module::HK_Textual)) {
+ // Ignore excluded and textual header files as a module can be built with
+ // such headers missing.
} else {
// If we find a module that has a missing header, we mark this module as
// unavailable and store the header directive for displaying diagnostics.