aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectExpression.cpp
diff options
context:
space:
mode:
authorPete Lawrence <plawrence@apple.com>2023-10-13 07:06:50 -1000
committerGitHub <noreply@github.com>2023-10-13 10:06:50 -0700
commit8e2bd05c4e86834a318ef2279e271f0769be4988 (patch)
tree79171206ff05f1db00d310775442021695056633 /lldb/source/Commands/CommandObjectExpression.cpp
parentbbecd422a9bf5423109a754ba3417451946027a7 (diff)
downloadllvm-8e2bd05c4e86834a318ef2279e271f0769be4988.zip
llvm-8e2bd05c4e86834a318ef2279e271f0769be4988.tar.gz
llvm-8e2bd05c4e86834a318ef2279e271f0769be4988.tar.bz2
[lldb] Fix `po` alias by printing fix-its to the console. (#68755)
The `po` alias now matches the behavior of the `expression` command when the it can apply a Fix-It to an expression. Modifications - Add has `m_fixed_expression` to the `CommandObjectDWIMPrint` class a `protected` member that stores the post Fix-It expression, just like the `CommandObjectExpression` class. - Converted messages to present tense. - Add test cases that confirms a Fix-It for a C++ expression for both `po` and `expressions` rdar://115317419
Diffstat (limited to 'lldb/source/Commands/CommandObjectExpression.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectExpression.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp
index e7e6e38..2834be6 100644
--- a/lldb/source/Commands/CommandObjectExpression.cpp
+++ b/lldb/source/Commands/CommandObjectExpression.cpp
@@ -439,11 +439,11 @@ bool CommandObjectExpression::EvaluateExpression(llvm::StringRef expr,
ExpressionResults success = target.EvaluateExpression(
expr, frame, result_valobj_sp, eval_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.
+ // Only mention Fix-Its if the expression evaluator applied them.
+ // Compiler errors refer to the final expression after applying Fix-It(s).
if (!m_fixed_expression.empty() && target.GetEnableNotifyAboutFixIts()) {
- error_stream.Printf(" Fix-it applied, fixed expression was: \n %s\n",
- m_fixed_expression.c_str());
+ error_stream << " Evaluated this expression after applying Fix-It(s):\n";
+ error_stream << " " << m_fixed_expression << "\n";
}
if (result_valobj_sp) {