This revision was automatically updated to reflect the committed changes.
Closed by commit rG4e159e4c7b97: [clang] Fix OpenMP critical hint parameter 
check (authored by peixin).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121101/new/

https://reviews.llvm.org/D121101

Files:
  clang/lib/Sema/SemaOpenMP.cpp
  clang/test/OpenMP/critical_messages.cpp


Index: clang/test/OpenMP/critical_messages.cpp
===================================================================
--- clang/test/OpenMP/critical_messages.cpp
+++ clang/test/OpenMP/critical_messages.cpp
@@ -67,10 +67,14 @@
   foo();
   #pragma omp critical (name2) hint(argc) // expected-error {{integral 
constant expression}} expected-note 0+{{constant expression}}
   foo();
-  #pragma omp critical (name) hint(N) // expected-error {{argument to 'hint' 
clause must be a strictly positive integer value}} expected-error {{constructs 
with the same name must have a 'hint' clause with the same value}} 
expected-note {{'hint' clause with value '4'}}
+  #pragma omp critical (name) hint(N) // expected-error {{argument to 'hint' 
clause must be a non-negative integer value}} expected-error {{constructs with 
the same name must have a 'hint' clause with the same value}} expected-note 
{{'hint' clause with value '4'}}
   foo();
   #pragma omp critical hint(N) // expected-error {{the name of the construct 
must be specified in presence of 'hint' clause}}
   foo();
+
+  const int omp_lock_hint_none = 0;
+  #pragma omp critical (name3) hint(omp_lock_hint_none)
+  foo();
   return 0;
 }
 
@@ -132,7 +136,7 @@
   foo();
   #pragma omp critical (name) hint(23) // expected-note {{previous 'hint' 
clause with value '23'}}
   foo();
-  #pragma omp critical hint(-5) // expected-error {{argument to 'hint' clause 
must be a strictly positive integer value}}
+  #pragma omp critical hint(-5) // expected-error {{argument to 'hint' clause 
must be a non-negative integer value}}
   foo();
   #pragma omp critical hint(1) // expected-error {{the name of the construct 
must be specified in presence of 'hint' clause}}
   foo();
Index: clang/lib/Sema/SemaOpenMP.cpp
===================================================================
--- clang/lib/Sema/SemaOpenMP.cpp
+++ clang/lib/Sema/SemaOpenMP.cpp
@@ -21402,7 +21402,8 @@
   // OpenMP [2.13.2, critical construct, Description]
   // ... where hint-expression is an integer constant expression that evaluates
   // to a valid lock hint.
-  ExprResult HintExpr = VerifyPositiveIntegerConstantInClause(Hint, OMPC_hint);
+  ExprResult HintExpr =
+      VerifyPositiveIntegerConstantInClause(Hint, OMPC_hint, false);
   if (HintExpr.isInvalid())
     return nullptr;
   return new (Context)


Index: clang/test/OpenMP/critical_messages.cpp
===================================================================
--- clang/test/OpenMP/critical_messages.cpp
+++ clang/test/OpenMP/critical_messages.cpp
@@ -67,10 +67,14 @@
   foo();
   #pragma omp critical (name2) hint(argc) // expected-error {{integral constant expression}} expected-note 0+{{constant expression}}
   foo();
-  #pragma omp critical (name) hint(N) // expected-error {{argument to 'hint' clause must be a strictly positive integer value}} expected-error {{constructs with the same name must have a 'hint' clause with the same value}} expected-note {{'hint' clause with value '4'}}
+  #pragma omp critical (name) hint(N) // expected-error {{argument to 'hint' clause must be a non-negative integer value}} expected-error {{constructs with the same name must have a 'hint' clause with the same value}} expected-note {{'hint' clause with value '4'}}
   foo();
   #pragma omp critical hint(N) // expected-error {{the name of the construct must be specified in presence of 'hint' clause}}
   foo();
+
+  const int omp_lock_hint_none = 0;
+  #pragma omp critical (name3) hint(omp_lock_hint_none)
+  foo();
   return 0;
 }
 
@@ -132,7 +136,7 @@
   foo();
   #pragma omp critical (name) hint(23) // expected-note {{previous 'hint' clause with value '23'}}
   foo();
-  #pragma omp critical hint(-5) // expected-error {{argument to 'hint' clause must be a strictly positive integer value}}
+  #pragma omp critical hint(-5) // expected-error {{argument to 'hint' clause must be a non-negative integer value}}
   foo();
   #pragma omp critical hint(1) // expected-error {{the name of the construct must be specified in presence of 'hint' clause}}
   foo();
Index: clang/lib/Sema/SemaOpenMP.cpp
===================================================================
--- clang/lib/Sema/SemaOpenMP.cpp
+++ clang/lib/Sema/SemaOpenMP.cpp
@@ -21402,7 +21402,8 @@
   // OpenMP [2.13.2, critical construct, Description]
   // ... where hint-expression is an integer constant expression that evaluates
   // to a valid lock hint.
-  ExprResult HintExpr = VerifyPositiveIntegerConstantInClause(Hint, OMPC_hint);
+  ExprResult HintExpr =
+      VerifyPositiveIntegerConstantInClause(Hint, OMPC_hint, false);
   if (HintExpr.isInvalid())
     return nullptr;
   return new (Context)
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to