[clang] [clang][modules] Add 'exclude umbrella' module map directive (PR #223706)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 15 06:57:28 PDT 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp -- clang/include/clang/Basic/Module.h clang/include/clang/Lex/ModuleMap.h clang/include/clang/Lex/ModuleMapFile.h clang/lib/Basic/Module.cpp clang/lib/Lex/ModuleMap.cpp clang/lib/Lex/ModuleMapFile.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/include/clang/Basic/Module.h b/clang/include/clang/Basic/Module.h
index afbf7765b..e1d839fb4 100644
--- a/clang/include/clang/Basic/Module.h
+++ b/clang/include/clang/Basic/Module.h
@@ -413,8 +413,8 @@ public:
std::string UmbrellaRelativeToRootModuleDirectory;
/// Directories excluded from this module's umbrella directory, as written in
- /// the module map's `exclude umbrella` declarations. Kept for printing the module
- /// map back out; resolution uses ModuleMap::ExcludedDirs.
+ /// the module map's `exclude umbrella` declarations. Kept for printing the
+ /// module map back out; resolution uses ModuleMap::ExcludedDirs.
std::vector<std::string> ExcludedDirsAsWritten;
/// The module through which entities defined in this module will
diff --git a/clang/include/clang/Lex/ModuleMap.h b/clang/include/clang/Lex/ModuleMap.h
index 186956efa..0746d554b 100644
--- a/clang/include/clang/Lex/ModuleMap.h
+++ b/clang/include/clang/Lex/ModuleMap.h
@@ -220,7 +220,8 @@ private:
llvm::DenseMap<const DirectoryEntry *, Module *> UmbrellaDirs;
/// Directories that a module has excluded from its umbrella directory via
- /// an `exclude umbrella` declaration, mapped to the module that excluded them.
+ /// an `exclude umbrella` declaration, mapped to the module that excluded
+ /// them.
///
/// A header under an excluded directory does not resolve to the excluding
/// module through that module's umbrella, as if the directory were absent.
diff --git a/clang/include/clang/Lex/ModuleMapFile.h b/clang/include/clang/Lex/ModuleMapFile.h
index 3226062f4..80be18b31 100644
--- a/clang/include/clang/Lex/ModuleMapFile.h
+++ b/clang/include/clang/Lex/ModuleMapFile.h
@@ -32,9 +32,9 @@ struct ExportDecl;
using Decl =
std::variant<struct RequiresDecl, struct HeaderDecl, struct UmbrellaDirDecl,
struct ExcludeDirDecl, struct ModuleDecl, struct ExcludeDecl,
- struct ExportDecl, struct ExportAsDecl, struct ExternModuleDecl,
- struct UseDecl, struct LinkDecl, struct ConfigMacrosDecl,
- struct ConflictDecl>;
+ struct ExportDecl, struct ExportAsDecl,
+ struct ExternModuleDecl, struct UseDecl, struct LinkDecl,
+ struct ConfigMacrosDecl, struct ConflictDecl>;
struct RequiresFeature {
StringRef Feature;
diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp
index e280078de..58c34d77a 100644
--- a/clang/lib/Lex/ModuleMap.cpp
+++ b/clang/lib/Lex/ModuleMap.cpp
@@ -426,9 +426,10 @@ ModuleMap::HeadersMap::iterator ModuleMap::findKnownHeader(FileEntryRef File) {
Known = Headers.find(File);
}
- // A header under a directory excluded from its umbrella module has no explicit
- // Headers entry. Record one lazily with the ExcludedHeader role so every
- // Headers map consumer treats it the same way as an `exclude header` header.
+ // A header under a directory excluded from its umbrella module has no
+ // explicit Headers entry. Record one lazily with the ExcludedHeader role so
+ // every Headers map consumer treats it the same way as an `exclude header`
+ // header.
if (Known == Headers.end() && !ExcludedDirs.empty()) {
SmallVector<DirectoryEntryRef, 2> IntermediateDirs;
KnownHeader H = findHeaderInUmbrellaDirs(File, IntermediateDirs);
@@ -2319,7 +2320,8 @@ void ModuleMapLoader::handleExcludeDirDecl(
}
if (!Dir) {
- Diags.Report(EDD.Location, diag::warn_mmap_exclude_dir_not_found) << DirName;
+ Diags.Report(EDD.Location, diag::warn_mmap_exclude_dir_not_found)
+ << DirName;
return;
}
diff --git a/clang/lib/Lex/ModuleMapFile.cpp b/clang/lib/Lex/ModuleMapFile.cpp
index d8ba08125..aad2dce7c 100644
--- a/clang/lib/Lex/ModuleMapFile.cpp
+++ b/clang/lib/Lex/ModuleMapFile.cpp
@@ -807,8 +807,8 @@ ModuleMapFileParser::parseExcludeDecl(clang::SourceLocation LeadingLoc) {
///
/// exclude-umbrella-dir-declaration:
/// 'exclude' 'umbrella' string-literal
-std::optional<ExcludeDirDecl>
-ModuleMapFileParser::parseExcludeUmbrellaDecl(clang::SourceLocation LeadingLoc) {
+std::optional<ExcludeDirDecl> ModuleMapFileParser::parseExcludeUmbrellaDecl(
+ clang::SourceLocation LeadingLoc) {
assert(Tok.is(MMToken::UmbrellaKeyword));
consumeToken(); // 'umbrella' keyword
``````````
</details>
https://github.com/llvm/llvm-project/pull/223706
More information about the cfe-commits
mailing list