1 //===--- OpenMP.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.
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"
25 /// \brief This represents '#pragma omp threadprivate ...' directive.
26 /// For example, in the following, both 'a' and 'A::b' are threadprivate:
30 /// #pragma omp threadprivate(a)
33 /// #pragma omp threadprivate(b)
37 class OMPThreadPrivateDecl : public Decl {
38 friend class ASTDeclReader;
41 virtual void anchor();
43 OMPThreadPrivateDecl(Kind DK, DeclContext *DC, SourceLocation L) :
44 Decl(DK, DC, L), NumVars(0) { }
46 ArrayRef<const DeclRefExpr *> getVars() const {
47 return ArrayRef<const DeclRefExpr *>(
48 reinterpret_cast<const DeclRefExpr * const *>(this + 1),
52 llvm::MutableArrayRef<DeclRefExpr *> getVars() {
53 return llvm::MutableArrayRef<DeclRefExpr *>(
54 reinterpret_cast<DeclRefExpr **>(this + 1),
58 void setVars(ArrayRef<DeclRefExpr *> VL);
61 static OMPThreadPrivateDecl *Create(ASTContext &C, DeclContext *DC,
63 ArrayRef<DeclRefExpr *> VL);
64 static OMPThreadPrivateDecl *CreateDeserialized(ASTContext &C,
65 unsigned ID, unsigned N);
67 typedef llvm::MutableArrayRef<DeclRefExpr *>::iterator varlist_iterator;
68 typedef ArrayRef<const DeclRefExpr *>::iterator varlist_const_iterator;
70 unsigned varlist_size() const { return NumVars; }
71 bool varlist_empty() const { return NumVars == 0; }
72 varlist_iterator varlist_begin() { return getVars().begin(); }
73 varlist_iterator varlist_end() { return getVars().end(); }
74 varlist_const_iterator varlist_begin() const { return getVars().begin(); }
75 varlist_const_iterator varlist_end() const { return getVars().end(); }
77 static bool classof(const Decl *D) { return classofKind(D->getKind()); }
78 static bool classofKind(Kind K) { return K == OMPThreadPrivate; }
81 } // end namespace clang