[Lldb-commits] [PATCH] D117076: [lldb/Plugins] Fix ScriptedThread IndexID reporting

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jan 18 06:34:26 PST 2022


labath accepted this revision.
labath added inline comments.
This revision is now accepted and ready to land.


================
Comment at: lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp:340
+    if (!thread_sp)
+      return GetInterface().ErrorWithMessage<bool>(
+          LLVM_PRETTY_FUNCTION, "Couldn't initialize thread.", error);
----------------
Although there's no way to exclude this via the type system (well... we could have a `nonnull_shared_ptr<T>`...), this really shouldn't ever happen. All of our `Expected<unique/shared_ptr>`-returning APIs assume that in the non-error case, the pointer object will be valid. At best, this deserves an assertion.


================
Comment at: lldb/source/Plugins/Process/scripted/ScriptedThread.cpp:61
+  if (!owned_script_object_sp)
+    return llvm::make_error<llvm::StringError>(
+        "Failed to create script object.", llvm::inconvertibleErrorCode());
----------------
btw, there's a `llvm::createStringError`, which is (slightly) shorter.


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

https://reviews.llvm.org/D117076



More information about the lldb-commits mailing list