diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2013-07-19 03:13:43 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2013-07-19 03:13:43 +0000 |
commit | 5ec3eb11fcb86c9b65588315dec2898d9be39499 (patch) | |
tree | 47db933e9ac15e1d4378e63c5b8b70c7b5daf4e9 /clang/tools/libclang/RecursiveASTVisitor.h | |
parent | 63c5c2a0d8258ed4fb6b536ad2e60f26f946675c (diff) | |
download | bcm5719-llvm-5ec3eb11fcb86c9b65588315dec2898d9be39499.tar.gz bcm5719-llvm-5ec3eb11fcb86c9b65588315dec2898d9be39499.zip |
OpenMP: basic support for #pragma omp parallel
llvm-svn: 186647
Diffstat (limited to 'clang/tools/libclang/RecursiveASTVisitor.h')
-rw-r--r-- | clang/tools/libclang/RecursiveASTVisitor.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/clang/tools/libclang/RecursiveASTVisitor.h b/clang/tools/libclang/RecursiveASTVisitor.h index c61f6cdb2c1..2668db54797 100644 --- a/clang/tools/libclang/RecursiveASTVisitor.h +++ b/clang/tools/libclang/RecursiveASTVisitor.h @@ -27,6 +27,7 @@ #include "clang/AST/Stmt.h" #include "clang/AST/StmtCXX.h" #include "clang/AST/StmtObjC.h" +#include "clang/AST/StmtOpenMP.h" #include "clang/AST/TemplateBase.h" #include "clang/AST/TemplateName.h" #include "clang/AST/Type.h" @@ -404,6 +405,10 @@ private: bool TraverseDeclContextHelper(DeclContext *DC); bool TraverseFunctionHelper(FunctionDecl *D); bool TraverseVarHelper(VarDecl *D); + bool TraverseOMPClause(OMPClause *C); +#define OPENMP_CLAUSE(Name, Class) \ + bool Visit##Class(Class *C); +#include "clang/Basic/OpenMPKinds.def" typedef SmallVector<Stmt *, 16> StmtsTy; typedef SmallVector<StmtsTy *, 4> QueuesTy; @@ -2202,6 +2207,47 @@ DEF_TRAVERSE_STMT(ObjCDictionaryLiteral, { }) // Traverse OpenCL: AsType, Convert. DEF_TRAVERSE_STMT(AsTypeExpr, { }) +// OpenMP directives. +DEF_TRAVERSE_STMT(OMPParallelDirective, { + ArrayRef<OMPClause *> Clauses = S->clauses(); + for (ArrayRef<OMPClause *>::iterator I = Clauses.begin(), E = Clauses.end(); + I != E; ++I) + if (!TraverseOMPClause(*I)) return false; +}) + +// OpenMP clauses. +template<typename Derived> +bool RecursiveASTVisitor<Derived>::TraverseOMPClause(OMPClause *C) { + if (!C) return true; + switch (C->getClauseKind()) { +#define OPENMP_CLAUSE(Name, Class) \ + case OMPC_##Name: \ + return getDerived().Visit##Class(static_cast<Class*>(C)); +#include "clang/Basic/OpenMPKinds.def" + default: break; + } + return true; +} + +template<typename Derived> +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) \ + TraverseStmt(*I); + +template<typename Derived> +bool RecursiveASTVisitor<Derived>::VisitOMPPrivateClause(OMPPrivateClause *C) { + PROCESS_OMP_CLAUSE_LIST(OMPPrivateClause, 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 |