aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectExpression.cpp
diff options
context:
space:
mode:
authorRaphael Isemann <teemperor@gmail.com>2020-04-06 11:08:12 +0200
committerRaphael Isemann <teemperor@gmail.com>2020-04-06 11:25:36 +0200
commit203a8adb65429ec6b8989afdf5956564972b9703 (patch)
treec16b017d9020789b266ad06ee658a19c0e396f7d /lldb/source/Commands/CommandObjectExpression.cpp
parent944e322f88971b23ea73c0b019f1493d4c377f6f (diff)
downloadllvm-203a8adb65429ec6b8989afdf5956564972b9703.zip
llvm-203a8adb65429ec6b8989afdf5956564972b9703.tar.gz
llvm-203a8adb65429ec6b8989afdf5956564972b9703.tar.bz2
[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
Diffstat (limited to 'lldb/source/Commands/CommandObjectExpression.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectExpression.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp
index 9a314c2..7cec714 100644
--- a/lldb/source/Commands/CommandObjectExpression.cpp
+++ b/lldb/source/Commands/CommandObjectExpression.cpp
@@ -385,6 +385,7 @@ CommandObjectExpression::GetEvalOptions(const Target &target) {
auto_apply_fixits = m_command_options.auto_apply_fixits == eLazyBoolYes;
options.SetAutoApplyFixIts(auto_apply_fixits);
+ options.SetRetriesWithFixIts(target.GetNumberOfRetriesWithFixits());
if (m_command_options.top_level)
options.SetExecutionPolicy(eExecutionPolicyTopLevel);