diff options
Diffstat (limited to 'clang/lib/Sema/SemaOpenACC.cpp')
-rw-r--r-- | clang/lib/Sema/SemaOpenACC.cpp | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaOpenACC.cpp b/clang/lib/Sema/SemaOpenACC.cpp index a64f207..9aaf7f4 100644 --- a/clang/lib/Sema/SemaOpenACC.cpp +++ b/clang/lib/Sema/SemaOpenACC.cpp @@ -2789,7 +2789,7 @@ OpenACCPrivateRecipe SemaOpenACC::CreatePrivateInitRecipe(const Expr *VarExpr) { AllocaDecl->setInitStyle(VarDecl::CallInit); } - return OpenACCPrivateRecipe(AllocaDecl, Init.get()); + return OpenACCPrivateRecipe(AllocaDecl); } OpenACCFirstPrivateRecipe @@ -2828,7 +2828,14 @@ SemaOpenACC::CreateFirstPrivateInitRecipe(const Expr *VarExpr) { if (!ArrTy) { ExprResult Init = FinishValueInit( SemaRef.SemaRef, Entity, VarExpr->getBeginLoc(), VarTy, TemporaryDRE); - return OpenACCFirstPrivateRecipe(AllocaDecl, Init.get(), Temporary); + + // For 'no bounds' version, we can use this as a shortcut, so set the init + // anyway. + if (Init.isUsable()) { + AllocaDecl->setInit(Init.get()); + AllocaDecl->setInitStyle(VarDecl::CallInit); + } + return OpenACCFirstPrivateRecipe(AllocaDecl, Temporary); } // Arrays need to have each individual element initialized as there @@ -2875,8 +2882,16 @@ SemaOpenACC::CreateFirstPrivateInitRecipe(const Expr *VarExpr) { ExprResult Init = FinishValueInit(SemaRef.SemaRef, Entity, VarExpr->getBeginLoc(), VarTy, InitExpr); - return OpenACCFirstPrivateRecipe(AllocaDecl, Init.get(), Temporary); + // For 'no bounds' version, we can use this as a shortcut, so set the init + // anyway. + if (Init.isUsable()) { + AllocaDecl->setInit(Init.get()); + AllocaDecl->setInitStyle(VarDecl::CallInit); + } + + return OpenACCFirstPrivateRecipe(AllocaDecl, Temporary); } + OpenACCReductionRecipe SemaOpenACC::CreateReductionInitRecipe( OpenACCReductionOperator ReductionOperator, const Expr *VarExpr) { // TODO: OpenACC: This shouldn't be necessary, see PrivateInitRecipe @@ -2932,5 +2947,12 @@ OpenACCReductionRecipe SemaOpenACC::CreateReductionInitRecipe( ExprResult Init = FinishValueInit(SemaRef.SemaRef, Entity, VarExpr->getBeginLoc(), VarTy, InitExpr); - return OpenACCReductionRecipe(AllocaDecl, Init.get()); + + // For 'no bounds' version, we can use this as a shortcut, so set the init + // anyway. + if (Init.isUsable()) { + AllocaDecl->setInit(Init.get()); + AllocaDecl->setInitStyle(VarDecl::CallInit); + } + return OpenACCReductionRecipe(AllocaDecl); } |