[Lldb-commits] [PATCH] D42182: Add LLDB_LOG_ERROR (?)

Zachary Turner via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Jan 17 10:37:45 PST 2018


zturner added a comment.

In a way it's kind of built into the semantics of `llvm::Error` that this is the only way it could possibly work, since it's a move only type.  If you do this, for example:

  Error E = doSomething();
  LLDB_LOG_ERROR(E);

you'd get a compilation failure.  The only way to make it compile would be to do this:

  Error E = doSomething();
  LLDB_LOG_ERROR(std::move(E));

And since you've written `std::move(E)` you already can't use it again anyway.  And if you had written it as one line:

  LLDB_LOG_ERROR(doSomething());

Then you weren't holding onto the error anyway and it shouldn't matter whether or not it was cleared.

So I'm not sold on the idea of lengthening the name, because you couldn't have used the Error anyway after calling this.


https://reviews.llvm.org/D42182





More information about the lldb-commits mailing list