https://github.com/AlexErofeev created https://github.com/llvm/llvm-project/pull/117947
Fixes #116486 Also added regression unit test >From b3f7e8bda1bd38ef9bf5794ed4a6cece2ef77621 Mon Sep 17 00:00:00 2001 From: Aleksandr Erofeev <a.p.erof...@gmail.com> Date: Thu, 28 Nov 2024 00:19:06 +0000 Subject: [PATCH] Fix PackIndexingExpr AST printout --- clang/lib/AST/StmtPrinter.cpp | 5 ++++- clang/test/AST/ast-print-packindexingexpr.cpp | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 clang/test/AST/ast-print-packindexingexpr.cpp diff --git a/clang/lib/AST/StmtPrinter.cpp b/clang/lib/AST/StmtPrinter.cpp index c8677d11b64e8d..7507c9d14327a0 100644 --- a/clang/lib/AST/StmtPrinter.cpp +++ b/clang/lib/AST/StmtPrinter.cpp @@ -2514,7 +2514,10 @@ void StmtPrinter::VisitSizeOfPackExpr(SizeOfPackExpr *E) { } void StmtPrinter::VisitPackIndexingExpr(PackIndexingExpr *E) { - OS << E->getPackIdExpression() << "...[" << E->getIndexExpr() << "]"; + PrintExpr(E->getPackIdExpression()); + OS << "...["; + PrintExpr(E->getIndexExpr()); + OS << "]"; } void StmtPrinter::VisitSubstNonTypeTemplateParmPackExpr( diff --git a/clang/test/AST/ast-print-packindexingexpr.cpp b/clang/test/AST/ast-print-packindexingexpr.cpp new file mode 100644 index 00000000000000..157abeb99436a2 --- /dev/null +++ b/clang/test/AST/ast-print-packindexingexpr.cpp @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -ast-print -std=c++2c %s | FileCheck %s + +template <class... T, unsigned N> +auto foo(T ...params) { + return params...[N]; +} + +// CHECK: template <class ...T, unsigned int N> auto foo(T ...params) { +// CHECK-NEXT: return params...[N]; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits