clang 24.0.0git
GlobalDecl.cpp
Go to the documentation of this file.
1//===--- GlobalDecl.cpp - Global declaration holder -------------*- C++ -*-===//
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// GlobalDecl.h is included very widely, so these members are defined here to
10// keep the OpenMP and OpenACC declaration hierarchies, the generated attribute
11// classes, and the template declaration hierarchy out of it.
12//
13//===----------------------------------------------------------------------===//
14
16
17#include "clang/AST/Attr.h"
21
22using namespace clang;
23
28
29bool GlobalDecl::hasCUDAGlobalAttr(const Decl *D) {
30 return D->hasAttr<CUDAGlobalAttr>();
31}
32
33bool GlobalDecl::isKernelReference(const Decl *D) {
34 if (const auto *FD = dyn_cast<FunctionDecl>(D))
35 return FD->isReferenceableKernel();
36 if (const auto *FTD = dyn_cast<FunctionTemplateDecl>(D))
37 return FTD->getTemplatedDecl()->hasAttr<CUDAGlobalAttr>();
38 return false;
39}
40
43 return (D->hasAttr<DeviceKernelAttr>() || D->getLangOpts().CUDAIsDevice)
46}
This file defines OpenACC nodes for declarative directives.
This file defines OpenMP nodes for declarative directives.
Defines the C++ template declaration subclasses.
Decl - This represents one declaration (or definition), e.g.
Definition DeclBase.h:86
bool hasAttr() const
Definition DeclBase.h:585
const LangOptions & getLangOpts() const LLVM_READONLY
Helper to get the language options from the ASTContext.
Definition DeclBase.cpp:556
Represents a function declaration or definition.
Definition Decl.h:2058
static CLANG_ABI KernelReferenceKind getDefaultKernelReference(const FunctionDecl *D)
GlobalDecl()=default
This represents 'pragma omp declare mapper ...' directive.
Definition DeclOpenMP.h:349
This represents 'pragma omp declare reduction ...' directive.
Definition DeclOpenMP.h:239
Top level wrappers for InstallAPI frontend operations.
KernelReferenceKind
Definition GlobalDecl.h:43