Skip to content

Commit

Permalink
[NFC][OpenACC] Rename visitor functions to omit redundant OpenACC
Browse files Browse the repository at this point in the history
While working on a followup patch, it became clear that this extra bit
of 'OpenACC' before each clause name was redundant with the visitors, so
remove it to make this a little less verbose.
  • Loading branch information
erichkeane committed Apr 12, 2024
1 parent eaa3947 commit a472e64
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
11 changes: 5 additions & 6 deletions clang/include/clang/AST/OpenACCClause.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,10 @@ template <class Impl> class OpenACCClauseVisitor {

switch (C->getClauseKind()) {
case OpenACCClauseKind::Default:
VisitOpenACCDefaultClause(*cast<OpenACCDefaultClause>(C));
VisitDefaultClause(*cast<OpenACCDefaultClause>(C));
return;
case OpenACCClauseKind::If:
VisitOpenACCIfClause(*cast<OpenACCIfClause>(C));
VisitIfClause(*cast<OpenACCIfClause>(C));
return;
case OpenACCClauseKind::Finalize:
case OpenACCClauseKind::IfPresent:
Expand Down Expand Up @@ -212,9 +212,9 @@ template <class Impl> class OpenACCClauseVisitor {
}

#define VISIT_CLAUSE(CLAUSE_NAME) \
void VisitOpenACC##CLAUSE_NAME##Clause( \
void Visit##CLAUSE_NAME##Clause( \
const OpenACC##CLAUSE_NAME##Clause &Clause) { \
return getDerived().VisitOpenACC##CLAUSE_NAME##Clause(Clause); \
return getDerived().Visit##CLAUSE_NAME##Clause(Clause); \
}

#include "clang/Basic/OpenACCClauses.def"
Expand All @@ -236,8 +236,7 @@ class OpenACCClausePrinter final
OpenACCClausePrinter(raw_ostream &OS) : OS(OS) {}

#define VISIT_CLAUSE(CLAUSE_NAME) \
void VisitOpenACC##CLAUSE_NAME##Clause( \
const OpenACC##CLAUSE_NAME##Clause &Clause);
void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
#include "clang/Basic/OpenACCClauses.def"
};

Expand Down
4 changes: 2 additions & 2 deletions clang/lib/AST/OpenACCClause.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ OpenACCClause::child_range OpenACCClause::children() {
//===----------------------------------------------------------------------===//
// OpenACC clauses printing methods
//===----------------------------------------------------------------------===//
void OpenACCClausePrinter::VisitOpenACCDefaultClause(
void OpenACCClausePrinter::VisitDefaultClause(
const OpenACCDefaultClause &C) {
OS << "default(" << C.getDefaultClauseKind() << ")";
}

void OpenACCClausePrinter::VisitOpenACCIfClause(const OpenACCIfClause &C) {
void OpenACCClausePrinter::VisitIfClause(const OpenACCIfClause &C) {
OS << "if(" << C.getConditionExpr() << ")";
}
6 changes: 3 additions & 3 deletions clang/lib/AST/StmtProfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2459,17 +2459,17 @@ class OpenACCClauseProfiler
}

#define VISIT_CLAUSE(CLAUSE_NAME) \
void VisitOpenACC##CLAUSE_NAME##Clause( \
void Visit##CLAUSE_NAME##Clause( \
const OpenACC##CLAUSE_NAME##Clause &Clause);

#include "clang/Basic/OpenACCClauses.def"
};

/// Nothing to do here, there are no sub-statements.
void OpenACCClauseProfiler::VisitOpenACCDefaultClause(
void OpenACCClauseProfiler::VisitDefaultClause(
const OpenACCDefaultClause &Clause) {}

void OpenACCClauseProfiler::VisitOpenACCIfClause(
void OpenACCClauseProfiler::VisitIfClause(
const OpenACCIfClause &Clause) {
assert(Clause.hasConditionExpr() &&
"if clause requires a valid condition expr");
Expand Down
5 changes: 2 additions & 3 deletions clang/tools/libclang/CIndex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2787,9 +2787,8 @@ class OpenACCClauseEnqueue : public OpenACCClauseVisitor<OpenACCClauseEnqueue> {
#include "clang/Basic/OpenACCClauses.def"
};

void OpenACCClauseEnqueue::VisitOpenACCDefaultClause(
const OpenACCDefaultClause &C) {}
void OpenACCClauseEnqueue::VisitOpenACCIfClause(const OpenACCIfClause &C) {
void OpenACCClauseEnqueue::VisitDefaultClause(const OpenACCDefaultClause &C) {}
void OpenACCClauseEnqueue::VisitIfClause(const OpenACCIfClause &C) {
Visitor.AddStmt(C.getConditionExpr());
}
} // namespace
Expand Down

0 comments on commit a472e64

Please sign in to comment.