1 | //===----- SemaHLSL.h ----- Semantic Analysis for HLSL 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 HLSL constructs. |
10 | /// |
11 | //===----------------------------------------------------------------------===// |
12 | |
13 | #ifndef LLVM_CLANG_SEMA_SEMAHLSL_H |
14 | #define LLVM_CLANG_SEMA_SEMAHLSL_H |
15 | |
16 | #include "clang/AST/Attr.h" |
17 | #include "clang/AST/Decl.h" |
18 | #include "clang/AST/DeclBase.h" |
19 | #include "clang/AST/Expr.h" |
20 | #include "clang/Basic/AttributeCommonInfo.h" |
21 | #include "clang/Basic/IdentifierTable.h" |
22 | #include "clang/Basic/SourceLocation.h" |
23 | #include "clang/Sema/Scope.h" |
24 | #include "clang/Sema/SemaBase.h" |
25 | #include <initializer_list> |
26 | |
27 | namespace clang { |
28 | |
29 | class SemaHLSL : public SemaBase { |
30 | public: |
31 | SemaHLSL(Sema &S); |
32 | |
33 | Decl *ActOnStartBuffer(Scope *BufferScope, bool CBuffer, SourceLocation KwLoc, |
34 | IdentifierInfo *Ident, SourceLocation IdentLoc, |
35 | SourceLocation LBrace); |
36 | void ActOnFinishBuffer(Decl *Dcl, SourceLocation RBrace); |
37 | HLSLNumThreadsAttr *mergeNumThreadsAttr(Decl *D, |
38 | const AttributeCommonInfo &AL, int X, |
39 | int Y, int Z); |
40 | HLSLShaderAttr *mergeShaderAttr(Decl *D, const AttributeCommonInfo &AL, |
41 | HLSLShaderAttr::ShaderType ShaderType); |
42 | HLSLParamModifierAttr * |
43 | mergeParamModifierAttr(Decl *D, const AttributeCommonInfo &AL, |
44 | HLSLParamModifierAttr::Spelling Spelling); |
45 | void ActOnTopLevelFunction(FunctionDecl *FD); |
46 | void CheckEntryPoint(FunctionDecl *FD); |
47 | void CheckSemanticAnnotation(FunctionDecl *EntryPoint, const Decl *Param, |
48 | const HLSLAnnotationAttr *AnnotationAttr); |
49 | void DiagnoseAttrStageMismatch( |
50 | const Attr *A, HLSLShaderAttr::ShaderType Stage, |
51 | std::initializer_list<HLSLShaderAttr::ShaderType> AllowedStages); |
52 | }; |
53 | |
54 | } // namespace clang |
55 | |
56 | #endif // LLVM_CLANG_SEMA_SEMAHLSL_H |
57 | |