[PATCH] D39922: Create a TempFile class
Rafael Avila de Espindola via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 13 10:24:39 PST 2017
Rui Ueyama via Phabricator <reviews at reviews.llvm.org> writes:
> ruiu added inline comments.
>
>
> ================
> Comment at: lib/Support/Path.cpp:773-774
> +Error TempFile::discard() {
> + if (Done)
> + return Error::success();
> + Done = true;
> ----------------
> I think that calling `keep` or `Done` more than once on an object should be an error because I can't think of a use case in which allowing it is useful.
We do assert that that is the case:
+Error TempFile::keep(const Twine &Name) {
+ assert(!Done);
We allow multiple discards to make this class easy to use on RAII.
Cheers,
Rafael
More information about the llvm-commits
mailing list