clang 19.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/Decl.h"
17#include "clang/AST/Type.h"
20#include "clang/Sema/SemaBase.h"
21#include "llvm/ADT/DenseSet.h"
22
23namespace clang {
24
25class SemaSYCL : public SemaBase {
26public:
27 SemaSYCL(Sema &S);
28
29 /// Creates a SemaDiagnosticBuilder that emits the diagnostic if the current
30 /// context is "used as device code".
31 ///
32 /// - If CurLexicalContext is a kernel function or it is known that the
33 /// function will be emitted for the device, emits the diagnostics
34 /// immediately.
35 /// - If CurLexicalContext is a function and we are compiling
36 /// for the device, but we don't know yet that this function will be
37 /// codegen'ed for the devive, creates a diagnostic which is emitted if and
38 /// when we realize that the function will be codegen'ed.
39 ///
40 /// Example usage:
41 ///
42 /// Diagnose __float128 type usage only from SYCL device code if the current
43 /// target doesn't support it
44 /// if (!S.Context.getTargetInfo().hasFloat128Type() &&
45 /// S.getLangOpts().SYCLIsDevice)
46 /// DiagIfDeviceCode(Loc, diag::err_type_unsupported) << "__float128";
48
51 ValueDecl *DeclToCheck);
52
54 SourceLocation LParen,
55 SourceLocation RParen,
56 TypeSourceInfo *TSI);
58 SourceLocation LParen,
59 SourceLocation RParen,
60 ParsedType ParsedTy);
61};
62
63} // namespace clang
64
65#endif // LLVM_CLANG_SEMA_SEMASYCL_H
llvm::DenseSet< const void * > Visited
Definition: HTMLLogger.cpp:146
Defines the clang::SourceLocation class and associated facilities.
C Language Family Type Representation.
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:24
ExprResult BuildUniqueStableNameExpr(SourceLocation OpLoc, SourceLocation LParen, SourceLocation RParen, TypeSourceInfo *TSI)
Definition: SemaSYCL.cpp:137
void deepTypeCheckForDevice(SourceLocation UsedAt, llvm::DenseSet< QualType > Visited, ValueDecl *DeclToCheck)
Definition: SemaSYCL.cpp:45
ExprResult ActOnUniqueStableNameExpr(SourceLocation OpLoc, SourceLocation LParen, SourceLocation RParen, ParsedType ParsedTy)
Definition: SemaSYCL.cpp:145
Sema - This implements semantic analysis and AST building for C.
Definition: Sema.h:457
Encodes a location in the source.
A container of type source information.
Definition: Type.h:7330
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Definition: Decl.h:706
The JSON file list parser is used to communicate input to InstallAPI.