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

Michael Buch via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 29 04:53:48 PDT 2025


================
@@ -80,15 +82,62 @@ ASTNodeUP DILParser::Run() {
 // Parse an expression.
 //
 //  expression:
-//    unary_expression
+//    cast_expression
 //
-ASTNodeUP DILParser::ParseExpression() { return ParseUnaryExpression(); }
+ASTNodeUP DILParser::ParseExpression() { return ParseCastExpression(); }
+
+// Parse a cast_expression.
+//
+// cast_expression:
+//   unary_expression
+//   "(" type_id ")" cast_expression
+
+ASTNodeUP DILParser::ParseCastExpression() {
+  // This can be a C-style cast, try parsing the contents as a type declaration.
+  if (CurToken().Is(Token::l_paren)) {
----------------
Michael137 wrote:

Can we do use early-return style here?

```suggestion
  if (!CurToken().Is(Token::l_paren))
    return ParseUnaryExpression();
    
  ...
```

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


More information about the lldb-commits mailing list