diff options
Diffstat (limited to 'lldb/source/Commands/CommandObjectExpression.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectExpression.cpp | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp index 3f550883b29..25a88449c52 100644 --- a/lldb/source/Commands/CommandObjectExpression.cpp +++ b/lldb/source/Commands/CommandObjectExpression.cpp @@ -336,7 +336,14 @@ CommandObjectExpression::EvaluateExpression(const char *expr, else options.SetTimeoutUsec(0); - target->EvaluateExpression(expr, frame, result_valobj_sp, options); + ExpressionResults success = target->EvaluateExpression(expr, frame, result_valobj_sp, options, &m_fixed_expression); + + // We only tell you about the FixIt if we applied it. The compiler errors will suggest the FixIt if it parsed. + if (error_stream && !m_fixed_expression.empty() && target->GetEnableNotifyAboutFixIts()) + { + if (success == eExpressionCompleted) + error_stream->Printf (" Fixit applied, fixed expression was: \n %s\n", m_fixed_expression.c_str()); + } if (result_valobj_sp) { @@ -477,6 +484,7 @@ bool CommandObjectExpression::DoExecute(const char *command, CommandReturnObject &result) { + m_fixed_expression.clear(); m_option_group.NotifyOptionParsingStarting(); const char * expr = nullptr; @@ -598,7 +606,26 @@ CommandObjectExpression::DoExecute(const char *command, expr = command; if (EvaluateExpression (expr, &(result.GetOutputStream()), &(result.GetErrorStream()), &result)) + { + Target *target = m_interpreter.GetExecutionContext().GetTargetPtr(); + if (!m_fixed_expression.empty() && target->GetEnableNotifyAboutFixIts()) + { + CommandHistory &history = m_interpreter.GetCommandHistory(); + // FIXME: Can we figure out what the user actually typed (e.g. some alias for expr???) + // If we can it would be nice to show that. + std::string fixed_command("expression "); + if (expr == command) + fixed_command.append(m_fixed_expression); + else + { + // Add in any options that might have been in the original command: + fixed_command.append(command, expr - command); + fixed_command.append(m_fixed_expression); + } + history.AppendString(fixed_command); + } return true; + } result.SetStatus (eReturnStatusFailed); return false; |