[clang] [clang] NFCI: Make `ModuleFile::File` non-optional (PR #74892)
Ben Langmuir via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 8 15:29:30 PST 2023
================
@@ -441,22 +434,19 @@ void ModuleManager::visit(llvm::function_ref<bool(ModuleFile &M)> Visitor,
bool ModuleManager::lookupModuleFile(StringRef FileName, off_t ExpectedSize,
time_t ExpectedModTime,
OptionalFileEntryRef &File) {
- File = std::nullopt;
- if (FileName == "-")
+ if (FileName == "-") {
+ File = expectedToOptional(FileMgr.getSTDIN());
return false;
+ }
// Open the file immediately to ensure there is no race between stat'ing and
// opening the file.
- OptionalFileEntryRef FileOrErr =
- expectedToOptional(FileMgr.getFileRef(FileName, /*OpenFile=*/true,
- /*CacheFailure=*/false));
- if (!FileOrErr)
- return false;
-
- File = *FileOrErr;
+ File = expectedToOptional(FileMgr.getFileRef(FileName, /*OpenFile=*/true,
----------------
benlangmuir wrote:
Yeah, I would recommend that.
https://github.com/llvm/llvm-project/pull/74892
More information about the cfe-commits
mailing list