Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:37:05

0001 //===----- SemaSYCL.h ------- Semantic Analysis for SYCL constructs -------===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 /// \file
0009 /// This file declares semantic analysis for SYCL constructs.
0010 ///
0011 //===----------------------------------------------------------------------===//
0012 
0013 #ifndef LLVM_CLANG_SEMA_SEMASYCL_H
0014 #define LLVM_CLANG_SEMA_SEMASYCL_H
0015 
0016 #include "clang/AST/ASTFwd.h"
0017 #include "clang/AST/Type.h"
0018 #include "clang/Basic/SourceLocation.h"
0019 #include "clang/Sema/Ownership.h"
0020 #include "clang/Sema/SemaBase.h"
0021 #include "llvm/ADT/DenseSet.h"
0022 
0023 namespace clang {
0024 class Decl;
0025 class ParsedAttr;
0026 
0027 class SemaSYCL : public SemaBase {
0028 public:
0029   SemaSYCL(Sema &S);
0030 
0031   /// Creates a SemaDiagnosticBuilder that emits the diagnostic if the current
0032   /// context is "used as device code".
0033   ///
0034   /// - If CurLexicalContext is a kernel function or it is known that the
0035   ///   function will be emitted for the device, emits the diagnostics
0036   ///   immediately.
0037   /// - If CurLexicalContext is a function and we are compiling
0038   ///   for the device, but we don't know yet that this function will be
0039   ///   codegen'ed for the devive, creates a diagnostic which is emitted if and
0040   ///   when we realize that the function will be codegen'ed.
0041   ///
0042   /// Example usage:
0043   ///
0044   /// Diagnose __float128 type usage only from SYCL device code if the current
0045   /// target doesn't support it
0046   /// if (!S.Context.getTargetInfo().hasFloat128Type() &&
0047   ///     S.getLangOpts().SYCLIsDevice)
0048   ///   DiagIfDeviceCode(Loc, diag::err_type_unsupported) << "__float128";
0049   SemaDiagnosticBuilder DiagIfDeviceCode(SourceLocation Loc, unsigned DiagID);
0050 
0051   void deepTypeCheckForDevice(SourceLocation UsedAt,
0052                               llvm::DenseSet<QualType> Visited,
0053                               ValueDecl *DeclToCheck);
0054 
0055   ExprResult BuildUniqueStableNameExpr(SourceLocation OpLoc,
0056                                        SourceLocation LParen,
0057                                        SourceLocation RParen,
0058                                        TypeSourceInfo *TSI);
0059   ExprResult ActOnUniqueStableNameExpr(SourceLocation OpLoc,
0060                                        SourceLocation LParen,
0061                                        SourceLocation RParen,
0062                                        ParsedType ParsedTy);
0063 
0064   void handleKernelAttr(Decl *D, const ParsedAttr &AL);
0065   void handleKernelEntryPointAttr(Decl *D, const ParsedAttr &AL);
0066 
0067   void CheckSYCLEntryPointFunctionDecl(FunctionDecl *FD);
0068   StmtResult BuildSYCLKernelCallStmt(FunctionDecl *FD, CompoundStmt *Body);
0069 };
0070 
0071 } // namespace clang
0072 
0073 #endif // LLVM_CLANG_SEMA_SEMASYCL_H