etc/services - sync with NetBSD-8
[minix.git] / external / bsd / llvm / dist / clang / lib / AST / DeclOpenMP.cpp
blob5f8b42b3f9644a2e5b8a70459f407007c0babae5
1 //===--- DeclOpenMP.cpp - Declaration OpenMP AST Node Implementation ------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 /// \file
10 /// \brief This file implements OMPThreadPrivateDecl class.
11 ///
12 //===----------------------------------------------------------------------===//
14 #include "clang/AST/ASTContext.h"
15 #include "clang/AST/Decl.h"
16 #include "clang/AST/DeclBase.h"
17 #include "clang/AST/DeclOpenMP.h"
18 #include "clang/AST/Expr.h"
20 using namespace clang;
22 //===----------------------------------------------------------------------===//
23 // OMPThreadPrivateDecl Implementation.
24 //===----------------------------------------------------------------------===//
26 void OMPThreadPrivateDecl::anchor() { }
28 OMPThreadPrivateDecl *OMPThreadPrivateDecl::Create(ASTContext &C,
29 DeclContext *DC,
30 SourceLocation L,
31 ArrayRef<Expr *> VL) {
32 OMPThreadPrivateDecl *D = new (C, DC, VL.size() * sizeof(Expr *))
33 OMPThreadPrivateDecl(OMPThreadPrivate, DC, L);
34 D->NumVars = VL.size();
35 D->setVars(VL);
36 return D;
39 OMPThreadPrivateDecl *OMPThreadPrivateDecl::CreateDeserialized(ASTContext &C,
40 unsigned ID,
41 unsigned N) {
42 OMPThreadPrivateDecl *D = new (C, ID, N * sizeof(Expr *))
43 OMPThreadPrivateDecl(OMPThreadPrivate, nullptr, SourceLocation());
44 D->NumVars = N;
45 return D;
48 void OMPThreadPrivateDecl::setVars(ArrayRef<Expr *> VL) {
49 assert(VL.size() == NumVars &&
50 "Number of variables is not the same as the preallocated buffer");
51 Expr **Vars = reinterpret_cast<Expr **>(this + 1);
52 std::copy(VL.begin(), VL.end(), Vars);