clang 22.0.0git
SemaHLSL.cpp File Reference
#include "clang/Sema/SemaHLSL.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/Attr.h"
#include "clang/AST/Attrs.inc"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclBase.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclarationName.h"
#include "clang/AST/DynamicRecursiveASTVisitor.h"
#include "clang/AST/Expr.h"
#include "clang/AST/Type.h"
#include "clang/AST/TypeLoc.h"
#include "clang/Basic/Builtins.h"
#include "clang/Basic/DiagnosticSema.h"
#include "clang/Basic/IdentifierTable.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/Specifiers.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Sema/Initialization.h"
#include "clang/Sema/Lookup.h"
#include "clang/Sema/ParsedAttr.h"
#include "clang/Sema/Sema.h"
#include "clang/Sema/Template.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Frontend/HLSL/HLSLBinding.h"
#include "llvm/Frontend/HLSL/RootSignatureValidations.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/DXILABI.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/TargetParser/Triple.h"
#include <cmath>
#include <cstddef>
#include <iterator>
#include <utility>

Go to the source code of this file.

Typedefs

using RegisterType = HLSLResourceBindingAttr::RegisterType

Functions

static CXXRecordDeclcreateHostLayoutStruct (Sema &S, CXXRecordDecl *StructDecl)
static RegisterType getRegisterType (ResourceClass RC)
static RegisterType getRegisterType (const HLSLAttributedResourceType *ResTy)
static bool convertToRegisterType (StringRef Slot, RegisterType *RT)
static ResourceClass getResourceClass (RegisterType RT)
static Builtin::ID getSpecConstBuiltinId (const Type *Type)
static unsigned calculateLegacyCbufferFieldAlign (const ASTContext &Context, QualType T)
static unsigned calculateLegacyCbufferSize (const ASTContext &Context, QualType T)
static void validatePackoffset (Sema &S, HLSLBufferDecl *BufDecl)
static bool isZeroSizedArray (const ConstantArrayType *CAT)
static bool isResourceRecordTypeOrArrayOf (VarDecl *VD)
static const HLSLAttributedResourceType * getResourceArrayHandleType (VarDecl *VD)
static bool isInvalidConstantBufferLeafElementType (const Type *Ty)
static bool requiresImplicitBufferLayoutStructure (const CXXRecordDecl *RD)
static CXXRecordDeclfindRecordDeclInContext (IdentifierInfo *II, DeclContext *DC)
static IdentifierInfogetHostLayoutStructName (Sema &S, NamedDecl *BaseDecl, bool MustBeUnique)
static FieldDeclcreateFieldForHostLayoutStruct (Sema &S, const Type *Ty, IdentifierInfo *II, CXXRecordDecl *LayoutStruct)
void createHostLayoutStructForBuffer (Sema &S, HLSLBufferDecl *BufDecl)
static void addImplicitBindingAttrToDecl (Sema &S, Decl *D, RegisterType RT, uint32_t ImplicitBindingOrderID)
template<CastKind Kind>
static void castVector (Sema &S, ExprResult &E, QualType &Ty, unsigned Sz)
template<CastKind Kind>
static QualType castElement (Sema &S, ExprResult &E, QualType Ty)
static QualType handleFloatVectorBinOpConversion (Sema &SemaRef, ExprResult &LHS, ExprResult &RHS, QualType LHSType, QualType RHSType, QualType LElTy, QualType RElTy, bool IsCompAssign)
static QualType handleIntegerVectorBinOpConversion (Sema &SemaRef, ExprResult &LHS, ExprResult &RHS, QualType LHSType, QualType RHSType, QualType LElTy, QualType RElTy, bool IsCompAssign)
static CastKind getScalarCastKind (ASTContext &Ctx, QualType DestTy, QualType SrcTy)
static bool isValidWaveSizeValue (unsigned Value)
static bool DiagnoseLocalRegisterBinding (Sema &S, SourceLocation &ArgLoc, Decl *D, RegisterType RegType, bool SpecifiedSpace)
static bool ValidateMultipleRegisterAnnotations (Sema &S, Decl *TheDecl, RegisterType regType)
static bool DiagnoseHLSLRegisterAttribute (Sema &S, SourceLocation &ArgLoc, Decl *D, RegisterType RegType, bool SpecifiedSpace)
static bool CheckAllArgsHaveSameType (Sema *S, CallExpr *TheCall)
static bool CheckArgTypeMatches (Sema *S, Expr *Arg, QualType ExpectedType)
static bool CheckAllArgTypesAreCorrect (Sema *S, CallExpr *TheCall, llvm::function_ref< bool(Sema *S, SourceLocation Loc, int ArgOrdinal, clang::QualType PassedType)> Check)
static bool CheckFloatOrHalfRepresentation (Sema *S, SourceLocation Loc, int ArgOrdinal, clang::QualType PassedType)
static bool CheckModifiableLValue (Sema *S, CallExpr *TheCall, unsigned ArgIndex)
static bool CheckNoDoubleVectors (Sema *S, SourceLocation Loc, int ArgOrdinal, clang::QualType PassedType)
static bool CheckFloatingOrIntRepresentation (Sema *S, SourceLocation Loc, int ArgOrdinal, clang::QualType PassedType)
static bool CheckUnsignedIntVecRepresentation (Sema *S, SourceLocation Loc, int ArgOrdinal, clang::QualType PassedType)
static bool CheckUnsignedIntRepresentation (Sema *S, SourceLocation Loc, int ArgOrdinal, clang::QualType PassedType)
static void SetElementTypeAsReturnType (Sema *S, CallExpr *TheCall, QualType ReturnType)
static bool CheckScalarOrVector (Sema *S, CallExpr *TheCall, QualType Scalar, unsigned ArgIndex)
static bool CheckAnyScalarOrVector (Sema *S, CallExpr *TheCall, unsigned ArgIndex)
static bool CheckWaveActive (Sema *S, CallExpr *TheCall)
static bool CheckBoolSelect (Sema *S, CallExpr *TheCall)
static bool CheckVectorSelect (Sema *S, CallExpr *TheCall)
static bool CheckResourceHandle (Sema *S, CallExpr *TheCall, unsigned ArgIndex, llvm::function_ref< bool(const HLSLAttributedResourceType *ResType)> Check=nullptr)
static void BuildFlattenedTypeList (QualType BaseTy, llvm::SmallVectorImpl< QualType > &List)
static bool IsDefaultBufferConstantDecl (VarDecl *VD)

Typedef Documentation

◆ RegisterType

using RegisterType = HLSLResourceBindingAttr::RegisterType

Definition at line 55 of file SemaHLSL.cpp.

Function Documentation

◆ addImplicitBindingAttrToDecl()

void addImplicitBindingAttrToDecl ( Sema & S,
Decl * D,
RegisterType RT,
uint32_t ImplicitBindingOrderID )
static

◆ BuildFlattenedTypeList()

◆ calculateLegacyCbufferFieldAlign()

unsigned calculateLegacyCbufferFieldAlign ( const ASTContext & Context,
QualType T )
static

◆ calculateLegacyCbufferSize()

unsigned calculateLegacyCbufferSize ( const ASTContext & Context,
QualType T )
static

◆ castElement()

◆ castVector()

◆ CheckAllArgsHaveSameType()

◆ CheckAllArgTypesAreCorrect()

bool CheckAllArgTypesAreCorrect ( Sema * S,
CallExpr * TheCall,
llvm::function_ref< bool(Sema *S, SourceLocation Loc, int ArgOrdinal, clang::QualType PassedType)> Check )
static

◆ CheckAnyScalarOrVector()

◆ CheckArgTypeMatches()

◆ CheckBoolSelect()

◆ CheckFloatingOrIntRepresentation()

bool CheckFloatingOrIntRepresentation ( Sema * S,
SourceLocation Loc,
int ArgOrdinal,
clang::QualType PassedType )
static

◆ CheckFloatOrHalfRepresentation()

bool CheckFloatOrHalfRepresentation ( Sema * S,
SourceLocation Loc,
int ArgOrdinal,
clang::QualType PassedType )
static

◆ CheckModifiableLValue()

bool CheckModifiableLValue ( Sema * S,
CallExpr * TheCall,
unsigned ArgIndex )
static

◆ CheckNoDoubleVectors()

bool CheckNoDoubleVectors ( Sema * S,
SourceLocation Loc,
int ArgOrdinal,
clang::QualType PassedType )
static

◆ CheckResourceHandle()

bool CheckResourceHandle ( Sema * S,
CallExpr * TheCall,
unsigned ArgIndex,
llvm::function_ref< bool(const HLSLAttributedResourceType *ResType)> Check = nullptr )
static

◆ CheckScalarOrVector()

◆ CheckUnsignedIntRepresentation()

bool CheckUnsignedIntRepresentation ( Sema * S,
SourceLocation Loc,
int ArgOrdinal,
clang::QualType PassedType )
static

◆ CheckUnsignedIntVecRepresentation()

bool CheckUnsignedIntVecRepresentation ( Sema * S,
SourceLocation Loc,
int ArgOrdinal,
clang::QualType PassedType )
static

◆ CheckVectorSelect()

◆ CheckWaveActive()

◆ convertToRegisterType()

bool convertToRegisterType ( StringRef Slot,
RegisterType * RT )
static

Definition at line 80 of file SemaHLSL.cpp.

Referenced by clang::SemaHLSL::handleResourceBindingAttr().

◆ createFieldForHostLayoutStruct()

◆ createHostLayoutStruct()

◆ createHostLayoutStructForBuffer()

◆ DiagnoseHLSLRegisterAttribute()

bool DiagnoseHLSLRegisterAttribute ( Sema & S,
SourceLocation & ArgLoc,
Decl * D,
RegisterType RegType,
bool SpecifiedSpace )
static

◆ DiagnoseLocalRegisterBinding()

◆ findRecordDeclInContext()

CXXRecordDecl * findRecordDeclInContext ( IdentifierInfo * II,
DeclContext * DC )
static

◆ getHostLayoutStructName()

◆ getRegisterType() [1/2]

RegisterType getRegisterType ( const HLSLAttributedResourceType * ResTy)
static

Definition at line 74 of file SemaHLSL.cpp.

References getRegisterType().

◆ getRegisterType() [2/2]

RegisterType getRegisterType ( ResourceClass RC)
static

◆ getResourceArrayHandleType()

const HLSLAttributedResourceType * getResourceArrayHandleType ( VarDecl * VD)
static

◆ getResourceClass()

ResourceClass getResourceClass ( RegisterType RT)
static

Definition at line 112 of file SemaHLSL.cpp.

◆ getScalarCastKind()

CastKind getScalarCastKind ( ASTContext & Ctx,
QualType DestTy,
QualType SrcTy )
static

◆ getSpecConstBuiltinId()

Builtin::ID getSpecConstBuiltinId ( const Type * Type)
static

◆ handleFloatVectorBinOpConversion()

QualType handleFloatVectorBinOpConversion ( Sema & SemaRef,
ExprResult & LHS,
ExprResult & RHS,
QualType LHSType,
QualType RHSType,
QualType LElTy,
QualType RElTy,
bool IsCompAssign )
static

◆ handleIntegerVectorBinOpConversion()

◆ IsDefaultBufferConstantDecl()

◆ isInvalidConstantBufferLeafElementType()

◆ isResourceRecordTypeOrArrayOf()

◆ isValidWaveSizeValue()

bool isValidWaveSizeValue ( unsigned Value)
static

Definition at line 1508 of file SemaHLSL.cpp.

Referenced by clang::SemaHLSL::handleWaveSizeAttr().

◆ isZeroSizedArray()

◆ requiresImplicitBufferLayoutStructure()

◆ SetElementTypeAsReturnType()

◆ ValidateMultipleRegisterAnnotations()

bool ValidateMultipleRegisterAnnotations ( Sema & S,
Decl * TheDecl,
RegisterType regType )
static

◆ validatePackoffset()