[Lldb-commits] [lldb] [API] add GetSyntheticValue (PR #95959)

via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 18 10:41:14 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Vincent Belliard (v-bulle)

<details>
<summary>Changes</summary>

Adds GetSyntheticValue to the API on top of GetNonSyntheticValue.

---
Full diff: https://github.com/llvm/llvm-project/pull/95959.diff


2 Files Affected:

- (modified) lldb/include/lldb/API/SBValue.h (+2) 
- (modified) lldb/source/API/SBValue.cpp (+12) 


``````````diff
diff --git a/lldb/include/lldb/API/SBValue.h b/lldb/include/lldb/API/SBValue.h
index 65920c76df7a8..bec816fb45184 100644
--- a/lldb/include/lldb/API/SBValue.h
+++ b/lldb/include/lldb/API/SBValue.h
@@ -89,6 +89,8 @@ class LLDB_API SBValue {
 
   lldb::SBValue GetNonSyntheticValue();
 
+  lldb::SBValue GetSyntheticValue();
+
   lldb::DynamicValueType GetPreferDynamicValue();
 
   void SetPreferDynamicValue(lldb::DynamicValueType use_dynamic);
diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp
index 9d7efba024d11..6b77c0e95cedd 100644
--- a/lldb/source/API/SBValue.cpp
+++ b/lldb/source/API/SBValue.cpp
@@ -761,6 +761,18 @@ lldb::SBValue SBValue::GetNonSyntheticValue() {
   return value_sb;
 }
 
+lldb::SBValue SBValue::GetSyntheticValue() {
+  LLDB_INSTRUMENT_VA(this);
+
+  SBValue value_sb;
+  if (IsValid()) {
+    ValueImplSP proxy_sp(new ValueImpl(m_opaque_sp->GetRootSP(),
+                                       m_opaque_sp->GetUseDynamic(), true));
+    value_sb.SetSP(proxy_sp);
+  }
+  return value_sb;
+}
+
 lldb::DynamicValueType SBValue::GetPreferDynamicValue() {
   LLDB_INSTRUMENT_VA(this);
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/95959


More information about the lldb-commits mailing list