[cfe-commits] r158146 - /cfe/trunk/unittests/Tooling/RewriterTestContext.h
Benjamin Kramer
benny.kra at googlemail.com
Thu Jun 7 10:06:46 PDT 2012
On 07.06.2012, at 18:55, Craig Topper wrote:
> Doesn't that function return "error_code" not bool?
It has an implicit conversion to bool that is also invoked when writing if (!error_code). It doesn't matter if it's stored as a bool or error_code in this case.
- Ben
> On Thu, Jun 7, 2012 at 2:57 AM, Benjamin Kramer <benny.kra at googlemail.com> wrote:
> Author: d0k
> Date: Thu Jun 7 04:57:21 2012
> New Revision: 158146
>
> URL: http://llvm.org/viewvc/llvm-project?rev=158146&view=rev
> Log:
> Move sideeffecting call out of assert().
>
> Modified:
> cfe/trunk/unittests/Tooling/RewriterTestContext.h
>
> Modified: cfe/trunk/unittests/Tooling/RewriterTestContext.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Tooling/RewriterTestContext.h?rev=158146&r1=158145&r2=158146&view=diff
> ==============================================================================
> --- cfe/trunk/unittests/Tooling/RewriterTestContext.h (original)
> +++ cfe/trunk/unittests/Tooling/RewriterTestContext.h Thu Jun 7 04:57:21 2012
> @@ -63,8 +63,10 @@
> FileID createOnDiskFile(StringRef Name, StringRef Content) {
> if (TemporaryDirectory.empty()) {
> int FD;
> - assert(!llvm::sys::fs::unique_file("rewriter-test-%%-%%-%%-%%/anchor",
> - FD, TemporaryDirectory));
> + bool error =
> + llvm::sys::fs::unique_file("rewriter-test-%%-%%-%%-%%/anchor", FD,
> + TemporaryDirectory);
> + assert(!error); (void)error;
> llvm::raw_fd_ostream Closer(FD, /*shouldClose=*/true);
> TemporaryDirectory = llvm::sys::path::parent_path(TemporaryDirectory);
> }
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
>
> --
> ~Craig
More information about the cfe-commits
mailing list