From: Roman Lebedev Date: Mon, 28 Jan 2019 17:04:11 +0000 (+0000) Subject: [clang][OpenMP] OMPFlushClause is synthetic, no such clause exists X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d58879f85687fa30cafb3d377bbf05a6929a8032;p=clang [clang][OpenMP] OMPFlushClause is synthetic, no such clause exists Summary: As discussed in https://reviews.llvm.org/D57112#inline-506781, 'flush' clause does not exist in the OpenMP spec, it can not be specified, and `OMPFlushClause` class is just a helper class. Therefore `OPENMP_CLAUSE()` in `clang/Basic/OpenMPKinds.def` should not contain 'flush' "clause". I have simply removed the `OPENMP_CLAUSE(flush, OMPFlushClause)` from `clang/Basic/OpenMPKinds.def`, grepped for `OPENMP_CLAUSE` and added `OPENMP_CLAUSE(flush, OMPFlushClause)` back to the **every** place where `OPENMP_CLAUSE` is defined and `clang/Basic/OpenMPKinds.def` is then included. So as-is, this patch is a NFC. Possibly, some of these `OPENMP_CLAUSE(flush, OMPFlushClause)` should be dropped, i don't really know. Test plan: `ninja check-clang` Reviewers: ABataev Reviewed By: ABataev Subscribers: guansong, arphaman, cfe-commits Tags: #openmp Differential Revision: https://reviews.llvm.org/D57280 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352390 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/OpenMPClause.h b/include/clang/AST/OpenMPClause.h index 9099a86dcd..becb2a1706 100644 --- a/include/clang/AST/OpenMPClause.h +++ b/include/clang/AST/OpenMPClause.h @@ -5318,6 +5318,7 @@ public: #define OPENMP_CLAUSE(Name, Class) \ RetTy Visit ## Class (PTR(Class) S) { DISPATCH(Class); } + OPENMP_CLAUSE(flush, OMPFlushClause) #include "clang/Basic/OpenMPKinds.def" RetTy Visit(PTR(OMPClause) S) { @@ -5326,6 +5327,7 @@ public: default: llvm_unreachable("Unknown clause kind!"); #define OPENMP_CLAUSE(Name, Class) \ case OMPC_ ## Name : return Visit ## Class(static_cast(S)); + OPENMP_CLAUSE(flush, OMPFlushClause) #include "clang/Basic/OpenMPKinds.def" } } @@ -5357,6 +5359,7 @@ public: : OS(OS), Policy(Policy) {} #define OPENMP_CLAUSE(Name, Class) void Visit##Class(Class *S); + OPENMP_CLAUSE(flush, OMPFlushClause) #include "clang/Basic/OpenMPKinds.def" }; diff --git a/include/clang/AST/RecursiveASTVisitor.h b/include/clang/AST/RecursiveASTVisitor.h index 41892a0d7f..51050e80af 100644 --- a/include/clang/AST/RecursiveASTVisitor.h +++ b/include/clang/AST/RecursiveASTVisitor.h @@ -529,6 +529,7 @@ private: bool TraverseOMPLoopDirective(OMPLoopDirective *S); bool TraverseOMPClause(OMPClause *C); #define OPENMP_CLAUSE(Name, Class) bool Visit##Class(Class *C); + OPENMP_CLAUSE(flush, OMPFlushClause) #include "clang/Basic/OpenMPKinds.def" /// Process clauses with list of variables. template bool VisitOMPClauseList(T *Node); @@ -2788,6 +2789,7 @@ bool RecursiveASTVisitor::TraverseOMPClause(OMPClause *C) { case OMPC_##Name: \ TRY_TO(Visit##Class(static_cast(C))); \ break; + OPENMP_CLAUSE(flush, OMPFlushClause) #include "clang/Basic/OpenMPKinds.def" case OMPC_threadprivate: case OMPC_uniform: diff --git a/include/clang/Basic/OpenMPKinds.def b/include/clang/Basic/OpenMPKinds.def index 9411c2971f..7fd28f0c45 100644 --- a/include/clang/Basic/OpenMPKinds.def +++ b/include/clang/Basic/OpenMPKinds.def @@ -258,7 +258,6 @@ OPENMP_CLAUSE(ordered, OMPOrderedClause) OPENMP_CLAUSE(nowait, OMPNowaitClause) OPENMP_CLAUSE(untied, OMPUntiedClause) OPENMP_CLAUSE(mergeable, OMPMergeableClause) -OPENMP_CLAUSE(flush, OMPFlushClause) OPENMP_CLAUSE(read, OMPReadClause) OPENMP_CLAUSE(write, OMPWriteClause) OPENMP_CLAUSE(update, OMPUpdateClause) diff --git a/include/clang/Basic/OpenMPKinds.h b/include/clang/Basic/OpenMPKinds.h index 7f572e599a..17e66a5314 100644 --- a/include/clang/Basic/OpenMPKinds.h +++ b/include/clang/Basic/OpenMPKinds.h @@ -33,6 +33,7 @@ enum OpenMPClauseKind { #define OPENMP_CLAUSE(Name, Class) \ OMPC_##Name, #include "clang/Basic/OpenMPKinds.def" + OMPC_flush, OMPC_threadprivate, OMPC_uniform, OMPC_unknown diff --git a/include/clang/Serialization/ASTReader.h b/include/clang/Serialization/ASTReader.h index 5b92b13722..798adeeade 100644 --- a/include/clang/Serialization/ASTReader.h +++ b/include/clang/Serialization/ASTReader.h @@ -2686,6 +2686,7 @@ public: : Record(Record), Context(Record.getContext()) {} #define OPENMP_CLAUSE(Name, Class) void Visit##Class(Class *C); + OPENMP_CLAUSE(flush, OMPFlushClause) #include "clang/Basic/OpenMPKinds.def" OMPClause *readClause(); void VisitOMPClauseWithPreInit(OMPClauseWithPreInit *C); diff --git a/include/clang/Serialization/ASTWriter.h b/include/clang/Serialization/ASTWriter.h index 32c02bddb5..2d12f6ae17 100644 --- a/include/clang/Serialization/ASTWriter.h +++ b/include/clang/Serialization/ASTWriter.h @@ -999,6 +999,7 @@ class OMPClauseWriter : public OMPClauseVisitor { public: OMPClauseWriter(ASTRecordWriter &Record) : Record(Record) {} #define OPENMP_CLAUSE(Name, Class) void Visit##Class(Class *S); + OPENMP_CLAUSE(flush, OMPFlushClause) #include "clang/Basic/OpenMPKinds.def" void writeClause(OMPClause *C); void VisitOMPClauseWithPreInit(OMPClauseWithPreInit *C); diff --git a/lib/AST/OpenMPClause.cpp b/lib/AST/OpenMPClause.cpp index e87ae3e158..1640995cea 100644 --- a/lib/AST/OpenMPClause.cpp +++ b/lib/AST/OpenMPClause.cpp @@ -30,6 +30,7 @@ OMPClause::child_range OMPClause::children() { #define OPENMP_CLAUSE(Name, Class) \ case OMPC_##Name: \ return static_cast(this)->children(); + OPENMP_CLAUSE(flush, OMPFlushClause) #include "clang/Basic/OpenMPKinds.def" } llvm_unreachable("unknown OMPClause"); diff --git a/lib/AST/StmtProfile.cpp b/lib/AST/StmtProfile.cpp index c064ea90a2..e302b05882 100644 --- a/lib/AST/StmtProfile.cpp +++ b/lib/AST/StmtProfile.cpp @@ -412,6 +412,7 @@ public: OMPClauseProfiler(StmtProfiler *P) : Profiler(P) { } #define OPENMP_CLAUSE(Name, Class) \ void Visit##Class(const Class *C); + OPENMP_CLAUSE(flush, OMPFlushClause) #include "clang/Basic/OpenMPKinds.def" void VistOMPClauseWithPreInit(const OMPClauseWithPreInit *C); void VistOMPClauseWithPostUpdate(const OMPClauseWithPostUpdate *C); diff --git a/lib/Basic/OpenMPKinds.cpp b/lib/Basic/OpenMPKinds.cpp index c89c96f82d..c421517006 100644 --- a/lib/Basic/OpenMPKinds.cpp +++ b/lib/Basic/OpenMPKinds.cpp @@ -67,6 +67,8 @@ const char *clang::getOpenMPClauseName(OpenMPClauseKind Kind) { case OMPC_##Name: \ return #Name; #include "clang/Basic/OpenMPKinds.def" + case OMPC_flush: + return "flush"; case OMPC_uniform: return "uniform"; case OMPC_threadprivate: diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h index 2e434a3c0e..e411a2ad47 100644 --- a/lib/Sema/TreeTransform.h +++ b/lib/Sema/TreeTransform.h @@ -681,6 +681,7 @@ public: #define OPENMP_CLAUSE(Name, Class) \ LLVM_ATTRIBUTE_NOINLINE \ OMPClause *Transform ## Class(Class *S); + OPENMP_CLAUSE(flush, OMPFlushClause) #include "clang/Basic/OpenMPKinds.def" /// Build a new qualified type given its unqualified type and type location. @@ -3311,6 +3312,7 @@ OMPClause *TreeTransform::TransformOMPClause(OMPClause *S) { #define OPENMP_CLAUSE(Name, Class) \ case OMPC_ ## Name : \ return getDerived().Transform ## Class(cast(S)); + OPENMP_CLAUSE(flush, OMPFlushClause) #include "clang/Basic/OpenMPKinds.def" } diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index f4782c2774..08aa6ed1ee 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -2130,6 +2130,7 @@ public: OMPClauseEnqueue(EnqueueVisitor *Visitor) : Visitor(Visitor) { } #define OPENMP_CLAUSE(Name, Class) \ void Visit##Class(const Class *C); + OPENMP_CLAUSE(flush, OMPFlushClause) #include "clang/Basic/OpenMPKinds.def" void VisitOMPClauseWithPreInit(const OMPClauseWithPreInit *C); void VisitOMPClauseWithPostUpdate(const OMPClauseWithPostUpdate *C);