Skip to content

Commit 87bebd3

Browse files
authored
[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.
1 parent 200b589 commit 87bebd3

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lldb/source/Interpreter/CommandInterpreter.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1886,6 +1886,13 @@ bool CommandInterpreter::HandleCommand(const char *command_line,
18861886
LazyBool lazy_add_to_history,
18871887
CommandReturnObject &result,
18881888
bool force_repeat_command) {
1889+
// These are assigned later in the function but they must be declared before
1890+
// the ScopedDispatcher object because we need their destructions to occur
1891+
// after the dispatcher's dtor call, which may reference them.
1892+
// TODO: This function could be refactored?
1893+
std::string parsed_command_args;
1894+
CommandObject *cmd_obj = nullptr;
1895+
18891896
telemetry::ScopedDispatcher<telemetry::CommandInfo> helper(&m_debugger);
18901897
const bool detailed_command_telemetry =
18911898
telemetry::TelemetryManager::GetInstance()
@@ -1896,8 +1903,6 @@ bool CommandInterpreter::HandleCommand(const char *command_line,
18961903
std::string command_string(command_line);
18971904
std::string original_command_string(command_string);
18981905
std::string real_original_command_string(command_string);
1899-
std::string parsed_command_args;
1900-
CommandObject *cmd_obj = nullptr;
19011906

19021907
helper.DispatchNow([&](lldb_private::telemetry::CommandInfo *info) {
19031908
info->command_id = command_id;

0 commit comments

Comments
 (0)