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" |
18 | #include "clang/Basic/SourceLocation.h" |
19 | #include "clang/Sema/Ownership.h" |
20 | #include "clang/Sema/SemaBase.h" |
21 | #include "llvm/ADT/DenseSet.h" |
22 | |
23 | namespace clang { |
24 | |
25 | class SemaSYCL : public SemaBase { |
26 | public: |
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"; |
47 | SemaDiagnosticBuilder DiagIfDeviceCode(SourceLocation Loc, unsigned DiagID); |
48 | |
49 | void deepTypeCheckForDevice(SourceLocation UsedAt, |
50 | llvm::DenseSet<QualType> Visited, |
51 | ValueDecl *DeclToCheck); |
52 | |
53 | ExprResult BuildUniqueStableNameExpr(SourceLocation OpLoc, |
54 | SourceLocation LParen, |
55 | SourceLocation RParen, |
56 | TypeSourceInfo *TSI); |
57 | ExprResult ActOnUniqueStableNameExpr(SourceLocation OpLoc, |
58 | SourceLocation LParen, |
59 | SourceLocation RParen, |
60 | ParsedType ParsedTy); |
61 | }; |
62 | |
63 | } // namespace clang |
64 | |
65 | #endif // LLVM_CLANG_SEMA_SEMASYCL_H |
66 | |