Skip to content

Commit 8f99856

Browse files
committed
Address review feedback.
1 parent 7782900 commit 8f99856

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

llvm/lib/Support/Caching.cpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ Expected<FileCache> llvm::localCache(const Twine &CacheNameRef,
9191

9292
Error commit() override {
9393
if (Committed)
94-
return Error::success();
94+
return createStringError(std::errc::invalid_argument,
95+
Twine("CacheStream already committed."));
9596
Committed = true;
9697

9798
// Make sure the stream is closed before committing it.
@@ -145,15 +146,8 @@ Expected<FileCache> llvm::localCache(const Twine &CacheNameRef,
145146
}
146147

147148
~CacheStream() {
148-
// In Debug builds, try to track down places where commit() was not
149-
// called before destruction.
150-
assert(Committed);
151-
// In Release builds, fall back to the previous behaviour of committing
152-
// during destruction and reporting errors with report_fatal_error.
153-
if (Committed)
154-
return;
155-
if (Error Err = commit())
156-
report_fatal_error(Twine(toString(std::move(Err))));
149+
if (!Committed)
150+
report_fatal_error(Twine("CacheStream was not committed.\n");
157151
}
158152
};
159153

0 commit comments

Comments
 (0)