================
@@ -523,10 +528,43 @@ ValueObjectSP
StackFrame::GetValueForVariableExpressionPath(
ValueObjectSP StackFrame::DILGetValueForVariableExpressionPath(
llvm::StringRef var_expr, lldb::DynamicValueType use_dynamic,
uint32_t options, lldb::VariableSP &var_sp, Status &error) {
- // This is a place-holder for the calls into the DIL parser and
- // evaluator. For now, just call the "real" frame variable implementation.
- return LegacyGetValueForVariableExpressionPath(var_expr, use_dynamic,
options,
- var_sp, error);
+
+ const bool check_ptr_vs_member =
+ (options & eExpressionPathOptionCheckPtrVsMember) != 0;
+ const bool no_fragile_ivar =
+ (options & eExpressionPathOptionsNoFragileObjcIvar) != 0;
+ const bool no_synth_child =
+ (options & eExpressionPathOptionsNoSyntheticChildren) != 0;
+
+ // Lex the expression.
+ auto lex_or_err = dil::DILLexer::Create(var_expr);
+ if (!lex_or_err) {
+ error = Status::FromError(lex_or_err.takeError());
+ return ValueObjectSP();
+ }
+ dil::DILLexer &lexer = *lex_or_err;
+
+ // Parse the expression.
+ auto tree_or_error = dil::DILParser::Parse(
+ var_expr, lexer, shared_from_this(), use_dynamic, !no_synth_child,
----------------
labath wrote:
```suggestion
// Parse the expression.
auto tree_or_error = dil::DILParser::Parse(
var_expr, std::move(*lex_or_err), shared_from_this(), use_dynamic,
!no_synth_child,
```
If you want the parser to take ownership of the lexer (I recommend that).
Otherwise, you may want to change the interface to avoid copying the lexer
object (perhaps by passing a reference instead).
https://github.com/llvm/llvm-project/pull/120971
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits