[Lldb-commits] [lldb] [LLDB] Add array subscription and integer parsing to DIL (PR #138551)

Ilia Kuklin via lldb-commits lldb-commits at lists.llvm.org
Thu May 15 10:39:50 PDT 2025


================
@@ -272,4 +272,67 @@ Interpreter::Visit(const UnaryOpNode *node) {
       m_expr, "invalid ast: unexpected binary operator", node->GetLocation());
 }
 
+llvm::Expected<lldb::ValueObjectSP>
+Interpreter::Visit(const ArraySubscriptNode *node) {
+  auto lhs_or_err = Evaluate(node->GetBase());
+  if (!lhs_or_err) {
+    return lhs_or_err;
+  }
+  lldb::ValueObjectSP base = *lhs_or_err;
+  const llvm::APInt *index = node->GetIndex();
+
+  Status error;
+  if (base->GetCompilerType().IsReferenceType()) {
+    base = base->Dereference(error);
+    if (error.Fail())
+      return error.ToError();
+  }
----------------
kuilpd wrote:

It was for type checks later, I forgot that there is a `GetNonReferenceType()`.

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


More information about the lldb-commits mailing list