[Lldb-commits] [lldb] [LLDB][NFC] Added the interface DWARFExpression::Delegate to break dependencies and reduce lldb-server size (PR #131645)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 21 03:30:42 PDT 2025


================
@@ -40,6 +35,31 @@ class DWARFUnit;
 /// location expression or a location list and interprets it.
 class DWARFExpression {
 public:
+  class Delegate {
+  public:
+    Delegate() = default;
+    virtual ~Delegate() = default;
+
+    virtual uint16_t GetVersion() const = 0;
+    virtual dw_addr_t GetBaseAddress() const = 0;
+    virtual uint8_t GetAddressByteSize() const = 0;
+    virtual llvm::Error GetDIEBitSizeAndSign(uint64_t die_offset,
+                                             uint64_t &bit_size,
+                                             bool &sign) = 0;
----------------
labath wrote:

```suggestion
    virtual llvm::Expected<std::pair<uint64_t, bool>> GetDIEBitSizeAndSign(uint64_t relative_die_offset) const = 0;
```

(I'm prioritizing the interface over implementation, so I'm making the method const. You can put the const_cast into the implementation (I think it's only needed for `GetDIE`. I am also emphasizing the relativeness of the die offset as lldb default is to use absolute section offsets)

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


More information about the lldb-commits mailing list