[Lldb-commits] [PATCH] D147385: [lldb] Add fixits for "frame variable"

Dave Lee via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sat Apr 1 13:52:35 PDT 2023


kastiglione created this revision.
kastiglione added reviewers: aprantl, jingham, JDevlieghere, augusto2112.
Herald added a project: All.
kastiglione requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

The `frame variable` command can handle mistaken use of `.` for `->`, and vice versa,
but up until now it has been an error when the user makes such a mistake. This change
adds a flag to `frame variable` which allows these mistakes to be fixed. The idea is why
make the user manually edit the command if lldb can figure it out.

This is similar to `expression` which supports fixits supplied by the compiler, which
include correcting `.` to `->`, and vice versa.

There are a couple of details that differ slightly from `expression`:

1. The `--apply-fixits`/`-X` flag doesn't take a bool value, this matches the convention

used by many `frame variable` flags.

2. The fixed expression is printed, but there is no diagnostic message to draw attention

to the fix. I wasn't sure it was worth the noise, so I went with the simple approach.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147385

Files:
  lldb/include/lldb/Interpreter/OptionGroupVariable.h
  lldb/source/Commands/CommandObjectFrame.cpp
  lldb/source/Interpreter/OptionGroupVariable.cpp
  lldb/test/API/commands/frame/var/fixits/Makefile
  lldb/test/API/commands/frame/var/fixits/TestFrameVarApplyFixits.py
  lldb/test/API/commands/frame/var/fixits/main.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147385.510260.patch
Type: text/x-patch
Size: 6096 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230401/451afc86/attachment.bin>


More information about the lldb-commits mailing list