[Lldb-commits] [lldb] [LLDB][SBSaveCore] Implement a selectable threadlist for Core Options. (PR #100443)
Jason Molenda via lldb-commits
lldb-commits at lists.llvm.org
Wed Jul 24 18:26:50 PDT 2024
================
@@ -46,8 +48,79 @@ SaveCoreOptions::GetOutputFile() const {
return m_file;
}
+Status SaveCoreOptions::SetProcess(lldb::ProcessSP process_sp) {
+ Status error;
+ if (!process_sp) {
+ ClearProcessSpecificData();
+ m_process_sp = std::nullopt;
+ return error;
+ }
+
+ if (!process_sp->IsValid()) {
+ error.SetErrorString("Cannot assign an invalid process.");
+ return error;
+ }
+
+ if (m_process_sp.has_value())
----------------
jasonmolenda wrote:
Just take this as one possible opinion: I find the naming of this `std::optional<ProcessSP> m_process_sp` a little confusing. In this method we have a `ProcessSP process_sp` and `m_process_sp` which is an `optional`. Above we see code doing `if (!process_sp)` - cool. Then I come to `if (m_process_sp.has_value())` and I'm trying to figure out what that method does in a `std::shared_ptr` and why it's different than the above bool.
I'm not sure `m_process_sp` is the best name, but we have no convention for this kind of thing today.
https://github.com/llvm/llvm-project/pull/100443
More information about the lldb-commits
mailing list