summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands/CommandObjectExpression.cpp
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2016-03-29 22:00:08 +0000
committerJim Ingham <jingham@apple.com>2016-03-29 22:00:08 +0000
commite5ee6f04ab2a5fb162454a5b9ccc968c3c9105f1 (patch)
treec4eeebf3b9e4af20d71ce73b89b59ec550b460cc /lldb/source/Commands/CommandObjectExpression.cpp
parentbd54f5bd2558c8763ce7159e6841222576707961 (diff)
downloadbcm5719-llvm-e5ee6f04ab2a5fb162454a5b9ccc968c3c9105f1.tar.gz
bcm5719-llvm-e5ee6f04ab2a5fb162454a5b9ccc968c3c9105f1.zip
Figure out what the fixed expression is, and print it. Added another target setting to
quietly apply fixits for those who really trust clang's fixits. Also, moved the retry into ClangUserExpression::Evaluate, where I can make a whole new ClangUserExpression to do the work. Reusing any of the parts of a UserExpression in situ isn't supported at present. <rdar://problem/25351938> llvm-svn: 264793
Diffstat (limited to 'lldb/source/Commands/CommandObjectExpression.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectExpression.cpp29
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;
OpenPOWER on IntegriCloud