From 946406aebce298725b07097934cb39b1e5bee656 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Duncan=20P=2E=20N=2E=20Exon=C2=A0Smith?= Date: Tue, 20 Oct 2020 18:53:51 -0400 Subject: ModuleManager: Simplify lookupModuleFile by only setting the out parameter once, NFC Differential Revision: https://reviews.llvm.org/D89835 --- clang/lib/Serialization/ModuleManager.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'clang/lib/Serialization/ModuleManager.cpp') diff --git a/clang/lib/Serialization/ModuleManager.cpp b/clang/lib/Serialization/ModuleManager.cpp index 542e75e..2c65c0b 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()) || -- cgit v1.1