Author: AlexErofeev Date: 2024-11-29T14:04:25+08:00 New Revision: 18760ce0fd811140fe6cb9a01b766d73bb50bf4d
URL: https://github.com/llvm/llvm-project/commit/18760ce0fd811140fe6cb9a01b766d73bb50bf4d DIFF: https://github.com/llvm/llvm-project/commit/18760ce0fd811140fe6cb9a01b766d73bb50bf4d.diff LOG: [Clang][AST] Fix PackIndexingExpr AST printout (#117947) Fixes #116486 Also added a test Added: clang/test/AST/ast-print-packindexingexpr.cpp Modified: clang/docs/ReleaseNotes.rst clang/lib/AST/StmtPrinter.cpp Removed: ################################################################################ diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 601a233b81904f..758a08e6309360 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -771,6 +771,7 @@ Bug Fixes to AST Handling and ``relatedalso`` comment commands. - Clang now uses the location of the begin of the member expression for ``CallExpr`` involving deduced ``this``. (#GH116928) +- Fixed printout of AST that uses pack indexing expression. (#GH116486) Miscellaneous Bug Fixes ^^^^^^^^^^^^^^^^^^^^^^^ 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