clang 20.0.0git
SemaHLSL.h
Go to the documentation of this file.
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/ASTFwd.h"
17#include "clang/AST/Attr.h"
19#include "clang/Sema/SemaBase.h"
20#include "llvm/TargetParser/Triple.h"
21#include <initializer_list>
22
23namespace clang {
24class AttributeCommonInfo;
25class IdentifierInfo;
26class ParsedAttr;
27class Scope;
28
29class SemaHLSL : public SemaBase {
30public:
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 llvm::Triple::EnvironmentType ShaderType);
42 HLSLParamModifierAttr *
44 HLSLParamModifierAttr::Spelling Spelling);
47 void CheckSemanticAnnotation(FunctionDecl *EntryPoint, const Decl *Param,
48 const HLSLAnnotationAttr *AnnotationAttr);
50 const Attr *A, llvm::Triple::EnvironmentType Stage,
51 std::initializer_list<llvm::Triple::EnvironmentType> AllowedStages);
53
54 void handleNumThreadsAttr(Decl *D, const ParsedAttr &AL);
56 void handlePackOffsetAttr(Decl *D, const ParsedAttr &AL);
57 void handleShaderAttr(Decl *D, const ParsedAttr &AL);
58 void handleROVAttr(Decl *D, const ParsedAttr &AL);
59 void handleResourceClassAttr(Decl *D, const ParsedAttr &AL);
61 void handleParamModifierAttr(Decl *D, const ParsedAttr &AL);
62
63 bool CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
64};
65
66} // namespace clang
67
68#endif // LLVM_CLANG_SEMA_SEMAHLSL_H
Forward declaration of all AST node types.
const Decl * D
#define X(type, name)
Definition: Value.h:143
Defines the clang::SourceLocation class and associated facilities.
Attr - This represents one attribute.
Definition: Attr.h:42
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition: Expr.h:2830
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:86
Represents a function declaration or definition.
Definition: Decl.h:1932
One of these records is kept for each identifier that is lexed.
ParsedAttr - Represents a syntactic attribute.
Definition: ParsedAttr.h:129
Scope - A scope is a transient data structure that is used while parsing the program.
Definition: Scope.h:41
void handleResourceClassAttr(Decl *D, const ParsedAttr &AL)
Definition: SemaHLSL.cpp:440
void DiagnoseAttrStageMismatch(const Attr *A, llvm::Triple::EnvironmentType Stage, std::initializer_list< llvm::Triple::EnvironmentType > AllowedStages)
Definition: SemaHLSL.cpp:286
void handleShaderAttr(Decl *D, const ParsedAttr &AL)
Definition: SemaHLSL.cpp:420
void handleSV_DispatchThreadIDAttr(Decl *D, const ParsedAttr &AL)
Definition: SemaHLSL.cpp:359
void CheckEntryPoint(FunctionDecl *FD)
Definition: SemaHLSL.cpp:214
HLSLNumThreadsAttr * mergeNumThreadsAttr(Decl *D, const AttributeCommonInfo &AL, int X, int Y, int Z)
Definition: SemaHLSL.cpp:133
void handlePackOffsetAttr(Decl *D, const ParsedAttr &AL)
Definition: SemaHLSL.cpp:371
void CheckSemanticAnnotation(FunctionDecl *EntryPoint, const Decl *Param, const HLSLAnnotationAttr *AnnotationAttr)
Definition: SemaHLSL.cpp:267
void handleParamModifierAttr(Decl *D, const ParsedAttr &AL)
Definition: SemaHLSL.cpp:533
void handleResourceBindingAttr(Decl *D, const ParsedAttr &AL)
Definition: SemaHLSL.cpp:462
void handleNumThreadsAttr(Decl *D, const ParsedAttr &AL)
Definition: SemaHLSL.cpp:300
void handleROVAttr(Decl *D, const ParsedAttr &AL)
void DiagnoseAvailabilityViolations(TranslationUnitDecl *TU)
Definition: SemaHLSL.cpp:887
void ActOnTopLevelFunction(FunctionDecl *FD)
Definition: SemaHLSL.cpp:181
HLSLShaderAttr * mergeShaderAttr(Decl *D, const AttributeCommonInfo &AL, llvm::Triple::EnvironmentType ShaderType)
Definition: SemaHLSL.cpp:148
void ActOnFinishBuffer(Decl *Dcl, SourceLocation RBrace)
Definition: SemaHLSL.cpp:82
HLSLParamModifierAttr * mergeParamModifierAttr(Decl *D, const AttributeCommonInfo &AL, HLSLParamModifierAttr::Spelling Spelling)
Definition: SemaHLSL.cpp:161
Decl * ActOnStartBuffer(Scope *BufferScope, bool CBuffer, SourceLocation KwLoc, IdentifierInfo *Ident, SourceLocation IdentLoc, SourceLocation LBrace)
Definition: SemaHLSL.cpp:32
bool CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall)
Definition: SemaHLSL.cpp:1018
Sema - This implements semantic analysis and AST building for C.
Definition: Sema.h:493
Encodes a location in the source.
The top declaration context.
Definition: Decl.h:84
The JSON file list parser is used to communicate input to InstallAPI.