[Lldb-commits] [lldb] [LLDB] Add type casting to DIL, part 1 of 3. (PR #165199)

Ilia Kuklin via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 4 08:12:41 PST 2025


================
@@ -608,4 +608,16 @@ Interpreter::Visit(const BooleanLiteralNode *node) {
   return ValueObject::CreateValueObjectFromBool(m_target, value, "result");
 }
 
+llvm::Expected<lldb::ValueObjectSP>
+Interpreter::Visit(const CStyleCastNode *node) {
+  auto operand_or_err = Evaluate(node->GetOperand());
+  if (!operand_or_err)
+    return operand_or_err;
+
+  lldb::ValueObjectSP operand = *operand_or_err;
+  // Don't actually do the cast for now -- that code will be added later.
+  // For now just return the original operand, unchanged.
+  return operand;
----------------
kuilpd wrote:

It's just since `frame var` implementation is used for expression evaluation in lldb-dap, if a user writes an expression with a cast, but DIL doesn't do it and returns some value, that will be a wrong value the user didn't expect. If DIL returns an error, the calling code will instead use a full expression evaluator. For now we can just return the same parser error as before this patch, to avoid confusing people who might read the error message,

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


More information about the lldb-commits mailing list