This revision was automatically updated to reflect the committed changes.
Closed by commit rL319458: [OpenMP] Diagnose undeclared variables on declare 
target clause (authored by kli).

Changed prior to commit:
  https://reviews.llvm.org/D40588?vs=124811&id=124969#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D40588

Files:
  cfe/trunk/lib/Sema/SemaOpenMP.cpp
  cfe/trunk/test/OpenMP/declare_target_messages.cpp


Index: cfe/trunk/test/OpenMP/declare_target_messages.cpp
===================================================================
--- cfe/trunk/test/OpenMP/declare_target_messages.cpp
+++ cfe/trunk/test/OpenMP/declare_target_messages.cpp
@@ -13,6 +13,10 @@
 
 #pragma omp declare target map(a) // expected-error {{unexpected 'map' clause, 
only 'to' or 'link' clauses expected}}
 
+#pragma omp declare target to(foo1) // expected-error {{use of undeclared 
identifier 'foo1'}}
+
+#pragma omp declare target link(foo2) // expected-error {{use of undeclared 
identifier 'foo2'}}
+
 void c(); // expected-warning {{declaration is not declared in any declare 
target region}}
 
 extern int b;
Index: cfe/trunk/lib/Sema/SemaOpenMP.cpp
===================================================================
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp
@@ -1506,7 +1506,7 @@
   explicit VarOrFuncDeclFilterCCC(Sema &S) : SemaRef(S) {}
   bool ValidateCandidate(const TypoCorrection &Candidate) override {
     NamedDecl *ND = Candidate.getCorrectionDecl();
-    if (isa<VarDecl>(ND) || isa<FunctionDecl>(ND)) {
+    if (ND && (isa<VarDecl>(ND) || isa<FunctionDecl>(ND))) {
       return SemaRef.isDeclInScope(ND, SemaRef.getCurLexicalContext(),
                                    SemaRef.getCurScope());
     }


Index: cfe/trunk/test/OpenMP/declare_target_messages.cpp
===================================================================
--- cfe/trunk/test/OpenMP/declare_target_messages.cpp
+++ cfe/trunk/test/OpenMP/declare_target_messages.cpp
@@ -13,6 +13,10 @@
 
 #pragma omp declare target map(a) // expected-error {{unexpected 'map' clause, only 'to' or 'link' clauses expected}}
 
+#pragma omp declare target to(foo1) // expected-error {{use of undeclared identifier 'foo1'}}
+
+#pragma omp declare target link(foo2) // expected-error {{use of undeclared identifier 'foo2'}}
+
 void c(); // expected-warning {{declaration is not declared in any declare target region}}
 
 extern int b;
Index: cfe/trunk/lib/Sema/SemaOpenMP.cpp
===================================================================
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp
@@ -1506,7 +1506,7 @@
   explicit VarOrFuncDeclFilterCCC(Sema &S) : SemaRef(S) {}
   bool ValidateCandidate(const TypoCorrection &Candidate) override {
     NamedDecl *ND = Candidate.getCorrectionDecl();
-    if (isa<VarDecl>(ND) || isa<FunctionDecl>(ND)) {
+    if (ND && (isa<VarDecl>(ND) || isa<FunctionDecl>(ND))) {
       return SemaRef.isDeclInScope(ND, SemaRef.getCurLexicalContext(),
                                    SemaRef.getCurScope());
     }
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to