[Lldb-commits] [lldb] [LLDB] Add array subscription and integer parsing to DIL (PR #138551)

Ilia Kuklin via lldb-commits lldb-commits at lists.llvm.org
Tue May 6 11:46:08 PDT 2025


================
@@ -111,7 +111,36 @@ ASTNodeUP DILParser::ParseUnaryExpression() {
       llvm_unreachable("invalid token kind");
     }
   }
-  return ParsePrimaryExpression();
+  return ParsePostfixExpression();
+}
+
+// Parse a postfix_expression.
+//
+//  postfix_expression:
+//    primary_expression
+//    postfix_expression "[" expression "]"
+//
+ASTNodeUP DILParser::ParsePostfixExpression() {
+  ASTNodeUP lhs = ParsePrimaryExpression();
+  while (CurToken().Is(Token::l_square)) {
+    uint32_t loc = CurToken().GetLocation();
+    Token token = CurToken();
+    switch (token.GetKind()) {
+    case Token::l_square: {
----------------
kuilpd wrote:

This is for when other postfix expressions get added here, `.` and `->` from the other PR.

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


More information about the lldb-commits mailing list