[Lldb-commits] [lldb] [lldb] Make ValueObject::Dereference less aggressive (PR #137311)
Ilia Kuklin via lldb-commits
lldb-commits at lists.llvm.org
Fri Apr 25 12:10:38 PDT 2025
================
@@ -2202,6 +2202,45 @@ void ValueObject::GetExpressionPath(Stream &s,
}
}
+// Return the alternate value (synthetic if the input object is non-synthetic
+// and otherwise) this is permitted by the expression path options.
+static ValueObjectSP GetAlternateValue(
+ ValueObject &valobj,
+ ValueObject::GetValueForExpressionPathOptions::SyntheticChildrenTraversal
+ synth_traversal) {
+ using SynthTraversal =
+ ValueObject::GetValueForExpressionPathOptions::SyntheticChildrenTraversal;
+
+ if (valobj.IsSynthetic()) {
+ if (synth_traversal == SynthTraversal::FromSynthetic ||
+ synth_traversal == SynthTraversal::Both)
+ return valobj.GetNonSyntheticValue();
+ } else {
+ if (synth_traversal == SynthTraversal::ToSynthetic ||
+ synth_traversal == SynthTraversal::Both)
+ return valobj.GetSyntheticValue();
+ }
+ return nullptr;
+}
+
+// Dereference the provided object or the alternate value, ir permitted by the
----------------
kuilpd wrote:
```suggestion
// Dereference the provided object or the alternate value, if permitted by the
```
https://github.com/llvm/llvm-project/pull/137311
More information about the lldb-commits
mailing list