1 | //===--- StmtOpenACC.cpp - Classes for OpenACC Constructs -----------------===// |
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | // |
9 | // This file implements the subclasses of Stmt class declared in StmtOpenACC.h |
10 | // |
11 | //===----------------------------------------------------------------------===// |
12 | |
13 | #include "clang/AST/StmtOpenACC.h" |
14 | #include "clang/AST/ASTContext.h" |
15 | using namespace clang; |
16 | |
17 | OpenACCComputeConstruct * |
18 | OpenACCComputeConstruct::CreateEmpty(const ASTContext &C, unsigned NumClauses) { |
19 | void *Mem = C.Allocate( |
20 | Size: OpenACCComputeConstruct::totalSizeToAlloc<const OpenACCClause *>( |
21 | Counts: NumClauses)); |
22 | auto *Inst = new (Mem) OpenACCComputeConstruct(NumClauses); |
23 | return Inst; |
24 | } |
25 | |
26 | OpenACCComputeConstruct * |
27 | OpenACCComputeConstruct::Create(const ASTContext &C, OpenACCDirectiveKind K, |
28 | SourceLocation BeginLoc, SourceLocation EndLoc, |
29 | ArrayRef<const OpenACCClause *> Clauses, |
30 | Stmt *StructuredBlock) { |
31 | void *Mem = C.Allocate( |
32 | Size: OpenACCComputeConstruct::totalSizeToAlloc<const OpenACCClause *>( |
33 | Counts: Clauses.size())); |
34 | auto *Inst = new (Mem) |
35 | OpenACCComputeConstruct(K, BeginLoc, EndLoc, Clauses, StructuredBlock); |
36 | return Inst; |
37 | } |
38 | |