aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/TreeTransform.h
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2011-07-06 07:30:07 +0000
committerJohn McCall <rjmccall@apple.com>2011-07-06 07:30:07 +0000
commitc8fc90a854b4ccba21c85884676a80334159dd94 (patch)
treeef5ec11fad205975fcf3edf0143f07585e6e594b /lib/Sema/TreeTransform.h
parent9dc71d2fddcd283e07d45f3894c8559e2f7dd9a7 (diff)
When tree-transforming an expression sequence, always flag expanded
variadic argument pack expansions as having changed, rather than doing it for each changed expansion, which leaves out zero-argument packs with catastrophic consequences. Fixes PR10260. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134483 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/TreeTransform.h')
-rw-r--r--lib/Sema/TreeTransform.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h
index edbf1fb459..66ea7df4ee 100644
--- a/lib/Sema/TreeTransform.h
+++ b/lib/Sema/TreeTransform.h
@@ -1547,9 +1547,9 @@ public:
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
ExprResult RebuildInitList(SourceLocation LBraceLoc,
- MultiExprArg Inits,
- SourceLocation RBraceLoc,
- QualType ResultTy) {
+ MultiExprArg Inits,
+ SourceLocation RBraceLoc,
+ QualType ResultTy) {
ExprResult Result
= SemaRef.ActOnInitList(LBraceLoc, move(Inits), RBraceLoc);
if (Result.isInvalid() || ResultTy->isDependentType())
@@ -2476,6 +2476,10 @@ bool TreeTransform<Derived>::TransformExprs(Expr **Inputs,
Outputs.push_back(Out.get());
continue;
}
+
+ // Record right away that the argument was changed. This needs
+ // to happen even if the array expands to nothing.
+ if (ArgChanged) *ArgChanged = true;
// The transform has determined that we should perform an elementwise
// expansion of the pattern. Do so.
@@ -2492,8 +2496,6 @@ bool TreeTransform<Derived>::TransformExprs(Expr **Inputs,
return true;
}
- if (ArgChanged)
- *ArgChanged = true;
Outputs.push_back(Out.get());
}