[clang] [clang][Lex] Rename SearchedAllModuleMaps to LoadedAllModuleMaps, NFC (PR #237053)
Cyndy Ishida via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 29 19:26:57 PDT 2026
https://github.com/cyndyishida created https://github.com/llvm/llvm-project/pull/237053
`DirectoryLookup`'s flag is only set once the module maps in all of a search directory's immediate subdirectories are parsed and loaded, and callers rely on it to skip loading them again. Name it for that.
>From e5faf4b78d57b0907fb90bb97805a00012e9121e Mon Sep 17 00:00:00 2001
From: Cyndy Ishida <cyndy_ishida at apple.com>
Date: Thu, 29 Oct 2026 19:07:04 -0700
Subject: [PATCH] [clang][Lex] Rename SearchedAllModuleMaps to
LoadedAllModuleMaps, NFC
DirectoryLookup's flag is only set once the module maps in all of a
search directory's immediate subdirectories are parsed and loaded, and
callers rely on it to skip loading them again. Name it for that.
---
clang/include/clang/Lex/DirectoryLookup.h | 24 +++++++++++------------
clang/lib/Lex/HeaderSearch.cpp | 6 +++---
2 files changed, 14 insertions(+), 16 deletions(-)
diff --git a/clang/include/clang/Lex/DirectoryLookup.h b/clang/include/clang/Lex/DirectoryLookup.h
index bb703dfad2b28f..6b07c999232ab3 100644
--- a/clang/include/clang/Lex/DirectoryLookup.h
+++ b/clang/include/clang/Lex/DirectoryLookup.h
@@ -58,10 +58,10 @@ class DirectoryLookup {
LLVM_PREFERRED_TYPE(LookupType_t)
unsigned LookupType : 2;
- /// Whether we've performed an exhaustive search for module maps
- /// within the subdirectories of this directory.
+ /// Whether we've performed an exhaustive search and loaded all of the module
+ /// maps within the subdirectories of this directory.
LLVM_PREFERRED_TYPE(bool)
- unsigned SearchedAllModuleMaps : 1;
+ unsigned LoadedAllModuleMaps : 1;
public:
/// This ctor *does not take ownership* of 'Dir'.
@@ -69,12 +69,12 @@ class DirectoryLookup {
bool isFramework)
: u(Dir), DirCharacteristic(DT),
LookupType(isFramework ? LT_Framework : LT_NormalDir),
- SearchedAllModuleMaps(false) {}
+ LoadedAllModuleMaps(false) {}
/// This ctor *does not take ownership* of 'Map'.
DirectoryLookup(const HeaderMap *Map, SrcMgr::CharacteristicKind DT)
: u(Map), DirCharacteristic(DT), LookupType(LT_HeaderMap),
- SearchedAllModuleMaps(false) {}
+ LoadedAllModuleMaps(false) {}
/// getLookupType - Return the kind of directory lookup that this is: either a
/// normal directory, a framework path, or a HeaderMap.
@@ -120,15 +120,13 @@ class DirectoryLookup {
/// isHeaderMap - Return true if this is a header map, not a normal directory.
bool isHeaderMap() const { return getLookupType() == LT_HeaderMap; }
- /// Determine whether we have already searched this entire
- /// directory for module maps.
- bool haveSearchedAllModuleMaps() const { return SearchedAllModuleMaps; }
+ /// Determine whether we have already searched and loaded all of the module
+ /// maps within this entire directory.
+ bool haveLoadedAllModuleMaps() const { return LoadedAllModuleMaps; }
- /// Specify whether we have already searched all of the subdirectories
- /// for module maps.
- void setSearchedAllModuleMaps(bool SAMM) {
- SearchedAllModuleMaps = SAMM;
- }
+ /// Specify whether we have already loaded all of the module maps within the
+ /// subdirectories of this directory.
+ void setLoadedAllModuleMaps(bool LAMM) { LoadedAllModuleMaps = LAMM; }
/// DirCharacteristic - The type of directory this is, one of the DirType enum
/// values.
diff --git a/clang/lib/Lex/HeaderSearch.cpp b/clang/lib/Lex/HeaderSearch.cpp
index 906ce07b96a797..6c47765cbad0df 100644
--- a/clang/lib/Lex/HeaderSearch.cpp
+++ b/clang/lib/Lex/HeaderSearch.cpp
@@ -388,7 +388,7 @@ Module *HeaderSearch::lookupModule(StringRef ModuleName, StringRef SearchName,
if (HSOpts.AllowModuleMapSubdirectorySearch) {
// If we've already performed the exhaustive search for module maps in
// this search directory, don't do it again.
- if (Dir.haveSearchedAllModuleMaps())
+ if (Dir.haveLoadedAllModuleMaps())
continue;
// Load all module maps in the immediate subdirectories of this search
@@ -2407,7 +2407,7 @@ void HeaderSearch::loadSubdirectoryModuleMaps(DirectoryLookup &SearchDir) {
assert(HSOpts.ImplicitModuleMaps &&
"Should not be loading subdirectory module maps");
- if (SearchDir.haveSearchedAllModuleMaps())
+ if (SearchDir.haveLoadedAllModuleMaps())
return;
std::error_code EC;
@@ -2427,7 +2427,7 @@ void HeaderSearch::loadSubdirectoryModuleMaps(DirectoryLookup &SearchDir) {
/*ImplicitlyDiscovered=*/true, SearchDir.isFramework());
}
- SearchDir.setSearchedAllModuleMaps(true);
+ SearchDir.setLoadedAllModuleMaps(true);
}
std::string HeaderSearch::suggestPathToFileForDiagnostics(
More information about the cfe-commits
mailing list