13#ifndef LLVM_CLANG_SEMA_SEMAHLSL_H
14#define LLVM_CLANG_SEMA_SEMAHLSL_H
22#include "llvm/ADT/SmallVector.h"
23#include "llvm/TargetParser/Triple.h"
24#include <initializer_list>
27class AttributeCommonInfo;
29class InitializedEntity;
30class InitializationKind;
41 llvm::hlsl::rootsig::RootElement Element)
42 :
Loc(
Loc), Element(Element) {}
44 const llvm::hlsl::rootsig::RootElement &
getElement()
const {
return Element; }
49 llvm::hlsl::rootsig::RootElement Element;
54using llvm::dxil::ResourceClass;
59 Sema &S, QualType Wrapped, ArrayRef<const Attr *> AttrList,
60 QualType &ResType, HLSLAttributedResourceLocInfo *LocInfo =
nullptr);
69 const HLSLResourceBindingAttr *
Attr;
74 const HLSLResourceBindingAttr *
Attr =
nullptr)
79 "binding attribute already assigned");
103 llvm::DenseMap<const VarDecl *, unsigned> DeclToBindingListIndex;
118 int Min,
int Max,
int Preferred,
119 int SpelledArgsCount);
120 HLSLVkConstantIdAttr *
123 llvm::Triple::EnvironmentType ShaderType);
124 HLSLParamModifierAttr *
126 HLSLParamModifierAttr::Spelling Spelling);
135 const Attr *A, llvm::Triple::EnvironmentType Stage,
136 std::initializer_list<llvm::Triple::EnvironmentType> AllowedStages);
147 std::pair<IdentifierInfo *, bool>
157 RootSigOverrideIdent = DeclIdent;
217 LocsForHLSLAttributedResources;
226 uint32_t ImplicitBindingNextOrderID = 0;
231 void collectResourceBindingsOnVarDecl(
VarDecl *
D);
232 void collectResourceBindingsOnUserRecordDecl(
const VarDecl *VD,
234 void processExplicitBindingsOnDecl(
VarDecl *
D);
238 uint32_t getNextImplicitBindingOrderID() {
239 return ImplicitBindingNextOrderID++;
242 bool initGlobalResourceDecl(VarDecl *VD);
243 bool initGlobalResourceArrayDecl(VarDecl *VD);
244 void createResourceRecordCtorArgs(
const Type *ResourceTy, StringRef VarName,
245 HLSLResourceBindingAttr *RBA,
246 HLSLVkBindingAttr *VkBinding,
Forward declaration of all AST node types.
llvm::dxil::ResourceClass ResourceClass
Defines the clang::SourceLocation class and associated facilities.
Defines the clang::TypeLoc interface and its subclasses.
C Language Family Type Representation.
Attr - This represents one attribute.
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Decl - This represents one declaration (or definition), e.g.
This represents one expression.
Represents a function declaration or definition.
One of these records is kept for each identifier that is lexed.
Describes an C or C++ initializer list.
Describes an entity that is being initialized.
Represents a parameter to a function.
ParsedAttr - Represents a syntactic attribute.
A (possibly-)qualified type.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
bool hasBindingInfoForDecl(const VarDecl *VD) const
DeclBindingInfo * getDeclBindingInfo(const VarDecl *VD, ResourceClass ResClass)
DeclBindingInfo * addDeclBindingInfo(const VarDecl *VD, ResourceClass ResClass)
Scope - A scope is a transient data structure that is used while parsing the program.
ExprResult ActOnOutParamExpr(ParmVarDecl *Param, Expr *Arg)
bool CanPerformElementwiseCast(Expr *Src, QualType DestType)
void DiagnoseAttrStageMismatch(const Attr *A, llvm::Triple::EnvironmentType Stage, std::initializer_list< llvm::Triple::EnvironmentType > AllowedStages)
void handleWaveSizeAttr(Decl *D, const ParsedAttr &AL)
HLSLAttributedResourceLocInfo TakeLocForHLSLAttribute(const HLSLAttributedResourceType *RT)
bool CanPerformScalarCast(QualType SrcTy, QualType DestTy)
QualType ProcessResourceTypeAttributes(QualType Wrapped)
void handleSV_GroupThreadIDAttr(Decl *D, const ParsedAttr &AL)
void handleShaderAttr(Decl *D, const ParsedAttr &AL)
void handleSV_DispatchThreadIDAttr(Decl *D, const ParsedAttr &AL)
void CheckEntryPoint(FunctionDecl *FD)
void emitLogicalOperatorFixIt(Expr *LHS, Expr *RHS, BinaryOperatorKind Opc)
void ActOnEndOfTranslationUnit(TranslationUnitDecl *TU)
HLSLVkConstantIdAttr * mergeVkConstantIdAttr(Decl *D, const AttributeCommonInfo &AL, int Id)
HLSLNumThreadsAttr * mergeNumThreadsAttr(Decl *D, const AttributeCommonInfo &AL, int X, int Y, int Z)
void deduceAddressSpace(VarDecl *Decl)
std::pair< IdentifierInfo *, bool > ActOnStartRootSignatureDecl(StringRef Signature)
Computes the unique Root Signature identifier from the given signature, then lookup if there is a pre...
void handlePackOffsetAttr(Decl *D, const ParsedAttr &AL)
void CheckSemanticAnnotation(FunctionDecl *EntryPoint, const Decl *Param, const HLSLAnnotationAttr *AnnotationAttr)
bool diagnosePositionType(QualType T, const ParsedAttr &AL)
bool ContainsBitField(QualType BaseTy)
bool handleInitialization(VarDecl *VDecl, Expr *&Init)
bool diagnoseInputIDType(QualType T, const ParsedAttr &AL)
void handleParamModifierAttr(Decl *D, const ParsedAttr &AL)
bool CanPerformAggregateSplatCast(Expr *Src, QualType DestType)
void handleSV_PositionAttr(Decl *D, const ParsedAttr &AL)
bool IsScalarizedLayoutCompatible(QualType T1, QualType T2) const
void handleRootSignatureAttr(Decl *D, const ParsedAttr &AL)
bool CheckCompatibleParameterABI(FunctionDecl *New, FunctionDecl *Old)
QualType handleVectorBinOpConversion(ExprResult &LHS, ExprResult &RHS, QualType LHSType, QualType RHSType, bool IsCompAssign)
void handleResourceBindingAttr(Decl *D, const ParsedAttr &AL)
bool IsTypedResourceElementCompatible(QualType T1)
void SetRootSignatureOverride(IdentifierInfo *DeclIdent)
bool transformInitList(const InitializedEntity &Entity, InitListExpr *Init)
void handleNumThreadsAttr(Decl *D, const ParsedAttr &AL)
bool ActOnUninitializedVarDecl(VarDecl *D)
void handleVkExtBuiltinInputAttr(Decl *D, const ParsedAttr &AL)
void ActOnTopLevelFunction(FunctionDecl *FD)
bool handleResourceTypeAttr(QualType T, const ParsedAttr &AL)
HLSLShaderAttr * mergeShaderAttr(Decl *D, const AttributeCommonInfo &AL, llvm::Triple::EnvironmentType ShaderType)
void ActOnFinishBuffer(Decl *Dcl, SourceLocation RBrace)
void handleVkBindingAttr(Decl *D, const ParsedAttr &AL)
HLSLParamModifierAttr * mergeParamModifierAttr(Decl *D, const AttributeCommonInfo &AL, HLSLParamModifierAttr::Spelling Spelling)
QualType getInoutParameterType(QualType Ty)
void handleVkConstantIdAttr(Decl *D, const ParsedAttr &AL)
Decl * ActOnStartBuffer(Scope *BufferScope, bool CBuffer, SourceLocation KwLoc, IdentifierInfo *Ident, SourceLocation IdentLoc, SourceLocation LBrace)
HLSLWaveSizeAttr * mergeWaveSizeAttr(Decl *D, const AttributeCommonInfo &AL, int Min, int Max, int Preferred, int SpelledArgsCount)
bool handleRootSignatureElements(ArrayRef< hlsl::RootSignatureElement > Elements)
void handleSV_GroupIDAttr(Decl *D, const ParsedAttr &AL)
void ActOnFinishRootSignatureDecl(SourceLocation Loc, IdentifierInfo *DeclIdent, ArrayRef< hlsl::RootSignatureElement > Elements)
Creates the Root Signature decl of the parsed Root Signature elements onto the AST and push it onto c...
void ActOnVariableDeclarator(VarDecl *VD)
bool CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall)
Sema - This implements semantic analysis and AST building for C.
Encodes a location in the source.
The top declaration context.
Represents a variable declaration or definition.
The JSON file list parser is used to communicate input to InstallAPI.
bool CreateHLSLAttributedResourceType(Sema &S, QualType Wrapped, ArrayRef< const Attr * > AttrList, QualType &ResType, HLSLAttributedResourceLocInfo *LocInfo=nullptr)
const FunctionProtoType * T
@ Implicit
An implicit conversion.
const HLSLResourceBindingAttr * Attr
DeclBindingInfo(const VarDecl *Decl, ResourceClass ResClass, BindingType BindType=BindingType::NotAssigned, const HLSLResourceBindingAttr *Attr=nullptr)
void setBindingAttribute(HLSLResourceBindingAttr *A, BindingType BT)
const SourceLocation & getLocation() const
RootSignatureElement(SourceLocation Loc, llvm::hlsl::rootsig::RootElement Element)
const llvm::hlsl::rootsig::RootElement & getElement() const