diff options
author | Jan Svoboda <jan_svoboda@apple.com> | 2023-05-26 12:24:06 -0700 |
---|---|---|
committer | Jan Svoboda <jan_svoboda@apple.com> | 2023-05-26 15:14:16 -0700 |
commit | 924912956ed570e433440108cc50bd0ee65605b5 (patch) | |
tree | 04f8015329ec3ed8bb7c375ddaf2867feec79bf3 /clang/lib/Basic/Module.cpp | |
parent | 7adff65d4abf4b743e3834505cdb1a580b4d966e (diff) | |
download | llvm-924912956ed570e433440108cc50bd0ee65605b5.zip llvm-924912956ed570e433440108cc50bd0ee65605b5.tar.gz llvm-924912956ed570e433440108cc50bd0ee65605b5.tar.bz2 |
[clang][modules] NFCI: Distinguish as-written and effective umbrella directories
For modules with umbrellas, we track how they were written in the module map. Unfortunately, the getter for the umbrella directory conflates the "as written" directory and the "effective" directory (either the written one or the parent of the written umbrella header).
This patch makes the distinction between "as written" and "effective" umbrella directories clearer. No functional change intended.
Reviewed By: benlangmuir
Differential Revision: https://reviews.llvm.org/D151581
Diffstat (limited to 'clang/lib/Basic/Module.cpp')
-rw-r--r-- | clang/lib/Basic/Module.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/clang/lib/Basic/Module.cpp b/clang/lib/Basic/Module.cpp index 12ca19d..e0bce04 100644 --- a/clang/lib/Basic/Module.cpp +++ b/clang/lib/Basic/Module.cpp @@ -263,12 +263,12 @@ bool Module::fullModuleNameIs(ArrayRef<StringRef> nameParts) const { return nameParts.empty(); } -Module::DirectoryName Module::getUmbrellaDir() const { - if (Header U = getUmbrellaHeader()) - return {"", "", U.Entry->getDir()}; - - return {UmbrellaAsWritten, UmbrellaRelativeToRootModuleDirectory, - Umbrella.dyn_cast<const DirectoryEntry *>()}; +const DirectoryEntry *Module::getEffectiveUmbrellaDir() const { + if (const auto *ME = Umbrella.dyn_cast<const FileEntryRef::MapEntry *>()) + return FileEntryRef(*ME).getDir(); + if (const auto *ME = Umbrella.dyn_cast<const DirectoryEntry *>()) + return ME; + return nullptr; } void Module::addTopHeader(const FileEntry *File) { @@ -483,12 +483,12 @@ void Module::print(raw_ostream &OS, unsigned Indent, bool Dump) const { OS << "\n"; } - if (Header H = getUmbrellaHeader()) { + if (Header H = getUmbrellaHeaderAsWritten()) { OS.indent(Indent + 2); OS << "umbrella header \""; OS.write_escaped(H.NameAsWritten); OS << "\"\n"; - } else if (DirectoryName D = getUmbrellaDir()) { + } else if (DirectoryName D = getUmbrellaDirAsWritten()) { OS.indent(Indent + 2); OS << "umbrella \""; OS.write_escaped(D.NameAsWritten); |