diff options
author | Vy Nguyen <vyng@google.com> | 2025-04-02 10:19:12 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-02 10:19:12 -0400 |
commit | 87bebd37ffe08c4911d9636ab09cb1406d7ac677 (patch) | |
tree | 973b83c7e3cef46ea91704476364689d21b61001 /lldb/source/Interpreter/CommandInterpreter.cpp | |
parent | 200b589a1b3a0e12cd9950a897949f3e89534929 (diff) | |
download | llvm-87bebd37ffe08c4911d9636ab09cb1406d7ac677.zip llvm-87bebd37ffe08c4911d9636ab09cb1406d7ac677.tar.gz llvm-87bebd37ffe08c4911d9636ab09cb1406d7ac677.tar.bz2 |
[LLDB][NFC]Move fields that might be referenced in scope-exit to beginning (#133785)
Details: The ScopedDiscpatcher's dtor may reference these fields so we
need the fields' dtor to be be invoked *after* the dispatcher's.
Diffstat (limited to 'lldb/source/Interpreter/CommandInterpreter.cpp')
-rw-r--r-- | lldb/source/Interpreter/CommandInterpreter.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index e0bf552..949b119 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -1886,6 +1886,13 @@ bool CommandInterpreter::HandleCommand(const char *command_line, LazyBool lazy_add_to_history, CommandReturnObject &result, bool force_repeat_command) { + // These are assigned later in the function but they must be declared before + // the ScopedDispatcher object because we need their destructions to occur + // after the dispatcher's dtor call, which may reference them. + // TODO: This function could be refactored? + std::string parsed_command_args; + CommandObject *cmd_obj = nullptr; + telemetry::ScopedDispatcher<telemetry::CommandInfo> helper(&m_debugger); const bool detailed_command_telemetry = telemetry::TelemetryManager::GetInstance() @@ -1896,8 +1903,6 @@ bool CommandInterpreter::HandleCommand(const char *command_line, std::string command_string(command_line); std::string original_command_string(command_string); std::string real_original_command_string(command_string); - std::string parsed_command_args; - CommandObject *cmd_obj = nullptr; helper.DispatchNow([&](lldb_private::telemetry::CommandInfo *info) { info->command_id = command_id; |