[PATCH] D39922: Create a TempFile class

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 10 15:32:27 PST 2017


Reid Kleckner via Phabricator <reviews at reviews.llvm.org> writes:

> ================
> Comment at: lib/Support/Path.cpp:770
> +
> +TempFile::~TempFile() { assert(Done); }
> +
> ----------------
> Should this attempt to discard the file if it wasn't committed? Otherwise users may need to invent RAII things like:
>   DiscardingTempFile : TempFile {
>     ~DiscardingTempFile() { if (!Done) consumeError(discard()); }
>   };
>
> I guess if we leave it this way, users are discouraged from doing that.

My hope is to push the error out until it gets to tools/*. There it
should be possible to use a RAII that reports the error and exits.

Cheers,
Rafael


More information about the llvm-commits mailing list