1 //===- DeclOpenMP.h - Classes for representing OpenMP directives -*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 /// \brief This file defines OpenMP nodes for declarative directives.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_CLANG_AST_OPENMP_H
16 #define LLVM_CLANG_AST_OPENMP_H
18 #include "clang/AST/DeclBase.h"
19 #include "llvm/ADT/ArrayRef.h"
23 /// \brief This represents '#pragma omp threadprivate ...' directive.
24 /// For example, in the following, both 'a' and 'A::b' are threadprivate:
28 /// #pragma omp threadprivate(a)
31 /// #pragma omp threadprivate(b)
35 class OMPThreadPrivateDecl : public Decl {
36 friend class ASTDeclReader;
39 virtual void anchor();
41 OMPThreadPrivateDecl(Kind DK, DeclContext *DC, SourceLocation L) :
42 Decl(DK, DC, L), NumVars(0) { }
44 ArrayRef<const Expr *> getVars() const {
45 return ArrayRef<const Expr *>(
46 reinterpret_cast<const Expr * const *>(this + 1),
50 llvm::MutableArrayRef<Expr *> getVars() {
51 return llvm::MutableArrayRef<Expr *>(
52 reinterpret_cast<Expr **>(this + 1),
56 void setVars(ArrayRef<Expr *> VL);
59 static OMPThreadPrivateDecl *Create(ASTContext &C, DeclContext *DC,
62 static OMPThreadPrivateDecl *CreateDeserialized(ASTContext &C,
63 unsigned ID, unsigned N);
65 typedef llvm::MutableArrayRef<Expr *>::iterator varlist_iterator;
66 typedef ArrayRef<const Expr *>::iterator varlist_const_iterator;
68 unsigned varlist_size() const { return NumVars; }
69 bool varlist_empty() const { return NumVars == 0; }
70 varlist_iterator varlist_begin() { return getVars().begin(); }
71 varlist_iterator varlist_end() { return getVars().end(); }
72 varlist_const_iterator varlist_begin() const { return getVars().begin(); }
73 varlist_const_iterator varlist_end() const { return getVars().end(); }
75 static bool classof(const Decl *D) { return classofKind(D->getKind()); }
76 static bool classofKind(Kind K) { return K == OMPThreadPrivate; }
79 } // end namespace clang