[Lldb-commits] [lldb] [lldb] Evaluate exprloc array bounds (PR #204119)

Adrian Prantl via lldb-commits lldb-commits at lists.llvm.org
Thu Jul 9 13:48:47 PDT 2026


================
@@ -21,6 +27,49 @@ using namespace lldb_private;
 using namespace lldb_private::plugin::dwarf;
 using namespace llvm::dwarf;
 
+static std::optional<uint64_t>
+EvaluateUnsignedArrayProperty(const DWARFFormValue &form_value,
+                              const DWARFDIE &parent_die,
+                              const ExecutionContext *exe_ctx) {
+  // Array properties may be encoded directly as constants.
+  if (std::optional<uint64_t> value = form_value.getAsUnsignedConstant())
+    return value;
+  if (std::optional<int64_t> value = form_value.getAsSignedConstant())
+    if (*value >= 0)
+      return *value;
----------------
adrian-prantl wrote:

It might be nice to return Expected<> and a targeted StringError for the negative case here

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


More information about the lldb-commits mailing list