[clang] [clang] Do not substitute parameter pack while retaining the pack expansion (PR #108197)
Utkarsh Saxena via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 11 05:00:14 PDT 2024
https://github.com/usx95 updated https://github.com/llvm/llvm-project/pull/108197
>From 5901d82ea0543074853b963f7dc9106a6fe3bcee Mon Sep 17 00:00:00 2001
From: Utkarsh Saxena <usx at google.com>
Date: Wed, 11 Sep 2024 11:33:45 +0000
Subject: [PATCH 1/2] [clang] Do not expand pack while retaining expansion
---
clang/lib/Sema/TreeTransform.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h
index 0daf620b4123e4..a40673b04764da 100644
--- a/clang/lib/Sema/TreeTransform.h
+++ b/clang/lib/Sema/TreeTransform.h
@@ -4361,7 +4361,7 @@ bool TreeTransform<Derived>::TransformExprs(Expr *const *Inputs,
// forgetting the partially-substituted parameter pack.
if (RetainExpansion) {
ForgetPartiallySubstitutedPackRAII Forget(getDerived());
-
+ Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
ExprResult Out = getDerived().TransformExpr(Pattern);
if (Out.isInvalid())
return true;
>From 97fbf34c3edd09348fb48b4dc66f1d854516e8ef Mon Sep 17 00:00:00 2001
From: Utkarsh Saxena <usx at google.com>
Date: Wed, 11 Sep 2024 11:59:58 +0000
Subject: [PATCH 2/2] Add comment
---
clang/lib/Sema/TreeTransform.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h
index a40673b04764da..0de43d2127b12f 100644
--- a/clang/lib/Sema/TreeTransform.h
+++ b/clang/lib/Sema/TreeTransform.h
@@ -4361,6 +4361,7 @@ bool TreeTransform<Derived>::TransformExprs(Expr *const *Inputs,
// forgetting the partially-substituted parameter pack.
if (RetainExpansion) {
ForgetPartiallySubstitutedPackRAII Forget(getDerived());
+ // Simple transform producing another pack expansion.
Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), -1);
ExprResult Out = getDerived().TransformExpr(Pattern);
if (Out.isInvalid())
More information about the cfe-commits
mailing list