Skip to content

Commit 237f6b8

Browse files
authored
Merge pull request #6202 from akyrtzi/pr/stable2/minor-code-simplification
[CAS/LazyMappedFileRegion.cpp] Minor simplification of code, NFC
2 parents 1681811 + 6b757ef commit 237f6b8

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

llvm/lib/CAS/LazyMappedFileRegion.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -295,12 +295,6 @@ Expected<LazyMappedFileRegion> LazyMappedFileRegion::create(
295295
// do the initialization) or we have the size for the completely initialized
296296
// file.
297297

298-
if (Status.getSize() > 0)
299-
// The file was already constructed.
300-
LMFR.CachedSize = Status.getSize();
301-
else
302-
LMFR.IsConstructingNewFile = true;
303-
304298
{
305299
std::error_code EC;
306300
sys::fs::mapped_file_region Map(
@@ -310,10 +304,14 @@ Expected<LazyMappedFileRegion> LazyMappedFileRegion::create(
310304
LMFR.Map = std::move(Map);
311305
}
312306

313-
if (!LMFR.IsConstructingNewFile)
307+
if (Status.getSize() > 0) {
308+
// The file was already constructed.
309+
LMFR.CachedSize = Status.getSize();
314310
return std::move(LMFR);
311+
}
315312

316313
// This is a new file. Resize to NewFileSize and run the constructor.
314+
LMFR.IsConstructingNewFile = true;
317315
if (Error E = NewFileConstructor(LMFR))
318316
return std::move(E);
319317
assert(LMFR.size() > 0 && "Constructor must set a non-zero size");

0 commit comments

Comments
 (0)