[all-commits] [llvm/llvm-project] 203a8a: [lldb] Add option to retry Fix-Its multiple times ...

Raphael Isemann via All-commits all-commits at lists.llvm.org
Mon Apr 6 02:26:00 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 203a8adb65429ec6b8989afdf5956564972b9703
      https://github.com/llvm/llvm-project/commit/203a8adb65429ec6b8989afdf5956564972b9703
  Author: Raphael Isemann <teemperor at gmail.com>
  Date:   2020-04-06 (Mon, 06 Apr 2020)

  Changed paths:
    M lldb/bindings/interface/SBExpressionOptions.i
    M lldb/include/lldb/API/SBExpressionOptions.h
    M lldb/include/lldb/Target/Target.h
    M lldb/source/API/SBExpressionOptions.cpp
    M lldb/source/Commands/CommandObjectExpression.cpp
    M lldb/source/Expression/UserExpression.cpp
    M lldb/source/Target/Target.cpp
    M lldb/source/Target/TargetProperties.td
    M lldb/test/API/commands/expression/fixits/TestFixIts.py

  Log Message:
  -----------
  [lldb] Add option to retry Fix-Its multiple times to failed expressions

Summary:
Usually when Clang emits an error Fix-It it does two things. It emits the diagnostic and then it fixes the
currently generated AST to reflect the applied Fix-It. While emitting the diagnostic is easy to implement,
fixing the currently generated AST is often tricky. That causes that some Fix-Its just keep the AST as-is or
abort the parsing process entirely. Once the parser stopped, any Fix-Its for the rest of the expression are
not detected and when the user manually applies the Fix-It, the next expression will just produce a new
Fix-It.

This is often occurring with quickly made Fix-Its that are just used to bridge temporary API changes
and that often are not worth implementing a proper API fixup in addition to the diagnostic. To still
give some kind of reasonable user-experience for users that have these Fix-Its and rely on them to
fix their expressions, this patch adds the ability to retry parsing with applied Fix-Its multiple time to
give the normal Fix-It experience where things Clang knows how to fix are not causing actual expression
error (at least when automatically applying Fix-Its is activated).

The way this is implemented is just by having another setting in the expression options that specify how
often we should try applying Fix-Its and then reparse the expression. The default setting is still 1 for everyone
so this should not affect the speed in which we fail to parse expressions.

Reviewers: jingham, JDevlieghere, friss, shafik

Reviewed By: shafik

Subscribers: shafik, abidh

Differential Revision: https://reviews.llvm.org/D77214




More information about the All-commits mailing list