diff options
| author | Roman Lebedev <lebedev.ri@gmail.com> | 2019-03-06 07:45:10 +0000 |
|---|---|---|
| committer | Roman Lebedev <lebedev.ri@gmail.com> | 2019-03-06 07:45:10 +0000 |
| commit | 045738812540eb3266135df78585e02fd6019c61 (patch) | |
| tree | d0f91ddd50fd58ba7c51c5d6fa2af4da5d05e81f | |
| parent | c0e01d29a467f8e1f75e3a351aef9d08617b45cd (diff) | |
| download | bcm5719-llvm-045738812540eb3266135df78585e02fd6019c61.tar.gz bcm5719-llvm-045738812540eb3266135df78585e02fd6019c61.zip | |
[clang][OpenMP] Revert "OMPFlushClause is synthetic, no such clause exists"
Summary:
This reverts rL352390 / D57280.
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.
Now, here's the caveat. I have read @ABataev's
> Well, I think it would be good to filter out OMPC_flush somehow
> because there is no such clause actually, it is a pseudo clause
> for better handling of the flush directive.
as if that clause is pseudo clause that only exists for the sole
purpose of simplifying the parser. As in, it never reaches AST.
I did not however try to verify that. Too bad, i was wrong.
It absolutely *does* reach AST. Therefore my understanding/justification
for the change was flawed, which makes the patch a regression which **must** be reverted.
@gribozavr has brought that up again in https://reviews.llvm.org/D57112#inline-521238
> > ...
> Sorry to be late for this discussion, but I don't think this conclusion
> follows. ASTMatchers are supposed to match the AST as it is.
> Even if OMPC_flush is synthetic, it exists in the AST, and users might
> want to match it. I think users would find anything else (trying to filter
> out AST nodes that are not in the source code) to be surprising. For example,
> there's a matcher materializeTemporaryExpr even though this AST node is a
> Clang invention and is not a part of the C++ spec.
>
> Matching only constructs that appear in the source code is not feasible with
> ASTMatchers, because they are based on Clang's AST that exposes tons of semantic
> information, and its design is dictated by the structure of the semantic information.
> See "RFC: Tree-based refactorings with Clang" in cfe-dev for a library that will
> focus on representing source code as faithfully as possible.
>
> Not to even mention that this code is in ASTTypeTraits, a general library for
> handling AST nodes, not specifically for AST Matchers...
Reviewers: gribozavr, ABataev, rjmccall, aaron.ballman
Reviewed By: gribozavr, ABataev
Subscribers: dylanmckay, guansong, arphaman, jdoerfert, cfe-commits, gribozavr, ABataev
Tags: #clang, #openmp
Differential Revision: https://reviews.llvm.org/D58979
llvm-svn: 355486
| -rw-r--r-- | clang/include/clang/AST/OpenMPClause.h | 3 | ||||
| -rw-r--r-- | clang/include/clang/AST/RecursiveASTVisitor.h | 2 | ||||
| -rw-r--r-- | clang/include/clang/Basic/OpenMPKinds.def | 1 | ||||
| -rw-r--r-- | clang/include/clang/Basic/OpenMPKinds.h | 1 | ||||
| -rw-r--r-- | clang/include/clang/Serialization/ASTReader.h | 1 | ||||
| -rw-r--r-- | clang/include/clang/Serialization/ASTWriter.h | 1 | ||||
| -rw-r--r-- | clang/lib/AST/OpenMPClause.cpp | 1 | ||||
| -rw-r--r-- | clang/lib/AST/StmtProfile.cpp | 1 | ||||
| -rw-r--r-- | clang/lib/Basic/OpenMPKinds.cpp | 2 | ||||
| -rw-r--r-- | clang/lib/Sema/TreeTransform.h | 2 | ||||
| -rw-r--r-- | clang/tools/libclang/CIndex.cpp | 1 |
11 files changed, 1 insertions, 15 deletions
diff --git a/clang/include/clang/AST/OpenMPClause.h b/clang/include/clang/AST/OpenMPClause.h index 1aa1c82b1a9..746a24f6a33 100644 --- a/clang/include/clang/AST/OpenMPClause.h +++ b/clang/include/clang/AST/OpenMPClause.h @@ -5421,7 +5421,6 @@ 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) { @@ -5430,7 +5429,6 @@ public: 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" } } @@ -5462,7 +5460,6 @@ 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/clang/include/clang/AST/RecursiveASTVisitor.h b/clang/include/clang/AST/RecursiveASTVisitor.h index 224e5b3480b..c96da1e0e7a 100644 --- a/clang/include/clang/AST/RecursiveASTVisitor.h +++ b/clang/include/clang/AST/RecursiveASTVisitor.h @@ -529,7 +529,6 @@ 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 <typename T> bool VisitOMPClauseList(T *Node); @@ -2796,7 +2795,6 @@ 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: diff --git a/clang/include/clang/Basic/OpenMPKinds.def b/clang/include/clang/Basic/OpenMPKinds.def index b8de5df02ca..0aef6fe4e3a 100644 --- a/clang/include/clang/Basic/OpenMPKinds.def +++ b/clang/include/clang/Basic/OpenMPKinds.def @@ -268,6 +268,7 @@ 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/clang/include/clang/Basic/OpenMPKinds.h b/clang/include/clang/Basic/OpenMPKinds.h index 01bd860f19c..d8dee2310ec 100644 --- a/clang/include/clang/Basic/OpenMPKinds.h +++ b/clang/include/clang/Basic/OpenMPKinds.h @@ -33,7 +33,6 @@ 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/clang/include/clang/Serialization/ASTReader.h b/clang/include/clang/Serialization/ASTReader.h index 798adeeadec..5b92b137224 100644 --- a/clang/include/clang/Serialization/ASTReader.h +++ b/clang/include/clang/Serialization/ASTReader.h @@ -2686,7 +2686,6 @@ 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/clang/include/clang/Serialization/ASTWriter.h b/clang/include/clang/Serialization/ASTWriter.h index 2d12f6ae174..32c02bddb53 100644 --- a/clang/include/clang/Serialization/ASTWriter.h +++ b/clang/include/clang/Serialization/ASTWriter.h @@ -999,7 +999,6 @@ 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); diff --git a/clang/lib/AST/OpenMPClause.cpp b/clang/lib/AST/OpenMPClause.cpp index b02a888a8cd..a50e2de7f51 100644 --- a/clang/lib/AST/OpenMPClause.cpp +++ b/clang/lib/AST/OpenMPClause.cpp @@ -30,7 +30,6 @@ 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"); diff --git a/clang/lib/AST/StmtProfile.cpp b/clang/lib/AST/StmtProfile.cpp index e302b058821..c064ea90a26 100644 --- a/clang/lib/AST/StmtProfile.cpp +++ b/clang/lib/AST/StmtProfile.cpp @@ -412,7 +412,6 @@ 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/clang/lib/Basic/OpenMPKinds.cpp b/clang/lib/Basic/OpenMPKinds.cpp index b10c6d2498e..493ac7b2c67 100644 --- a/clang/lib/Basic/OpenMPKinds.cpp +++ b/clang/lib/Basic/OpenMPKinds.cpp @@ -67,8 +67,6 @@ 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/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h index 386b23db3a2..605d5233281 100644 --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -691,7 +691,6 @@ 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. @@ -3323,7 +3322,6 @@ 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" } diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp index 78a1290de65..cdcdfc167b2 100644 --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/tools/libclang/CIndex.cpp @@ -2130,7 +2130,6 @@ 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); |

