[Lldb-commits] [lldb] [LLDB] Add unary operators Dereference and AddressOf to DIL (PR #134428)

Ilia Kuklin via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 14 07:02:55 PDT 2025


================
@@ -18,6 +18,22 @@
 
 namespace lldb_private::dil {
 
+static lldb::ValueObjectSP
+ArrayToPointerConversion(lldb::ValueObjectSP valobj,
+                         std::shared_ptr<ExecutionContextScope> ctx) {
+  assert(valobj->IsArrayType() &&
+         "an argument to array-to-pointer conversion must be an array");
+
+  uint64_t addr = valobj->GetLoadAddress();
+  llvm::StringRef name = "result";
+  ExecutionContext exe_ctx;
+  ctx->CalculateExecutionContext(exe_ctx);
+  return ValueObject::CreateValueObjectFromAddress(
+      name, addr, exe_ctx,
+      valobj->GetCompilerType().GetArrayElementType(ctx.get()).GetPointerType(),
+      /* do_deref */ false);
+}
+
----------------
kuilpd wrote:

Should I make a separate PR and merge this one as is?
As I understand, I should make a `CompilerType::Dereference` function that calls `TypeSystem::Dereference` that will be implemented in `TypeSystemClang`? And then call that function from `ValueObject::Dereference` instead of `GetChildCompilerTypeAtIndex`, but without type checks beforehand.

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


More information about the lldb-commits mailing list