Skip to content

Commit

Permalink
[clang][OpenMP] OMPFlushClause is synthetic, no such clause exists
Browse files Browse the repository at this point in the history
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

llvm-svn: 352390
  • Loading branch information
LebedevRI committed Jan 28, 2019
1 parent 2c17512 commit 23019f9
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 1 deletion.
3 changes: 3 additions & 0 deletions clang/include/clang/AST/OpenMPClause.h
Expand Up @@ -5318,6 +5318,7 @@ class OMPClauseVisitorBase {

#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) {
Expand All @@ -5326,6 +5327,7 @@ class OMPClauseVisitorBase {
default: llvm_unreachable("Unknown clause kind!");
#define OPENMP_CLAUSE(Name, Class) \
case OMPC_ ## Name : return Visit ## Class(static_cast<PTR(Class)>(S));
OPENMP_CLAUSE(flush, OMPFlushClause)
#include "clang/Basic/OpenMPKinds.def"
}
}
Expand Down Expand Up @@ -5357,6 +5359,7 @@ class OMPClausePrinter final : public OMPClauseVisitor<OMPClausePrinter> {
: OS(OS), Policy(Policy) {}

#define OPENMP_CLAUSE(Name, Class) void Visit##Class(Class *S);
OPENMP_CLAUSE(flush, OMPFlushClause)
#include "clang/Basic/OpenMPKinds.def"
};

Expand Down
2 changes: 2 additions & 0 deletions clang/include/clang/AST/RecursiveASTVisitor.h
Expand Up @@ -529,6 +529,7 @@ template <typename Derived> class RecursiveASTVisitor {
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 <typename T> bool VisitOMPClauseList(T *Node);
Expand Down Expand Up @@ -2788,6 +2789,7 @@ bool RecursiveASTVisitor<Derived>::TraverseOMPClause(OMPClause *C) {
case OMPC_##Name: \
TRY_TO(Visit##Class(static_cast<Class *>(C))); \
break;
OPENMP_CLAUSE(flush, OMPFlushClause)
#include "clang/Basic/OpenMPKinds.def"
case OMPC_threadprivate:
case OMPC_uniform:
Expand Down
1 change: 0 additions & 1 deletion clang/include/clang/Basic/OpenMPKinds.def
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions clang/include/clang/Basic/OpenMPKinds.h
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions clang/include/clang/Serialization/ASTReader.h
Expand Up @@ -2686,6 +2686,7 @@ class OMPClauseReader : public OMPClauseVisitor<OMPClauseReader> {
: 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);
Expand Down
1 change: 1 addition & 0 deletions clang/include/clang/Serialization/ASTWriter.h
Expand Up @@ -999,6 +999,7 @@ class OMPClauseWriter : public OMPClauseVisitor<OMPClauseWriter> {
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);
Expand Down
1 change: 1 addition & 0 deletions clang/lib/AST/OpenMPClause.cpp
Expand Up @@ -30,6 +30,7 @@ OMPClause::child_range OMPClause::children() {
#define OPENMP_CLAUSE(Name, Class) \
case OMPC_##Name: \
return static_cast<Class *>(this)->children();
OPENMP_CLAUSE(flush, OMPFlushClause)
#include "clang/Basic/OpenMPKinds.def"
}
llvm_unreachable("unknown OMPClause");
Expand Down
1 change: 1 addition & 0 deletions clang/lib/AST/StmtProfile.cpp
Expand Up @@ -412,6 +412,7 @@ class OMPClauseProfiler : public ConstOMPClauseVisitor<OMPClauseProfiler> {
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);
Expand Down
2 changes: 2 additions & 0 deletions clang/lib/Basic/OpenMPKinds.cpp
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions clang/lib/Sema/TreeTransform.h
Expand Up @@ -681,6 +681,7 @@ class TreeTransform {
#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.
Expand Down Expand Up @@ -3311,6 +3312,7 @@ OMPClause *TreeTransform<Derived>::TransformOMPClause(OMPClause *S) {
#define OPENMP_CLAUSE(Name, Class) \
case OMPC_ ## Name : \
return getDerived().Transform ## Class(cast<Class>(S));
OPENMP_CLAUSE(flush, OMPFlushClause)
#include "clang/Basic/OpenMPKinds.def"
}

Expand Down
1 change: 1 addition & 0 deletions clang/tools/libclang/CIndex.cpp
Expand Up @@ -2130,6 +2130,7 @@ class OMPClauseEnqueue : public ConstOMPClauseVisitor<OMPClauseEnqueue> {
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);
Expand Down

0 comments on commit 23019f9

Please sign in to comment.