aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2013-09-24 03:17:45 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2013-09-24 03:17:45 +0000
commit543c4ae954f2bce5ac58ed22080f23cbd94794d2 (patch)
treef7323dbbf5dfedce38007083e368778253783074 /tools
parentaee8e168112a3cbb6282ab4c6b5ae63933053ebf (diff)
downloadclang-543c4ae954f2bce5ac58ed22080f23cbd94794d2.tar.gz
[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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191265 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/libclang/CIndex.cpp20
-rw-r--r--tools/libclang/RecursiveASTVisitor.h20
2 files changed, 25 insertions, 15 deletions
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index 036b46dcf7..5d376ae6ad 100644
--- a/tools/libclang/CIndex.cpp
+++ b/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/tools/libclang/RecursiveASTVisitor.h b/tools/libclang/RecursiveASTVisitor.h
index b8e66d481b..fe936f922e 100644
--- a/tools/libclang/RecursiveASTVisitor.h
+++ b/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