clang 20.0.0git
SemaSYCL.h
Go to the documentation of this file.
1//===----- SemaSYCL.h ------- Semantic Analysis for SYCL 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/// \file
9/// This file declares semantic analysis for SYCL constructs.
10///
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_CLANG_SEMA_SEMASYCL_H
14#define LLVM_CLANG_SEMA_SEMASYCL_H
15
16#include "clang/AST/ASTFwd.h"
17#include "clang/AST/Type.h"
20#include "clang/Sema/SemaBase.h"
21#include "llvm/ADT/DenseSet.h"
22
23namespace clang {
24class Decl;
25class ParsedAttr;
26
27class SemaSYCL : public SemaBase {
28public:
29 SemaSYCL(Sema &S);
30
31 /// Creates a SemaDiagnosticBuilder that emits the diagnostic if the current
32 /// context is "used as device code".
33 ///
34 /// - If CurLexicalContext is a kernel function or it is known that the
35 /// function will be emitted for the device, emits the diagnostics
36 /// immediately.
37 /// - If CurLexicalContext is a function and we are compiling
38 /// for the device, but we don't know yet that this function will be
39 /// codegen'ed for the devive, creates a diagnostic which is emitted if and
40 /// when we realize that the function will be codegen'ed.
41 ///
42 /// Example usage:
43 ///
44 /// Diagnose __float128 type usage only from SYCL device code if the current
45 /// target doesn't support it
46 /// if (!S.Context.getTargetInfo().hasFloat128Type() &&
47 /// S.getLangOpts().SYCLIsDevice)
48 /// DiagIfDeviceCode(Loc, diag::err_type_unsupported) << "__float128";
50
52 llvm::DenseSet<QualType> Visited,
53 ValueDecl *DeclToCheck);
54
56 SourceLocation LParen,
57 SourceLocation RParen,
58 TypeSourceInfo *TSI);
60 SourceLocation LParen,
61 SourceLocation RParen,
62 ParsedType ParsedTy);
63
64 void handleKernelAttr(Decl *D, const ParsedAttr &AL);
66};
67
68} // namespace clang
69
70#endif // LLVM_CLANG_SEMA_SEMASYCL_H
Forward declaration of all AST node types.
const Decl * D
llvm::DenseSet< const void * > Visited
Definition: HTMLLogger.cpp:145
SourceLocation Loc
Definition: SemaObjC.cpp:759
Defines the clang::SourceLocation class and associated facilities.
C Language Family Type Representation.
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:86
ParsedAttr - Represents a syntactic attribute.
Definition: ParsedAttr.h:129
A generic diagnostic builder for errors which may or may not be deferred.
Definition: SemaBase.h:110
SemaDiagnosticBuilder DiagIfDeviceCode(SourceLocation Loc, unsigned DiagID)
Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as device c...
Definition: SemaSYCL.cpp:26
ExprResult BuildUniqueStableNameExpr(SourceLocation OpLoc, SourceLocation LParen, SourceLocation RParen, TypeSourceInfo *TSI)
Definition: SemaSYCL.cpp:139
void handleKernelEntryPointAttr(Decl *D, const ParsedAttr &AL)
Definition: SemaSYCL.cpp:201
void deepTypeCheckForDevice(SourceLocation UsedAt, llvm::DenseSet< QualType > Visited, ValueDecl *DeclToCheck)
Definition: SemaSYCL.cpp:47
void handleKernelAttr(Decl *D, const ParsedAttr &AL)
Definition: SemaSYCL.cpp:162
ExprResult ActOnUniqueStableNameExpr(SourceLocation OpLoc, SourceLocation LParen, SourceLocation RParen, ParsedType ParsedTy)
Definition: SemaSYCL.cpp:147
Sema - This implements semantic analysis and AST building for C.
Definition: Sema.h:463
Encodes a location in the source.
A container of type source information.
Definition: Type.h:7902
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Definition: Decl.h:671
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
The JSON file list parser is used to communicate input to InstallAPI.