[PATCH] D40588: [OpenMP] Diagnose undeclared variables on declare target clause
ABataev requested changes to this revision. ABataev added a comment. This revision now requires changes to proceed. I'm unable to reproduce a crash, the test works correctly even without you patch https://reviews.llvm.org/D40588 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D40588: [OpenMP] Diagnose undeclared variables on declare target clause
kkwli0 added a comment. The original case has the variables named "foo1" and foo2". Using "foo1" or "foo2" causes the assert! I update the description. https://reviews.llvm.org/D40588 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D40588: [OpenMP] Diagnose undeclared variables on declare target clause
kkwli0 updated this revision to Diff 124811. kkwli0 added a comment. The assert occurs in VarOrFuncDeclFilterCCC::ValidateCandidate when clang::Sema::CorrectTypo is called. https://reviews.llvm.org/D40588 Files: lib/Sema/SemaOpenMP.cpp test/OpenMP/declare_target_messages.cpp Index: test/OpenMP/declare_target_messages.cpp === --- test/OpenMP/declare_target_messages.cpp +++ 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: lib/Sema/SemaOpenMP.cpp === --- lib/Sema/SemaOpenMP.cpp +++ 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(ND) || isa(ND)) { +if (ND && (isa(ND) || isa(ND))) { return SemaRef.isDeclInScope(ND, SemaRef.getCurLexicalContext(), SemaRef.getCurScope()); } Index: test/OpenMP/declare_target_messages.cpp === --- test/OpenMP/declare_target_messages.cpp +++ 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: lib/Sema/SemaOpenMP.cpp === --- lib/Sema/SemaOpenMP.cpp +++ 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(ND) || isa(ND)) { +if (ND && (isa(ND) || isa(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
[PATCH] D40588: [OpenMP] Diagnose undeclared variables on declare target clause
ABataev accepted this revision. ABataev added a comment. This revision is now accepted and ready to land. LG https://reviews.llvm.org/D40588 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D40588: [OpenMP] Diagnose undeclared variables on declare target clause
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(ND) || isa(ND)) { +if (ND && (isa(ND) || isa(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(ND) || isa(ND)) { +if (ND && (isa(ND) || isa(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
[PATCH] D40588: [OpenMP] Diagnose undeclared variables on declare target clause
This revision was automatically updated to reflect the committed changes. Closed by commit rC319458: [OpenMP] Diagnose undeclared variables on declare target clause (authored by kli). Repository: rC Clang https://reviews.llvm.org/D40588 Files: lib/Sema/SemaOpenMP.cpp test/OpenMP/declare_target_messages.cpp Index: lib/Sema/SemaOpenMP.cpp === --- lib/Sema/SemaOpenMP.cpp +++ 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(ND) || isa(ND)) { +if (ND && (isa(ND) || isa(ND))) { return SemaRef.isDeclInScope(ND, SemaRef.getCurLexicalContext(), SemaRef.getCurScope()); } Index: test/OpenMP/declare_target_messages.cpp === --- test/OpenMP/declare_target_messages.cpp +++ 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: lib/Sema/SemaOpenMP.cpp === --- lib/Sema/SemaOpenMP.cpp +++ 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(ND) || isa(ND)) { +if (ND && (isa(ND) || isa(ND))) { return SemaRef.isDeclInScope(ND, SemaRef.getCurLexicalContext(), SemaRef.getCurScope()); } Index: test/OpenMP/declare_target_messages.cpp === --- test/OpenMP/declare_target_messages.cpp +++ 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; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits