[clang] 946406a - ModuleManager: Simplify lookupModuleFile by only setting the out parameter once, NFC
Duncan P. N. Exon Smith via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 28 16:05:49 PDT 2020
Author: Duncan P. N. Exon Smith
Date: 2020-10-28T19:04:22-04:00
New Revision: 946406aebce298725b07097934cb39b1e5bee656
URL: https://github.com/llvm/llvm-project/commit/946406aebce298725b07097934cb39b1e5bee656
DIFF: https://github.com/llvm/llvm-project/commit/946406aebce298725b07097934cb39b1e5bee656.diff
LOG: ModuleManager: Simplify lookupModuleFile by only setting the out parameter once, NFC
Differential Revision: https://reviews.llvm.org/D89835
Added:
Modified:
clang/lib/Serialization/ModuleManager.cpp
Removed:
################################################################################
diff --git a/clang/lib/Serialization/ModuleManager.cpp b/clang/lib/Serialization/ModuleManager.cpp
index 542e75e77c3a..2c65c0be4074 100644
--- a/clang/lib/Serialization/ModuleManager.cpp
+++ b/clang/lib/Serialization/ModuleManager.cpp
@@ -462,19 +462,17 @@ bool ModuleManager::lookupModuleFile(StringRef FileName,
off_t ExpectedSize,
time_t ExpectedModTime,
const FileEntry *&File) {
- if (FileName == "-") {
- File = nullptr;
+ File = nullptr;
+ if (FileName == "-")
return false;
- }
// Open the file immediately to ensure there is no race between stat'ing and
// opening the file.
auto FileOrErr = FileMgr.getFile(FileName, /*OpenFile=*/true,
/*CacheFailure=*/false);
- if (!FileOrErr) {
- File = nullptr;
+ if (!FileOrErr)
return false;
- }
+
File = *FileOrErr;
if ((ExpectedSize && ExpectedSize != File->getSize()) ||
More information about the cfe-commits
mailing list