[Lldb-commits] [lldb] fe5cb1c - Revert "[lldb] Make Fix-Its also apply to top-level expressions"
Davide Italiano via lldb-commits
lldb-commits at lists.llvm.org
Mon Mar 30 13:38:18 PDT 2020
Author: Davide Italiano
Date: 2020-03-30T13:23:58-07:00
New Revision: fe5cb1c25fd6c07bbe3c0c698f36b74e6d04946f
URL: https://github.com/llvm/llvm-project/commit/fe5cb1c25fd6c07bbe3c0c698f36b74e6d04946f
DIFF: https://github.com/llvm/llvm-project/commit/fe5cb1c25fd6c07bbe3c0c698f36b74e6d04946f.diff
LOG: Revert "[lldb] Make Fix-Its also apply to top-level expressions"
This reverts commit 83c81c0a469482888482983c302c09c02680ae7c as
it broke the macOS lldb bots.
Added:
Modified:
lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
lldb/test/API/commands/expression/fixits/TestFixIts.py
Removed:
################################################################################
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
index 2b75c4f75c63..b246fc374d1c 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
@@ -616,14 +616,15 @@ bool ClangUserExpression::Parse(DiagnosticManager &diagnostic_manager,
if (parser.RewriteExpression(diagnostic_manager)) {
size_t fixed_start;
size_t fixed_end;
- m_fixed_text = diagnostic_manager.GetFixedExpression();
+ const std::string &fixed_expression =
+ diagnostic_manager.GetFixedExpression();
// Retrieve the original expression in case we don't have a top level
// expression (which has no surrounding source code).
if (m_source_code &&
- m_source_code->GetOriginalBodyBounds(m_fixed_text, m_expr_lang,
+ m_source_code->GetOriginalBodyBounds(fixed_expression, m_expr_lang,
fixed_start, fixed_end))
m_fixed_text =
- m_fixed_text.substr(fixed_start, fixed_end - fixed_start);
+ fixed_expression.substr(fixed_start, fixed_end - fixed_start);
}
}
return false;
diff --git a/lldb/test/API/commands/expression/fixits/TestFixIts.py b/lldb/test/API/commands/expression/fixits/TestFixIts.py
index eb1dd97aa9a9..273982c0c12f 100644
--- a/lldb/test/API/commands/expression/fixits/TestFixIts.py
+++ b/lldb/test/API/commands/expression/fixits/TestFixIts.py
@@ -33,10 +33,6 @@ def test_with_target(self):
options = lldb.SBExpressionOptions()
options.SetAutoApplyFixIts(True)
- top_level_options = lldb.SBExpressionOptions()
- top_level_options.SetAutoApplyFixIts(True)
- top_level_options.SetTopLevel(True)
-
frame = self.thread.GetFrameAtIndex(0)
# Try with one error:
@@ -45,15 +41,6 @@ def test_with_target(self):
self.assertTrue(value.GetError().Success())
self.assertEquals(value.GetValueAsUnsigned(), 10)
- # Try with one error in a top-level expression.
- # The Fix-It changes "ptr.m" to "ptr->m".
- expr = "struct X { int m; }; X x; X *ptr = &x; int m = ptr.m;"
- value = frame.EvaluateExpression(expr, top_level_options)
- # A successfully parsed top-level expression will yield an error
- # that there is 'no value'. If a parsing error would have happened we
- # would get a
diff erent error kind, so let's check the error kind here.
- self.assertEquals(value.GetError().GetCString(), "error: No value")
-
# Try with two errors:
two_error_expression = "my_pointer.second->a"
value = frame.EvaluateExpression(two_error_expression, options)
More information about the lldb-commits
mailing list