aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/OpenACCClause.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/AST/OpenACCClause.cpp')
-rw-r--r--clang/lib/AST/OpenACCClause.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/clang/lib/AST/OpenACCClause.cpp b/clang/lib/AST/OpenACCClause.cpp
index 6c4bc7c..142c932 100644
--- a/clang/lib/AST/OpenACCClause.cpp
+++ b/clang/lib/AST/OpenACCClause.cpp
@@ -506,11 +506,17 @@ OpenACCDeviceTypeClause *OpenACCDeviceTypeClause::Create(
OpenACCReductionClause *OpenACCReductionClause::Create(
const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc,
OpenACCReductionOperator Operator, ArrayRef<Expr *> VarList,
- ArrayRef<OpenACCReductionRecipe> Recipes,
+ ArrayRef<OpenACCReductionRecipeWithStorage> Recipes,
SourceLocation EndLoc) {
- void *Mem = C.Allocate(
- OpenACCReductionClause::totalSizeToAlloc<Expr *, OpenACCReductionRecipe>(
- VarList.size(), Recipes.size()));
+ size_t NumCombiners = llvm::accumulate(
+ Recipes, 0, [](size_t Num, const OpenACCReductionRecipeWithStorage &R) {
+ return Num + R.CombinerRecipes.size();
+ });
+
+ void *Mem = C.Allocate(OpenACCReductionClause::totalSizeToAlloc<
+ Expr *, OpenACCReductionRecipe,
+ OpenACCReductionRecipe::CombinerRecipe>(
+ VarList.size(), Recipes.size(), NumCombiners));
return new (Mem) OpenACCReductionClause(BeginLoc, LParenLoc, Operator,
VarList, Recipes, EndLoc);
}