[clang] a472e64 - [NFC][OpenACC] Rename visitor functions to omit redundant OpenACC

via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 12 14:42:13 PDT 2024


Author: erichkeane
Date: 2024-04-12T14:42:06-07:00
New Revision: a472e6473e6921f22427d41c3d29e9a26eb4ab32

URL: https://github.com/llvm/llvm-project/commit/a472e6473e6921f22427d41c3d29e9a26eb4ab32
DIFF: https://github.com/llvm/llvm-project/commit/a472e6473e6921f22427d41c3d29e9a26eb4ab32.diff

LOG: [NFC][OpenACC] Rename visitor functions to omit redundant OpenACC

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.

Added: 
    

Modified: 
    clang/include/clang/AST/OpenACCClause.h
    clang/lib/AST/OpenACCClause.cpp
    clang/lib/AST/StmtProfile.cpp
    clang/tools/libclang/CIndex.cpp

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/AST/OpenACCClause.h b/clang/include/clang/AST/OpenACCClause.h
index 712ad46c0f238d..401b8e904a1b7a 100644
--- a/clang/include/clang/AST/OpenACCClause.h
+++ b/clang/include/clang/AST/OpenACCClause.h
@@ -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:
@@ -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"
@@ -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"
 };
 

diff  --git a/clang/lib/AST/OpenACCClause.cpp b/clang/lib/AST/OpenACCClause.cpp
index 2bc8d14fa129b4..446e4700320471 100644
--- a/clang/lib/AST/OpenACCClause.cpp
+++ b/clang/lib/AST/OpenACCClause.cpp
@@ -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() << ")";
 }

diff  --git a/clang/lib/AST/StmtProfile.cpp b/clang/lib/AST/StmtProfile.cpp
index 44b635bfb8433b..68ba7475f4ca42 100644
--- a/clang/lib/AST/StmtProfile.cpp
+++ b/clang/lib/AST/StmtProfile.cpp
@@ -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");

diff  --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp
index 936e8872513ae6..b999750c0f5e32 100644
--- a/clang/tools/libclang/CIndex.cpp
+++ b/clang/tools/libclang/CIndex.cpp
@@ -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


        


More information about the cfe-commits mailing list