[clang] 1fcc9b6 - [OPENMP] Restore allowing of braced initializers in the declare reduction
Alexey Bataev via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 2 13:14:12 PST 2020
Author: Alexey Bataev
Date: 2020-01-02T16:10:17-05:00
New Revision: 1fcc9b6ff8558efed0c1241c72f69d079baeecf8
URL: https://github.com/llvm/llvm-project/commit/1fcc9b6ff8558efed0c1241c72f69d079baeecf8
DIFF: https://github.com/llvm/llvm-project/commit/1fcc9b6ff8558efed0c1241c72f69d079baeecf8.diff
LOG: [OPENMP] Restore allowing of braced initializers in the declare reduction
init.
Braced initializers were not accepted after the last fix in the initialier.Restored previous functionality.
Added:
Modified:
clang/lib/Parse/ParseOpenMP.cpp
clang/test/OpenMP/declare_reduction_messages.c
Removed:
################################################################################
diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp
index a62c68b39f1a..aaef4cd36d3b 100644
--- a/clang/lib/Parse/ParseOpenMP.cpp
+++ b/clang/lib/Parse/ParseOpenMP.cpp
@@ -430,7 +430,7 @@ void Parser::ParseOpenMPReductionInitializerForDecl(VarDecl *OmpPrivParm) {
}
PreferredType.enterVariableInit(Tok.getLocation(), OmpPrivParm);
- ExprResult Init = ParseAssignmentExpression();
+ ExprResult Init = ParseInitializer();
if (Init.isInvalid()) {
SkipUntil(tok::r_paren, tok::annot_pragma_openmp_end, StopBeforeMatch);
diff --git a/clang/test/OpenMP/declare_reduction_messages.c b/clang/test/OpenMP/declare_reduction_messages.c
index 4a0d6ef4028d..69b73f4c72b5 100644
--- a/clang/test/OpenMP/declare_reduction_messages.c
+++ b/clang/test/OpenMP/declare_reduction_messages.c
@@ -45,6 +45,8 @@ struct S {
int s;
};
#pragma omp declare reduction(+: struct S: omp_out.s += omp_in.s) // initializer(omp_priv = { .s = 0 })
+#pragma omp declare reduction(&: struct S: omp_out.s += omp_in.s) initializer(omp_priv = { .s = 0 })
+#pragma omp declare reduction(|: struct S: omp_out.s += omp_in.s) initializer(omp_priv = { 0 })
int fun(int arg) {
struct S s;// expected-note {{'s' defined here}}
More information about the cfe-commits
mailing list