diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2013-09-24 03:17:45 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2013-09-24 03:17:45 +0000 |
commit | 756c196f1463f2c666f853aecb20e198d8af010d (patch) | |
tree | 8643031801147465637162c6ebf28724f76fc425 /clang/tools | |
parent | 036f16dc8c494efca4a342703fd572b6de76a1fa (diff) | |
download | llvm-756c196f1463f2c666f853aecb20e198d8af010d.zip llvm-756c196f1463f2c666f853aecb20e198d8af010d.tar.gz llvm-756c196f1463f2c666f853aecb20e198d8af010d.tar.bz2 |
[OPENMP] Bug fixes and improvements.
1. Fixed constructor of shared clause.
2. Some macros for clauses processing are replaced by private template methods.
3. Additional checks in sema analysis of OpenMP clauses.
llvm-svn: 191265
Diffstat (limited to 'clang/tools')
-rw-r--r-- | clang/tools/libclang/CIndex.cpp | 20 | ||||
-rw-r--r-- | clang/tools/libclang/RecursiveASTVisitor.h | 20 |
2 files changed, 25 insertions, 15 deletions
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp index 036b46d..5d376ae 100644 --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/tools/libclang/CIndex.cpp @@ -1911,6 +1911,9 @@ void EnqueueVisitor::EnqueueChildren(const Stmt *S) { namespace { class OMPClauseEnqueue : public ConstOMPClauseVisitor<OMPClauseEnqueue> { EnqueueVisitor *Visitor; + /// \brief Process clauses with list of variables. + template <typename T> + void VisitOMPClauseList(T *Node); public: OMPClauseEnqueue(EnqueueVisitor *Visitor) : Visitor(Visitor) { } #define OPENMP_CLAUSE(Name, Class) \ @@ -1919,20 +1922,23 @@ public: }; void OMPClauseEnqueue::VisitOMPDefaultClause(const OMPDefaultClause *C) { } -#define PROCESS_OMP_CLAUSE_LIST(Class, Node) \ - for (OMPVarList<Class>::varlist_const_iterator I = Node->varlist_begin(), \ - E = Node->varlist_end(); \ - I != E; ++I) \ + +template<typename T> +void OMPClauseEnqueue::VisitOMPClauseList(T *Node) { + for (typename T::varlist_const_iterator I = Node->varlist_begin(), + E = Node->varlist_end(); + I != E; ++I) Visitor->AddStmt(*I); +} void OMPClauseEnqueue::VisitOMPPrivateClause(const OMPPrivateClause *C) { - PROCESS_OMP_CLAUSE_LIST(OMPPrivateClause, C) + VisitOMPClauseList(C); } void OMPClauseEnqueue::VisitOMPSharedClause(const OMPSharedClause *C) { - PROCESS_OMP_CLAUSE_LIST(OMPSharedClause, C) + VisitOMPClauseList(C); } -#undef PROCESS_OMP_CLAUSE_LIST } + void EnqueueVisitor::EnqueueChildren(const OMPClause *S) { unsigned size = WL.size(); OMPClauseEnqueue Visitor(this); diff --git a/clang/tools/libclang/RecursiveASTVisitor.h b/clang/tools/libclang/RecursiveASTVisitor.h index b8e66d4..fe936f9 100644 --- a/clang/tools/libclang/RecursiveASTVisitor.h +++ b/clang/tools/libclang/RecursiveASTVisitor.h @@ -410,6 +410,9 @@ private: #define OPENMP_CLAUSE(Name, Class) \ bool Visit##Class(Class *C); #include "clang/Basic/OpenMPKinds.def" + /// \brief Process clauses with list of variables. + template <typename T> + void VisitOMPClauseList(T *Node); typedef SmallVector<Stmt *, 16> StmtsTy; typedef SmallVector<StmtsTy *, 4> QueuesTy; @@ -2326,26 +2329,27 @@ bool RecursiveASTVisitor<Derived>::VisitOMPDefaultClause(OMPDefaultClause *C) { return true; } -#define PROCESS_OMP_CLAUSE_LIST(Class, Node) \ - for (OMPVarList<Class>::varlist_iterator I = Node->varlist_begin(), \ - E = Node->varlist_end(); \ - I != E; ++I) \ +template<typename Derived> +template<typename T> +void RecursiveASTVisitor<Derived>::VisitOMPClauseList(T *Node) { + for (typename T::varlist_iterator I = Node->varlist_begin(), + E = Node->varlist_end(); + I != E; ++I) TraverseStmt(*I); +} template<typename Derived> bool RecursiveASTVisitor<Derived>::VisitOMPPrivateClause(OMPPrivateClause *C) { - PROCESS_OMP_CLAUSE_LIST(OMPPrivateClause, C) + VisitOMPClauseList(C); return true; } template<typename Derived> bool RecursiveASTVisitor<Derived>::VisitOMPSharedClause(OMPSharedClause *C) { - PROCESS_OMP_CLAUSE_LIST(OMPSharedClause, C) + VisitOMPClauseList(C); return true; } -#undef PROCESS_OMP_CLAUSE_LIST - // FIXME: look at the following tricky-seeming exprs to see if we // need to recurse on anything. These are ones that have methods // returning decls or qualtypes or nestednamespecifier -- though I'm |