[Lldb-commits] [PATCH] D68547: exception handling in PythonDataObjects.

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 8 01:54:23 PDT 2019


labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

I am quite happy about how this is turning out to be. Thanks for taking your time to do this.



================
Comment at: lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp:36-53
+namespace lldb_private {
+namespace python {
+template <> Expected<bool> As<bool>(Expected<PythonObject> &&obj) {
+  if (obj) {
+    return obj.get().IsTrue();
+  } else {
+    return obj.takeError();
----------------
llvm style is to not put `else` after a return <http://llvm.org/docs/CodingStandards.html#don-t-use-else-after-a-return>. Also, for short statements like this, I'd omit braces. And lastly, in line with the "keep namespaces small" philosophy I think you should define these as `template<> ... python::As<long long>(...)` :)


================
Comment at: lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp:1092-1096
+  if (m_repr_bytes) {
+    return PyBytes_AS_STRING(m_repr_bytes);
+  } else {
+    return "unknown exception";
+  }
----------------
no else after return, no braces


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68547/new/

https://reviews.llvm.org/D68547





More information about the lldb-commits mailing list