aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Lex/ModuleMap.cpp
diff options
context:
space:
mode:
authorJan Svoboda <jan_svoboda@apple.com>2023-05-30 21:06:50 -0700
committerJan Svoboda <jan_svoboda@apple.com>2023-05-30 21:06:51 -0700
commite6830b6028ec5434ccf8dbebdd992918f67b1751 (patch)
tree94813ba74063a562fcfcdb8e279e3185857c8d1f /clang/lib/Lex/ModuleMap.cpp
parent0442d08fdb173d89b0779d32eb929957a344f5e6 (diff)
downloadllvm-e6830b6028ec5434ccf8dbebdd992918f67b1751.zip
llvm-e6830b6028ec5434ccf8dbebdd992918f67b1751.tar.gz
llvm-e6830b6028ec5434ccf8dbebdd992918f67b1751.tar.bz2
[clang][modules] NFCI: Extract optionality out of `Module::{Header,DirectoryName}`
Most users of `Module::Header` already assume its `Entry` is populated. Enforce this assumption in the type system and handle the only case where this is not the case by wrapping the whole struct in `std::optional`. Do the same for `Module::DirectoryName`. Depends on D151584. Reviewed By: benlangmuir Differential Revision: https://reviews.llvm.org/D151586
Diffstat (limited to 'clang/lib/Lex/ModuleMap.cpp')
-rw-r--r--clang/lib/Lex/ModuleMap.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp
index 6808fdf..bfd4890 100644
--- a/clang/lib/Lex/ModuleMap.cpp
+++ b/clang/lib/Lex/ModuleMap.cpp
@@ -1289,7 +1289,7 @@ void ModuleMap::addHeader(Module *Mod, Module::Header Header,
// Notify callbacks that we just added a new header.
for (const auto &Cb : Callbacks)
- Cb->moduleMapAddHeader(Header.Entry->getName());
+ Cb->moduleMapAddHeader(Header.Entry.getName());
}
OptionalFileEntryRef
@@ -2541,7 +2541,7 @@ void ModuleMapParser::parseUmbrellaDirDecl(SourceLocation UmbrellaLoc) {
for (llvm::vfs::recursive_directory_iterator I(FS, Dir->getName(), EC), E;
I != E && !EC; I.increment(EC)) {
if (auto FE = SourceMgr.getFileManager().getOptionalFileRef(I->path())) {
- Module::Header Header = {"", std::string(I->path()), FE};
+ Module::Header Header = {"", std::string(I->path()), *FE};
Headers.push_back(std::move(Header));
}
}