================ @@ -111,7 +111,42 @@ ASTNodeUP DILParser::ParseUnaryExpression() { llvm_unreachable("invalid token kind"); } } - return ParsePrimaryExpression(); + return ParsePostfixExpression(); +} + +// Parse a postfix_expression. +// +// postfix_expression: +// primary_expression +// postfix_expression "[" integer_literal "]" +// +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: { + m_dil_lexer.Advance(); + auto rhs = ParseIntegerConstant(); ---------------- labath wrote:
LLVM generally has a very cautious stance towards auto: https://llvm.org/docs/CodingStandards.html#use-auto-type-deduction-to-make-code-more-readable In this case, the type of rhs is not obvious from the immediate, and for the correctness of the code, it is important to know whether the function returns `int`, `optional<int>`, `Expected<int>` or something else. https://github.com/llvm/llvm-project/pull/138551 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits