This revision was automatically updated to reflect the committed changes.
Closed by commit rG6b0f35931a44: Fix signal during the call to checkOpenMPLoop. 
(authored by jyu2).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107385

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


Index: clang/test/OpenMP/teams_distribute_loop_messages.cpp
===================================================================
--- clang/test/OpenMP/teams_distribute_loop_messages.cpp
+++ clang/test/OpenMP/teams_distribute_loop_messages.cpp
@@ -721,4 +721,15 @@
   for (int i = 0; i < 16; ++i)
     ;
 }
+//expected-note@+1 {{candidate function not viable: requires single argument 
'device_Id', but no arguments were provided}}
+int foo(int device_Id) {
+  return 2;
+}
+
+int main() {
+// expected-error@+1 {{no matching function for call to 'foo'}}
+  const int globalWI{ foo() };
+#pragma omp target teams distribute
+  for (int i=0 ; i<globalWI; i++) {}
+}
 
Index: clang/lib/Sema/SemaOpenMP.cpp
===================================================================
--- clang/lib/Sema/SemaOpenMP.cpp
+++ clang/lib/Sema/SemaOpenMP.cpp
@@ -7342,7 +7342,7 @@
   // State consistency checking to ensure correct usage.
   assert(LCDecl == nullptr && LB == nullptr && LCRef == nullptr &&
          UB == nullptr && Step == nullptr && !TestIsLessOp && !TestIsStrictOp);
-  if (!NewLCDecl || !NewLB)
+  if (!NewLCDecl || !NewLB || NewLB->containsErrors())
     return true;
   LCDecl = getCanonicalDecl(NewLCDecl);
   LCRef = NewLCRefExpr;
@@ -7365,7 +7365,7 @@
   // State consistency checking to ensure correct usage.
   assert(LCDecl != nullptr && LB != nullptr && UB == nullptr &&
          Step == nullptr && !TestIsLessOp && !TestIsStrictOp);
-  if (!NewUB)
+  if (!NewUB || NewUB->containsErrors())
     return true;
   UB = NewUB;
   if (LessOp)
@@ -7380,7 +7380,7 @@
 bool OpenMPIterationSpaceChecker::setStep(Expr *NewStep, bool Subtract) {
   // State consistency checking to ensure correct usage.
   assert(LCDecl != nullptr && LB != nullptr && Step == nullptr);
-  if (!NewStep)
+  if (!NewStep || NewStep->containsErrors())
     return true;
   if (!NewStep->isValueDependent()) {
     // Check that the step is integer expression.


Index: clang/test/OpenMP/teams_distribute_loop_messages.cpp
===================================================================
--- clang/test/OpenMP/teams_distribute_loop_messages.cpp
+++ clang/test/OpenMP/teams_distribute_loop_messages.cpp
@@ -721,4 +721,15 @@
   for (int i = 0; i < 16; ++i)
     ;
 }
+//expected-note@+1 {{candidate function not viable: requires single argument 'device_Id', but no arguments were provided}}
+int foo(int device_Id) {
+  return 2;
+}
+
+int main() {
+// expected-error@+1 {{no matching function for call to 'foo'}}
+  const int globalWI{ foo() };
+#pragma omp target teams distribute
+  for (int i=0 ; i<globalWI; i++) {}
+}
 
Index: clang/lib/Sema/SemaOpenMP.cpp
===================================================================
--- clang/lib/Sema/SemaOpenMP.cpp
+++ clang/lib/Sema/SemaOpenMP.cpp
@@ -7342,7 +7342,7 @@
   // State consistency checking to ensure correct usage.
   assert(LCDecl == nullptr && LB == nullptr && LCRef == nullptr &&
          UB == nullptr && Step == nullptr && !TestIsLessOp && !TestIsStrictOp);
-  if (!NewLCDecl || !NewLB)
+  if (!NewLCDecl || !NewLB || NewLB->containsErrors())
     return true;
   LCDecl = getCanonicalDecl(NewLCDecl);
   LCRef = NewLCRefExpr;
@@ -7365,7 +7365,7 @@
   // State consistency checking to ensure correct usage.
   assert(LCDecl != nullptr && LB != nullptr && UB == nullptr &&
          Step == nullptr && !TestIsLessOp && !TestIsStrictOp);
-  if (!NewUB)
+  if (!NewUB || NewUB->containsErrors())
     return true;
   UB = NewUB;
   if (LessOp)
@@ -7380,7 +7380,7 @@
 bool OpenMPIterationSpaceChecker::setStep(Expr *NewStep, bool Subtract) {
   // State consistency checking to ensure correct usage.
   assert(LCDecl != nullptr && LB != nullptr && Step == nullptr);
-  if (!NewStep)
+  if (!NewStep || NewStep->containsErrors())
     return true;
   if (!NewStep->isValueDependent()) {
     // Check that the step is integer expression.
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to