Skip to content

Commit

Permalink
[Modules] textual headers in submodules never resolve their uses
Browse files Browse the repository at this point in the history
When an include from a textual header is resolved, the textual header's
submodule is used as the requesting module. The submodule's uses are
resolved, but that doesn't work because only top level modules have
uses, and only the top level module uses are used for checking uses in
Module::directlyUses. ModuleMap::resolveUses to resolve the top level
module instead of the submodule.

---

This fixes the build of std.pcm with MacOSX15.0.sdk.
  • Loading branch information
ian-twilightcoder authored and hahnjo committed Jun 24, 2024
1 parent ece4c81 commit bb9629d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions interpreter/llvm-project/clang/lib/Lex/ModuleMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1370,16 +1370,17 @@ bool ModuleMap::resolveExports(Module *Mod, bool Complain) {
}

bool ModuleMap::resolveUses(Module *Mod, bool Complain) {
auto Unresolved = std::move(Mod->UnresolvedDirectUses);
Mod->UnresolvedDirectUses.clear();
auto *Top = Mod->getTopLevelModule();
auto Unresolved = std::move(Top->UnresolvedDirectUses);
Top->UnresolvedDirectUses.clear();
for (auto &UDU : Unresolved) {
Module *DirectUse = resolveModuleId(UDU, Mod, Complain);
Module *DirectUse = resolveModuleId(UDU, Top, Complain);
if (DirectUse)
Mod->DirectUses.push_back(DirectUse);
Top->DirectUses.push_back(DirectUse);
else
Mod->UnresolvedDirectUses.push_back(UDU);
Top->UnresolvedDirectUses.push_back(UDU);
}
return !Mod->UnresolvedDirectUses.empty();
return !Top->UnresolvedDirectUses.empty();
}

bool ModuleMap::resolveConflicts(Module *Mod, bool Complain) {
Expand Down
2 changes: 1 addition & 1 deletion interpreter/llvm-project/llvm-project.tag
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ROOT-llvm16-20240614-01
ROOT-llvm16-20240621-01

0 comments on commit bb9629d

Please sign in to comment.