[Lldb-commits] [PATCH] D43912: [Symbol] Add InvalidType, a force-checked recoverable error

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Feb 28 14:44:14 PST 2018


labath added a comment.

I agree that we should start using this in a lot more places. I think you should be able to shorten the logging code a bit by using the LLDB_LOG_ERROR macro, which I've created for this purpose.



================
Comment at: source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp:335-340
+    if (llvm::Error E = user_type_or_err.takeError()) {
+      std::string Reason = llvm::toString(std::move(E));
+      if (log)
+        log->Printf("%s", Reason.c_str());
+      return false;
+    }
----------------
How about:
```
if (!user_type_or_err) {
  LLDB_LOG_ERROR(log, user_type_or_err.takeError(), "{0}");
  return false;
}
```


https://reviews.llvm.org/D43912





More information about the lldb-commits mailing list