[Lldb-commits] [lldb] [lldb] Fix `po` alias by printing fix-its to the console. (PR #68452)

2023-10-08 Thread Adrian Prantl via lldb-commits


@@ -172,8 +172,18 @@ bool CommandObjectDWIMPrint::DoExecute(StringRef command,
   {
 auto *exe_scope = m_exe_ctx.GetBestExecutionContextScope();
 ValueObjectSP valobj_sp;
-ExpressionResults expr_result =
-target.EvaluateExpression(expr, exe_scope, valobj_sp, eval_options);
+ExpressionResults expr_result = target.EvaluateExpression(
+expr, exe_scope, valobj_sp, eval_options, &m_fixed_expression);
+
+// Only mention Fix-Its if the command applies them.
+// The compiler errors can address any parsing issues after applying
+// Fix-It(s).
+if (!m_fixed_expression.empty() && target.GetEnableNotifyAboutFixIts()) {
+  Stream &error_stream = result.GetErrorStream();
+  error_stream << "  Applying Fix-It to expression, changing it to:\n";
+  error_stream << "" << m_fixed_expression << "\n";

adrian-prantl wrote:

I think this could be a useful thing to look at unifying in a follow-up patch.

https://github.com/llvm/llvm-project/pull/68452
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Fix `po` alias by printing fix-its to the console. (PR #68452)

2023-10-08 Thread Adrian Prantl via lldb-commits


@@ -173,7 +173,16 @@ bool CommandObjectDWIMPrint::DoExecute(StringRef command,
 auto *exe_scope = m_exe_ctx.GetBestExecutionContextScope();
 ValueObjectSP valobj_sp;
 ExpressionResults expr_result =
-target.EvaluateExpression(expr, exe_scope, valobj_sp, eval_options);
+target.EvaluateExpression(expr, exe_scope, valobj_sp, eval_options, 
&m_fixed_expression);
+
+// Only mention Fix-Its if the command applies them.
+// The compiler errors can address any parsing issues after applying 
Fix-It(s).

adrian-prantl wrote:

Ah! The original comment makes more sense: I *think* what it's trying to say is:

LLDB only displays fixits if the expression evaluator applied them. Any 
compiler diagnostics LLDB displays refer to the modified expression with the 
fixit applied.

https://github.com/llvm/llvm-project/pull/68452
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits