Path: blob/main/contrib/llvm-project/clang/lib/AST/DeclOpenACC.cpp
213766 views
//===--- DeclOpenACC.cpp - Classes for OpenACC Constructs -----------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// This file implements the subclasses of Decl class declared in Decl.h9//10//===----------------------------------------------------------------------===//1112#include "clang/AST/DeclOpenACC.h"13#include "clang/AST/ASTContext.h"14#include "clang/AST/Attr.h"15#include "clang/AST/OpenACCClause.h"1617using namespace clang;1819bool OpenACCConstructDecl::classofKind(Kind K) {20return OpenACCDeclareDecl::classofKind(K) ||21OpenACCRoutineDecl::classofKind(K);22}2324OpenACCDeclareDecl *25OpenACCDeclareDecl::Create(ASTContext &Ctx, DeclContext *DC,26SourceLocation StartLoc, SourceLocation DirLoc,27SourceLocation EndLoc,28ArrayRef<const OpenACCClause *> Clauses) {29return new (Ctx, DC,30additionalSizeToAlloc<const OpenACCClause *>(Clauses.size()))31OpenACCDeclareDecl(DC, StartLoc, DirLoc, EndLoc, Clauses);32}3334OpenACCDeclareDecl *35OpenACCDeclareDecl::CreateDeserialized(ASTContext &Ctx, GlobalDeclID ID,36unsigned NumClauses) {37return new (Ctx, ID, additionalSizeToAlloc<const OpenACCClause *>(NumClauses))38OpenACCDeclareDecl(NumClauses);39}4041OpenACCRoutineDecl *42OpenACCRoutineDecl::Create(ASTContext &Ctx, DeclContext *DC,43SourceLocation StartLoc, SourceLocation DirLoc,44SourceLocation LParenLoc, Expr *FuncRef,45SourceLocation RParenLoc, SourceLocation EndLoc,46ArrayRef<const OpenACCClause *> Clauses) {47return new (Ctx, DC,48additionalSizeToAlloc<const OpenACCClause *>(Clauses.size()))49OpenACCRoutineDecl(DC, StartLoc, DirLoc, LParenLoc, FuncRef, RParenLoc,50EndLoc, Clauses);51}5253OpenACCRoutineDecl *54OpenACCRoutineDecl::CreateDeserialized(ASTContext &Ctx, GlobalDeclID ID,55unsigned NumClauses) {56return new (Ctx, ID, additionalSizeToAlloc<const OpenACCClause *>(NumClauses))57OpenACCRoutineDecl(NumClauses);58}5960void OpenACCRoutineDeclAttr::printPrettyPragma(61llvm::raw_ostream &OS, const clang::PrintingPolicy &P) const {62if (Clauses.size() > 0) {63OS << ' ';64OpenACCClausePrinter Printer{OS, P};65Printer.VisitClauseList(Clauses);66}67}686970