Use Clang's FixItHints to correct expressions with "trivial" mistakes (e.g. "." for "->".)
This feature is controlled by an expression command option, a target property and the
SBExpressionOptions setting. FixIt's are only applied to UserExpressions, not UtilityFunctions,
those you have to get right when you make them.
This is just a first stage. At present the fixits are applied silently. The next step
is to tell the user about the applied fixit.
<rdar://problem/25351938>
llvm-svn: 264379
diff --git a/lldb/source/Expression/DiagnosticManager.cpp b/lldb/source/Expression/DiagnosticManager.cpp
index 8b78868..e0a5c49 100644
--- a/lldb/source/Expression/DiagnosticManager.cpp
+++ b/lldb/source/Expression/DiagnosticManager.cpp
@@ -52,10 +52,10 @@
{
std::string ret;
- for (const Diagnostic &diagnostic : Diagnostics())
+ for (const Diagnostic *diagnostic : Diagnostics())
{
- ret.append(StringForSeverity(diagnostic.severity));
- ret.append(diagnostic.message);
+ ret.append(StringForSeverity(diagnostic->GetSeverity()));
+ ret.append(diagnostic->GetMessage());
ret.push_back(separator);
}
diff --git a/lldb/source/Expression/UserExpression.cpp b/lldb/source/Expression/UserExpression.cpp
index 6f637b1..2d1336b 100644
--- a/lldb/source/Expression/UserExpression.cpp
+++ b/lldb/source/Expression/UserExpression.cpp
@@ -253,6 +253,7 @@
}
DiagnosticManager diagnostic_manager;
+ diagnostic_manager.SetAutoApplyFixIts(options.GetAutoApplyFixIts());
if (!user_expression_sp->Parse(diagnostic_manager, exe_ctx, execution_policy, keep_expression_in_memory,
generate_debug_info))