Skip to content

Commit 8313d2a

Browse files
committed
[OpenACC] Fixup previous-clause diagnostics
Brought up in a previous review as a TODO, we could be better about how we highlight what hte previous clause was, and how to show that the 'device_type' is the one being targetted. This patch rewords the diagnostics and updates a massive number of tests.
1 parent b5dbddd commit 8313d2a

File tree

48 files changed

+637
-595
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+637
-595
lines changed

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13009,14 +13009,10 @@ def err_acc_clause_appertainment
1300913009
def err_acc_duplicate_clause_disallowed
1301013010
: Error<"OpenACC '%1' clause cannot appear more than once on a '%0' "
1301113011
"directive">;
13012-
def note_acc_previous_clause_here : Note<"previous clause is here">;
13013-
// TODO(OpenACC): Combine these with the one above, and decide between a
13014-
// 'select' to split between showing the clause name, or just always printing
13015-
// the name.
13016-
def note_acc_previous_named_clause_here : Note<"previous '%0' clause is here">;
13017-
def note_acc_device_type_here
13012+
def note_acc_previous_clause_here : Note<"previous '%0' clause is here">;
13013+
def note_acc_active_applies_clause_here
1301813014
: Note<"%enum_select<ACCDeviceTypeApp>{%Active{active}|%Applies{which "
13019-
"applies to}}0 'device_type' clause here">;
13015+
"applies to}}0 '%1' clause here">;
1302013016
def note_acc_previous_expr_here : Note<"previous expression is here">;
1302113017
def note_acc_previous_reference : Note<"previous reference is here">;
1302213018
def err_acc_branch_in_out_compute_construct
@@ -13267,7 +13263,7 @@ def err_acc_duplicate_bind
1326713263
"permitted to refer to the same function">;
1326813264
def err_acc_duplicate_unnamed_bind
1326913265
: Error<"OpenACC 'bind' clause on a declaration must bind to the same name "
13270-
"as previous bind clauses">;
13266+
"as previous 'bind' clauses">;
1327113267
def warn_acc_confusing_routine_name
1327213268
: Warning<"OpenACC 'routine' directive with a name refers to a function "
1327313269
"with the same name as the function on the following line; this "

clang/lib/Sema/SemaOpenACC.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2259,7 +2259,8 @@ void SemaOpenACC::CheckRoutineDecl(SourceLocation DirLoc,
22592259
(*cast<OpenACCBindClause>(*BindItr)) !=
22602260
(*cast<OpenACCBindClause>(*OtherBindItr))) {
22612261
Diag((*BindItr)->getBeginLoc(), diag::err_acc_duplicate_unnamed_bind);
2262-
Diag((*OtherBindItr)->getEndLoc(), diag::note_acc_previous_clause_here);
2262+
Diag((*OtherBindItr)->getEndLoc(), diag::note_acc_previous_clause_here)
2263+
<< (*BindItr)->getClauseKind();
22632264
return;
22642265
}
22652266
}
@@ -2273,7 +2274,8 @@ void SemaOpenACC::CheckRoutineDecl(SourceLocation DirLoc,
22732274
if (auto *RA = dyn_cast<OpenACCRoutineAnnotAttr>(A);
22742275
RA && RA->getRange().getEnd().isValid()) {
22752276
Diag((*BindItr)->getBeginLoc(), diag::err_acc_duplicate_bind);
2276-
Diag(RA->getRange().getEnd(), diag::note_acc_previous_clause_here);
2277+
Diag(RA->getRange().getEnd(), diag::note_acc_previous_clause_here)
2278+
<< "bind";
22772279
return;
22782280
}
22792281
}
@@ -2318,15 +2320,17 @@ OpenACCRoutineDecl *SemaOpenACC::CheckRoutineDecl(
23182320
if (OtherBindItr != RA->Clauses.end()) {
23192321
Diag((*BindItr)->getBeginLoc(), diag::err_acc_duplicate_bind);
23202322
Diag((*OtherBindItr)->getEndLoc(),
2321-
diag::note_acc_previous_clause_here);
2323+
diag::note_acc_previous_clause_here)
2324+
<< (*BindItr)->getClauseKind();
23222325
return nullptr;
23232326
}
23242327
}
23252328

23262329
if (auto *RA = dyn_cast<OpenACCRoutineAnnotAttr>(A);
23272330
RA && RA->getRange().getEnd().isValid()) {
23282331
Diag((*BindItr)->getBeginLoc(), diag::err_acc_duplicate_bind);
2329-
Diag(RA->getRange().getEnd(), diag::note_acc_previous_clause_here);
2332+
Diag(RA->getRange().getEnd(), diag::note_acc_previous_clause_here)
2333+
<< (*BindItr)->getClauseKind();
23302334
return nullptr;
23312335
}
23322336
}

0 commit comments

Comments
 (0)