//===- DeclOpenMP.h - Classes for representing OpenMP directives -*- C++ -*-==// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// /// /// \file /// This file defines OpenMP nodes for declarative directives. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_AST_DECLOPENMP_H #define LLVM_CLANG_AST_DECLOPENMP_H #include "clang/AST/ASTContext.h" #include "clang/AST/Decl.h" #include "clang/AST/Expr.h" #include "clang/AST/ExternalASTSource.h" #include "clang/AST/OpenMPClause.h" #include "clang/AST/Type.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/Support/TrailingObjects.h" namespace clang { /// This is a basic class for representing single OpenMP declarative directive. /// template <typename U> class OMPDeclarativeDirective : public U { … }; /// This represents '#pragma omp threadprivate ...' directive. /// For example, in the following, both 'a' and 'A::b' are threadprivate: /// /// \code /// int a; /// #pragma omp threadprivate(a) /// struct A { /// static int b; /// #pragma omp threadprivate(b) /// }; /// \endcode /// class OMPThreadPrivateDecl final : public OMPDeclarativeDirective<Decl> { … }; enum class OMPDeclareReductionInitKind { … }; /// This represents '#pragma omp declare reduction ...' directive. /// For example, in the following, declared reduction 'foo' for types 'int' and /// 'float': /// /// \code /// #pragma omp declare reduction (foo : int,float : omp_out += omp_in) /// initializer (omp_priv = 0) /// \endcode /// /// Here 'omp_out += omp_in' is a combiner and 'omp_priv = 0' is an initializer. class OMPDeclareReductionDecl final : public ValueDecl, public DeclContext { … }; /// This represents '#pragma omp declare mapper ...' directive. Map clauses are /// allowed to use with this directive. The following example declares a user /// defined mapper for the type 'struct vec'. This example instructs the fields /// 'len' and 'data' should be mapped when mapping instances of 'struct vec'. /// /// \code /// #pragma omp declare mapper(mid: struct vec v) map(v.len, v.data[0:N]) /// \endcode class OMPDeclareMapperDecl final : public OMPDeclarativeDirective<ValueDecl>, public DeclContext { … }; /// Pseudo declaration for capturing expressions. Also is used for capturing of /// non-static data members in non-static member functions. /// /// Clang supports capturing of variables only, but OpenMP 4.5 allows to /// privatize non-static members of current class in non-static member /// functions. This pseudo-declaration allows properly handle this kind of /// capture by wrapping captured expression into a variable-like declaration. class OMPCapturedExprDecl final : public VarDecl { … }; /// This represents '#pragma omp requires...' directive. /// For example /// /// \code /// #pragma omp requires unified_address /// \endcode /// class OMPRequiresDecl final : public OMPDeclarativeDirective<Decl> { … }; /// This represents '#pragma omp allocate ...' directive. /// For example, in the following, the default allocator is used for both 'a' /// and 'A::b': /// /// \code /// int a; /// #pragma omp allocate(a) /// struct A { /// static int b; /// #pragma omp allocate(b) /// }; /// \endcode /// class OMPAllocateDecl final : public OMPDeclarativeDirective<Decl> { … }; } // end namespace clang #endif