@@ -876,21 +876,32 @@ class OpenACCPrivateClause final
876876 }
877877};
878878
879+ // A 'pair' to stand in for the recipe. RecipeDecl is the main declaration, and
880+ // InitFromTemporary is the 'temp' declaration we put in to be 'copied from'.
881+ struct OpenACCFirstPrivateRecipe {
882+ VarDecl *RecipeDecl, *InitFromTemporary;
883+ OpenACCFirstPrivateRecipe (VarDecl *R, VarDecl *T)
884+ : RecipeDecl(R), InitFromTemporary(T) {}
885+ OpenACCFirstPrivateRecipe (std::pair<VarDecl *, VarDecl *> p)
886+ : RecipeDecl(p.first), InitFromTemporary(p.second) {}
887+ };
888+
879889class OpenACCFirstPrivateClause final
880890 : public OpenACCClauseWithVarList,
881891 private llvm::TrailingObjects<OpenACCFirstPrivateClause, Expr *,
882- VarDecl * > {
892+ OpenACCFirstPrivateRecipe > {
883893 friend TrailingObjects;
884894
885895 OpenACCFirstPrivateClause (SourceLocation BeginLoc, SourceLocation LParenLoc,
886896 ArrayRef<Expr *> VarList,
887- ArrayRef<VarDecl * > InitRecipes,
897+ ArrayRef<OpenACCFirstPrivateRecipe > InitRecipes,
888898 SourceLocation EndLoc)
889899 : OpenACCClauseWithVarList(OpenACCClauseKind::FirstPrivate, BeginLoc,
890900 LParenLoc, EndLoc) {
891901 assert (VarList.size () == InitRecipes.size ());
892902 setExprs (getTrailingObjects<Expr *>(VarList.size ()), VarList);
893- llvm::uninitialized_copy (InitRecipes, getTrailingObjects<VarDecl *>());
903+ llvm::uninitialized_copy (InitRecipes,
904+ getTrailingObjects<OpenACCFirstPrivateRecipe>());
894905 }
895906
896907public:
@@ -900,19 +911,20 @@ class OpenACCFirstPrivateClause final
900911
901912 // Gets a list of 'made up' `VarDecl` objects that can be used by codegen to
902913 // ensure that we properly initialize each of these variables.
903- ArrayRef<VarDecl * > getInitRecipes () {
904- return ArrayRef<VarDecl *>{getTrailingObjects<VarDecl *>(),
905- getExprs ().size ()};
914+ ArrayRef<OpenACCFirstPrivateRecipe > getInitRecipes () {
915+ return ArrayRef<OpenACCFirstPrivateRecipe>{
916+ getTrailingObjects<OpenACCFirstPrivateRecipe>(), getExprs ().size ()};
906917 }
907918
908- ArrayRef<VarDecl * > getInitRecipes () const {
909- return ArrayRef<VarDecl *>{getTrailingObjects<VarDecl *>(),
910- getExprs ().size ()};
919+ ArrayRef<OpenACCFirstPrivateRecipe > getInitRecipes () const {
920+ return ArrayRef<OpenACCFirstPrivateRecipe>{
921+ getTrailingObjects<OpenACCFirstPrivateRecipe>(), getExprs ().size ()};
911922 }
912923
913924 static OpenACCFirstPrivateClause *
914925 Create (const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc,
915- ArrayRef<Expr *> VarList, ArrayRef<VarDecl *> InitRecipes,
926+ ArrayRef<Expr *> VarList,
927+ ArrayRef<OpenACCFirstPrivateRecipe> InitRecipes,
916928 SourceLocation EndLoc);
917929
918930 size_t numTrailingObjects (OverloadToken<Expr *>) const {
0 commit comments