Unverified Commit 4c957761 authored by Jonas Devlieghere's avatar Jonas Devlieghere Committed by GitHub
Browse files

[lldb] Thread DWARFExpression::Evaluate state through an EvalContext (NFCI) (#195220)

Collect the inputs, derived pointers, and mutable evaluation state of
DWARFExpression::Evaluate into a file-local EvalContext struct passed by
reference to the static helpers.

Two incidental fixes making this not-quite NFC:

1. Evaluate_DW_OP_deref_size renamed to Evaluate_DW_OP_deref and takes
the LocationAtom, so error messages name the actual opcode.
2. ResolveLoadAddress no longer crashes on null exe_ctx (uses
eval_ctx.target, which is null-safe).

I initially prototyped a visitor-like design, centered around a
DWARFEvaluator class with one method per opcode and shared state as
members. I discarded it because moving the simple operations out of the
switch hurt readability and increased mental overhead. Its only real
benefit were the cleaner signatures, which this patch achives by using
the new EvalContext.
parent dd099bac
Loading
Loading
Loading
Loading
+231 −217

File changed.

Preview size limit exceeded, changes collapsed.