Skip to content

Commit 09f39f1

Browse files
author
urvi-rav
committed
Updated error messages
1 parent f1b974c commit 09f39f1

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

clang/include/clang/Basic/DiagnosticParseKinds.td

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1660,8 +1660,6 @@ def err_omp_expected_colon : Error<"missing ':' in %0">;
16601660
def err_omp_missing_comma : Error< "missing ',' after %0">;
16611661
def err_omp_expected_context_selector
16621662
: Error<"expected valid context selector in %0">;
1663-
def err_omp_unknown_clause
1664-
: Error<"expected an OpenMP clause">;
16651663
def warn_omp_default_deprecated : Warning<"'default' clause for"
16661664
" 'metadirective' is deprecated; use 'otherwise' instead">, InGroup<Deprecated>;
16671665
def err_omp_requires_out_inout_depend_type : Error<

clang/lib/Parse/ParseOpenMP.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2761,11 +2761,10 @@ StmtResult Parser::ParseOpenMPDeclarativeOrExecutableDirective(
27612761
: getOpenMPClauseKind(PP.getSpelling(Tok));
27622762
// Check if the clause is unrecognized.
27632763
if (CKind == OMPC_unknown)
2764-
Diag(Tok, diag::err_omp_unknown_clause)
2765-
<< PP.getSpelling(Tok) << "metadirective";
2764+
Diag(Tok, diag::err_omp_expected_clause) << "metadirective";
27662765
if (getLangOpts().OpenMP < 52 && CKind == OMPC_otherwise)
27672766
Diag(Tok, diag::err_omp_unexpected_clause)
2768-
<< PP.getSpelling(Tok) << "metadirective";
2767+
<< getOpenMPClauseName(CKind) << "metadirective";
27692768
if (CKind == OMPC_default && getLangOpts().OpenMP >= 52)
27702769
Diag(Tok, diag::warn_omp_default_deprecated);
27712770

clang/test/OpenMP/metadirective_messages.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ void foo() {
2424
;
2525
#pragma omp metadirective when(device = {arch(nvptx)} : parallel) default() // omp52-warning {{'default' clause for 'metadirective' is deprecated; use 'otherwise' instead}}
2626
;
27-
#pragma omp metadirective when(device = {arch(nvptx)} : parallel) xyz() //omp52-error {{expected an OpenMP clause}}
27+
#pragma omp metadirective when(device = {arch(nvptx)} : parallel) xyz() //omp52-error {{expected at least one clause on '#pragma omp metadirective' directive}}
2828
;
2929
#else
3030
#pragma omp metadirective // expected-error {{expected expression}}
@@ -45,7 +45,7 @@ void foo() {
4545
;
4646
#pragma omp metadirective when(device = {isa("some-unsupported-feature")} : parallel) otherwise(single) // expected-warning {{isa trait 'some-unsupported-feature' is not known to the current target; verify the spelling or consider restricting the context selector with the 'arch' selector further}} //expected-error{{unexpected OpenMP clause 'otherwise' in directive '#pragma omp metadirective'}}
4747
;
48-
#pragma omp metadirective when(device = {arch(nvptx)} : parallel) xyz() //expected-error {{expected an OpenMP clause}}
48+
#pragma omp metadirective when(device = {arch(nvptx)} : parallel) xyz() //expected-error {{expected at least one clause on '#pragma omp metadirective' directive}}
4949
;
5050
#endif
5151
}

0 commit comments

Comments
 (0)