[Lldb-commits] [lldb] [lldb/Plugins] Introduce Scripted Platform Plugin (PR #99814)
Alex Langford via lldb-commits
lldb-commits at lists.llvm.org
Mon Jul 22 14:22:35 PDT 2024
================
@@ -299,6 +301,35 @@ SBPlatform::SBPlatform(const char *platform_name) {
m_opaque_sp = Platform::Create(platform_name);
}
+SBPlatform::SBPlatform(const char *platform_name, const SBDebugger &debugger,
+ const char *script_name, const SBStructuredData &dict)
+ : SBPlatform(platform_name) {
+ LLDB_INSTRUMENT_VA(this, platform_name, debugger, script_name, dict);
+
+ if (!m_opaque_sp)
+ return;
+
+ if (!script_name || !dict.IsValid() || !dict.m_impl_up)
----------------
bulbazord wrote:
Problem: Exiting here with a valid `m_opaque_sp` means that the created `SBPlatform` will look valid, but it won't be the one you expect to get back. I would suggest creating a separate constructor that does not call another constructor (in case the base constructor succeeds) OR creating a static constructor method. That goes for every early return.
nit: Checking `!dict.m_impl_up` is going to be redundant right? We should always have an existing unique_ptr there.
https://github.com/llvm/llvm-project/pull/99814
More information about the lldb-commits
mailing list