[Lldb-commits] [lldb] [lldb] Add pointer arithmetics for addition and subtraction to DIL (PR #184652)

Michael Buch via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 13 01:36:43 PDT 2026


================
@@ -538,6 +538,29 @@ Interpreter::Visit(const UnaryOpNode &node) {
                                               node.GetLocation());
 }
 
+llvm::Expected<lldb::ValueObjectSP>
+Interpreter::PointerAdd(lldb::ValueObjectSP ptr, int64_t offset,
+                        uint32_t location) {
+  if (ptr->GetCompilerType().IsPointerToVoid())
+    return llvm::make_error<DILDiagnosticError>(
+        m_expr, "arithmetic on a pointer to void", location);
+  if (ptr->GetValueAsUnsigned(0) == 0 && offset != 0)
----------------
Michael137 wrote:

Why `offset != 0`? Is `nullptr + 0` allowed?

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


More information about the lldb-commits mailing list