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

Ilia Kuklin via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 13 07:09:26 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)
----------------
kuilpd wrote:

Just a C++ rule, I figured might as well allow it.
http://www.eel.is/c%2b%2bdraft/expr.add#4.1

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


More information about the lldb-commits mailing list