27#include "llvm/ADT/BitmaskEnum.h"
28#include "llvm/ADT/STLExtras.h"
29#include "llvm/ADT/SmallVector.h"
32using namespace llvm::hlsl;
48 NS->setImplicit(
true);
49 NS->setHasExternalLexicalStorage();
53 (void)NS->getCanonicalDecl()->decls_begin();
69 defineTrivialHLSLTypes();
70 defineInternalHLSLTypes();
71 defineHLSLTypesWithForwardDeclarations();
72 defineHLSLAtomicIntrinsics();
89void HLSLExternalSemaSource::defineHLSLVectorAlias() {
96 &AST.
Idents.
get(
"element", tok::TokenKind::identifier),
false,
false);
97 TypeParam->setDefaultArgument(
101 TemplateParams.emplace_back(TypeParam);
105 &AST.
Idents.
get(
"element_count", tok::TokenKind::identifier), AST.
IntTy,
112 TemplateParams.emplace_back(SizeParam);
131 Record->setImplicit(
true);
143void HLSLExternalSemaSource::defineHLSLMatrixAlias() {
149 &AST.
Idents.
get(
"element", tok::TokenKind::identifier),
false,
false);
150 TypeParam->setDefaultArgument(
154 TemplateParams.emplace_back(TypeParam);
159 &AST.
Idents.
get(
"rows_count", tok::TokenKind::identifier), AST.
IntTy,
164 RowsParam->setDefaultArgument(
167 TemplateParams.emplace_back(RowsParam);
171 &AST.
Idents.
get(
"cols_count", tok::TokenKind::identifier), AST.
IntTy,
176 ColsParam->setDefaultArgument(
179 TemplateParams.emplace_back(ColsParam);
181 const unsigned MaxMatDim = SemaPtr->
getLangOpts().MaxMatrixDimension;
233 Record->setImplicit(
true);
245void HLSLExternalSemaSource::defineTrivialHLSLTypes() {
246 defineHLSLVectorAlias();
247 defineHLSLMatrixAlias();
250void HLSLExternalSemaSource::defineHeapResourceInfoTypes() {
251 ASTContext &AST = SemaPtr->getASTContext();
252 CXXRecordDecl *ResDecl = BuiltinTypeDeclBuilder(*SemaPtr, HLSLDetailNamespace,
253 "heap_resource_info")
254 .finalizeForwardDeclaration();
256 BuiltinTypeDeclBuilder(*SemaPtr, ResDecl)
258 .completeDefinition();
260 CXXRecordDecl *SampDecl =
261 BuiltinTypeDeclBuilder(*SemaPtr, HLSLDetailNamespace,
"heap_sampler_info")
262 .finalizeForwardDeclaration();
264 BuiltinTypeDeclBuilder(*SemaPtr, SampDecl)
266 .completeDefinition();
269void HLSLExternalSemaSource::defineInternalHLSLTypes() {
270 defineHeapResourceInfoTypes();
276 bool RawBuffer,
bool HasCounter) {
322enum class TemplateShape {
324 ElementTypeAndSampleCount,
327struct TextureTypeInfo {
330 ResourceDimension
Dim;
336 bool has(TexCap
C)
const {
return (Caps &
C) != TexCap{}; }
337 bool hasSampleCount()
const {
338 return Shape == TemplateShape::ElementTypeAndSampleCount;
344 {
"Texture1D", ResourceClass::SRV, ResourceDimension::Dim1D,
345 false,
false, TemplateShape::ElementType,
346 TexCap::Load | TexCap::Subscript | TexCap::Mips | TexCap::Sample |
347 TexCap::SampleCmp | TexCap::CalcLOD},
348 {
"RWTexture1D", ResourceClass::UAV, ResourceDimension::Dim1D,
349 false,
false, TemplateShape::ElementType,
350 TexCap::LoadRW | TexCap::Subscript},
351 {
"Texture1DArray", ResourceClass::SRV, ResourceDimension::Dim1D,
352 true,
false, TemplateShape::ElementType,
353 TexCap::Load | TexCap::Subscript | TexCap::Mips | TexCap::Sample |
354 TexCap::SampleCmp | TexCap::CalcLOD},
355 {
"RWTexture1DArray", ResourceClass::UAV, ResourceDimension::Dim1D,
356 true,
false, TemplateShape::ElementType,
357 TexCap::LoadRW | TexCap::Subscript},
358 {
"Texture2D", ResourceClass::SRV, ResourceDimension::Dim2D,
359 false,
false, TemplateShape::ElementType,
360 TexCap::Load | TexCap::Subscript | TexCap::Mips | TexCap::Sample |
361 TexCap::SampleCmp | TexCap::CalcLOD | TexCap::Gather |
363 {
"RWTexture2D", ResourceClass::UAV, ResourceDimension::Dim2D,
364 false,
false, TemplateShape::ElementType,
365 TexCap::LoadRW | TexCap::Subscript | TexCap::GetDims},
366 {
"Texture2DArray", ResourceClass::SRV, ResourceDimension::Dim2D,
367 true,
false, TemplateShape::ElementType,
368 TexCap::Load | TexCap::Subscript | TexCap::Mips | TexCap::Sample |
369 TexCap::SampleCmp | TexCap::CalcLOD | TexCap::Gather |
371 {
"RWTexture2DArray", ResourceClass::UAV, ResourceDimension::Dim2D,
372 true,
false, TemplateShape::ElementType,
373 TexCap::LoadRW | TexCap::Subscript | TexCap::GetDims},
374 {
"Texture2DMS", ResourceClass::SRV, ResourceDimension::Dim2D,
376 TemplateShape::ElementTypeAndSampleCount,
377 TexCap::LoadMS | TexCap::Subscript},
378 {
"Texture3D", ResourceClass::SRV, ResourceDimension::Dim3D,
379 false,
false, TemplateShape::ElementType,
380 TexCap::Load | TexCap::Subscript | TexCap::Mips | TexCap::Sample |
381 TexCap::CalcLOD | TexCap::GetDims},
382 {
"RWTexture3D", ResourceClass::UAV, ResourceDimension::Dim3D,
383 false,
false, TemplateShape::ElementType,
384 TexCap::LoadRW | TexCap::Subscript | TexCap::GetDims},
385 {
"TextureCube", ResourceClass::SRV, ResourceDimension::Cube,
386 false,
false, TemplateShape::ElementType,
387 TexCap::Sample | TexCap::SampleCmp | TexCap::CalcLOD | TexCap::Gather |
389 {
"TextureCubeArray", ResourceClass::SRV, ResourceDimension::Cube,
390 true,
false, TemplateShape::ElementType,
391 TexCap::Sample | TexCap::SampleCmp | TexCap::CalcLOD | TexCap::Gather |
396 const TextureTypeInfo &
T) {
397 const ResourceDimension
Dim =
T.Dim;
398 const bool IsArray =
T.IsArray;
400 Expr *SampleCountExpr =
nullptr;
401 if (
T.hasSampleCount()) {
403 assert(CTD &&
"multisampled texture must be a class template");
418 if (
T.has(TexCap::Mips))
427 if (
T.has(TexCap::Load))
429 if (
T.has(TexCap::LoadMS))
431 if (
T.has(TexCap::LoadRW))
433 if (
T.has(TexCap::Subscript))
436 if (
T.has(TexCap::Sample))
441 if (
T.has(TexCap::SampleCmp))
444 if (
T.has(TexCap::CalcLOD))
446 if (
T.has(TexCap::GetDims))
448 if (
T.has(TexCap::Gather))
465 &AST.
Idents.
get(
"element_type"),
false,
false);
503 PartialSpec->setTemplateArgsAsWritten(
506 PartialSpec->setImplicit(
true);
507 PartialSpec->setLexicalDeclContext(HLSLNamespace);
508 PartialSpec->setHasExternalLexicalStorage();
511 HLSLNamespace->
addDecl(PartialSpec);
529 QualType TType = Context.getTypeDeclType(
T);
533 Context.getTrivialTypeSourceInfo(TType, NameLoc);
536 Context, BoolTy, NameLoc, UTT_IsTypedResourceElementCompatible,
537 {TTypeSourceInfo}, NameLoc,
true);
555 QualType TType = Context.getTypeDeclType(
T);
559 Context.getTrivialTypeSourceInfo(TType, NameLoc);
562 Context, BoolTy, NameLoc, UTT_IsConstantBufferElementCompatible,
563 {TTypeSourceInfo}, NameLoc,
true);
581 QualType TType = Context.getTypeDeclType(
T);
585 Context.getTrivialTypeSourceInfo(TType, NameLoc);
589 {TTypeSourceInfo}, NameLoc,
true);
598 UETT_SizeOf, TTypeSourceInfo, BoolTy, NameLoc, NameLoc);
603 Context, llvm::APInt(Context.getTypeSize(Context.getSizeType()), 1,
true),
604 Context.getSizeType(), NameLoc);
612 Context, NotIntangibleExpr, SizeGEQOneExpr, BO_LAnd, BoolTy,
VK_LValue,
626 IdentifierInfo &ElementTypeII = Context.Idents.get(
"element_type");
635 T->setDeclContext(DC);
640 Context, DeclLoc, DeclLoc, {
T}, DeclLoc,
nullptr);
643 Expr *ConstraintExpr =
nullptr;
648 &Context.Idents.get(
"__is_typed_resource_element_compatible"));
653 &Context.Idents.get(
"__is_structured_resource_element_compatible"));
658 &Context.Idents.get(
"__is_constant_buffer_element_compatible"));
666 ConceptParams, ConstraintExpr);
677void HLSLExternalSemaSource::defineHLSLTypesWithForwardDeclarations() {
678 ASTContext &AST = SemaPtr->getASTContext();
687 Decl = BuiltinTypeDeclBuilder(*SemaPtr, HLSLNamespace,
"ConstantBuffer")
688 .addSimpleTemplateParams({
"element_type"}, ConstantBufferConcept)
689 .finalizeForwardDeclaration();
691 onCompletion(Decl, [
this](CXXRecordDecl *Decl) {
698 Decl = BuiltinTypeDeclBuilder(*SemaPtr, HLSLNamespace,
"Buffer")
699 .addSimpleTemplateParams({
"element_type"}, TypedBufferConcept)
700 .finalizeForwardDeclaration();
702 onCompletion(Decl, [
this](CXXRecordDecl *Decl) {
711 Decl = BuiltinTypeDeclBuilder(*SemaPtr, HLSLNamespace,
"RWBuffer")
712 .addSimpleTemplateParams({
"element_type"}, TypedBufferConcept)
713 .finalizeForwardDeclaration();
715 onCompletion(Decl, [
this](CXXRecordDecl *Decl) {
725 BuiltinTypeDeclBuilder(*SemaPtr, HLSLNamespace,
"RasterizerOrderedBuffer")
726 .addSimpleTemplateParams({
"element_type"}, StructuredBufferConcept)
727 .finalizeForwardDeclaration();
728 onCompletion(Decl, [
this](CXXRecordDecl *Decl) {
737 Decl = BuiltinTypeDeclBuilder(*SemaPtr, HLSLNamespace,
"StructuredBuffer")
738 .addSimpleTemplateParams({
"element_type"}, StructuredBufferConcept)
739 .finalizeForwardDeclaration();
740 onCompletion(Decl, [
this](CXXRecordDecl *Decl) {
749 Decl = BuiltinTypeDeclBuilder(*SemaPtr, HLSLNamespace,
"RWStructuredBuffer")
750 .addSimpleTemplateParams({
"element_type"}, StructuredBufferConcept)
751 .finalizeForwardDeclaration();
752 onCompletion(Decl, [
this](CXXRecordDecl *Decl) {
764 BuiltinTypeDeclBuilder(*SemaPtr, HLSLNamespace,
"AppendStructuredBuffer")
765 .addSimpleTemplateParams({
"element_type"}, StructuredBufferConcept)
766 .finalizeForwardDeclaration();
767 onCompletion(Decl, [
this](CXXRecordDecl *Decl) {
776 BuiltinTypeDeclBuilder(*SemaPtr, HLSLNamespace,
"ConsumeStructuredBuffer")
777 .addSimpleTemplateParams({
"element_type"}, StructuredBufferConcept)
778 .finalizeForwardDeclaration();
779 onCompletion(Decl, [
this](CXXRecordDecl *Decl) {
787 Decl = BuiltinTypeDeclBuilder(*SemaPtr, HLSLNamespace,
788 "RasterizerOrderedStructuredBuffer")
789 .addSimpleTemplateParams({
"element_type"}, StructuredBufferConcept)
790 .finalizeForwardDeclaration();
791 onCompletion(Decl, [
this](CXXRecordDecl *Decl) {
802 Decl = BuiltinTypeDeclBuilder(*SemaPtr, HLSLNamespace,
"ByteAddressBuffer")
803 .finalizeForwardDeclaration();
804 onCompletion(Decl, [
this](CXXRecordDecl *Decl) {
811 Decl = BuiltinTypeDeclBuilder(*SemaPtr, HLSLNamespace,
"RWByteAddressBuffer")
812 .finalizeForwardDeclaration();
813 onCompletion(Decl, [
this](CXXRecordDecl *Decl) {
822 Decl = BuiltinTypeDeclBuilder(*SemaPtr, HLSLNamespace,
823 "RasterizerOrderedByteAddressBuffer")
824 .finalizeForwardDeclaration();
825 onCompletion(Decl, [
this](CXXRecordDecl *Decl) {
833 Decl = BuiltinTypeDeclBuilder(*SemaPtr, HLSLNamespace,
"SamplerState")
834 .finalizeForwardDeclaration();
835 onCompletion(Decl, [
this](CXXRecordDecl *Decl) {
840 BuiltinTypeDeclBuilder(*SemaPtr, HLSLNamespace,
"SamplerComparisonState")
841 .finalizeForwardDeclaration();
842 onCompletion(Decl, [
this](CXXRecordDecl *Decl) {
848 BuiltinTypeDeclBuilder TexBuilder(*SemaPtr, HLSLNamespace,
T.Name);
850 case TemplateShape::ElementType:
851 TexBuilder.addSimpleTemplateParams({
"element_type"}, {Float4Ty},
854 case TemplateShape::ElementTypeAndSampleCount:
855 TexBuilder.addMSTextureTemplateParams(
"element_type",
"sample_count",
859 Decl = TexBuilder.finalizeForwardDeclaration();
861 onCompletion(Decl, [
this, &
T](CXXRecordDecl *Decl) {
865 if (
T.Shape != TemplateShape::ElementType)
869 *SemaPtr, HLSLNamespace,
Decl->getDescribedClassTemplate());
870 onCompletion(PartialSpec, [
this, &
T](CXXRecordDecl *Decl) {
891 StringRef BuiltinName,
QualType ElemTy,
904 ParamTypes.push_back(OrigRefTy);
907 ParamTypes.push_back(ElemTy);
910 ParamTypes.push_back(ElemTy);
911 ParamTypes.push_back(OrigRefTy);
917 constexpr const char *BinaryNames[] = {
"dest",
"value",
"original_value"};
918 constexpr const char *CompareNames[] = {
"dest",
"compare_value",
"value",
922 const bool HasOriginalValue =
932 if (HasOriginalValue) {
949 for (
auto [ParamType, ParamName] : llvm::zip(ParamTypes, ParamNames)) {
955 if (HasOriginalValue && I == ParamTypes.size() - 1)
956 Parm->
addAttr(HLSLParamModifierAttr::Create(
957 AST,
SourceRange(), HLSLParamModifierAttr::Keyword_out));
959 ParmDecls.push_back(Parm);
961 FD->setParams(ParmDecls);
965 FD->
addAttr(BuiltinAliasAttr::CreateImplicit(AST, &BuiltinII));
976 StringRef FuncName, StringRef BuiltinName,
977 bool RequiresOriginalValue =
false,
978 bool SupportsFloat =
false) {
988 for (
LangAS AS : AddrSpaces) {
989 if (!RequiresOriginalValue)
1001 StringRef BuiltinName,
1016 StringRef BuiltinName,
1025void HLSLExternalSemaSource::defineHLSLAtomicIntrinsics() {
1027 "__builtin_hlsl_interlocked_add");
1029 "__builtin_hlsl_interlocked_and");
1031 *SemaPtr, HLSLNamespace,
"InterlockedCompareExchange",
1032 "__builtin_hlsl_interlocked_compare_exchange",
1035 *SemaPtr, HLSLNamespace,
"InterlockedCompareExchangeFloatBitwise",
1036 "__builtin_hlsl_interlocked_compare_exchange_float_bitwise",
1039 "InterlockedCompareStore",
1040 "__builtin_hlsl_interlocked_compare_store",
1043 *SemaPtr, HLSLNamespace,
"InterlockedCompareStoreFloatBitwise",
1044 "__builtin_hlsl_interlocked_compare_store_float_bitwise",
1047 "__builtin_hlsl_interlocked_exchange",
1051 "__builtin_hlsl_interlocked_max");
1053 "__builtin_hlsl_interlocked_min");
1055 "__builtin_hlsl_interlocked_or");
1057 "__builtin_hlsl_interlocked_xor");
1061 CompletionFunction Fn) {
1062 if (!
Record->isCompleteDefinition())
1063 Completions.insert(std::make_pair(
Record->getCanonicalDecl(), Fn));
1071 auto It = Completions.find(
Record);
1072 if (It == Completions.end())
1077 CompletionFunction Fn = std::move(It->second);
1078 Completions.erase(It);
Defines the clang::ASTContext interface.
Provides definitions for the various language-specific address spaces.
llvm::dxil::ResourceClass ResourceClass
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the C++ template declaration subclasses.
static BuiltinTypeDeclBuilder setupBufferType(CXXRecordDecl *Decl, Sema &S, ResourceClass RC, bool IsROV, bool RawBuffer, bool HasCounter)
Set up common members and attributes for buffer types.
static BuiltinTypeDeclBuilder setupTextureType(CXXRecordDecl *Decl, Sema &S, const TextureTypeInfo &T)
static void defineHLSLInterlockedCompareFuncFloat(Sema &S, NamespaceDecl *NS, StringRef FuncName, StringRef BuiltinName, AtomicOverloadShape Shape)
static NamespaceDecl * createImplicitNamespace(Sema &S, StringRef Name, DeclContext *DC)
static BuiltinTypeDeclBuilder setupSamplerType(CXXRecordDecl *Decl, Sema &S)
Set up common members and attributes for sampler types.
static Expr * constructTypedBufferConstraintExpr(Sema &S, SourceLocation NameLoc, TemplateTypeParmDecl *T)
static ConceptDecl * constructBufferConceptDecl(Sema &S, NamespaceDecl *NSD, HLSLBufferType BT)
static void defineHLSLInterlockedFunc(Sema &S, NamespaceDecl *NS, StringRef FuncName, StringRef BuiltinName, bool RequiresOriginalValue=false, bool SupportsFloat=false)
static const TextureTypeInfo TextureTypes[]
static void defineHLSLInterlockedCompareFunc(Sema &S, NamespaceDecl *NS, StringRef FuncName, StringRef BuiltinName, AtomicOverloadShape Shape)
static Expr * constructConstantBufferConstraintExpr(Sema &S, SourceLocation NameLoc, TemplateTypeParmDecl *T)
static void buildAtomicOverload(Sema &S, NamespaceDecl *NS, StringRef FuncName, StringRef BuiltinName, QualType ElemTy, LangAS DestAS, AtomicOverloadShape Shape)
static ClassTemplatePartialSpecializationDecl * addVectorTexturePartialSpecialization(Sema &S, NamespaceDecl *HLSLNamespace, ClassTemplateDecl *TextureTemplate)
static Expr * constructStructuredBufferConstraintExpr(Sema &S, SourceLocation NameLoc, TemplateTypeParmDecl *T)
Result
Implement __builtin_bit_cast and related operations.
llvm::MachO::Record Record
Defines the clang::Preprocessor interface.
This file declares semantic analysis for HLSL constructs.
Defines the clang::SourceLocation class and associated facilities.
C Language Family Type Representation.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
TranslationUnitDecl * getTranslationUnitDecl() const
QualType getDependentSizedMatrixType(QualType ElementType, Expr *RowExpr, Expr *ColumnExpr, SourceLocation AttrLoc) const
Return the unique reference to the matrix type of the specified element type and size.
unsigned getIntWidth(QualType T) const
static CanQualType getCanonicalType(QualType T)
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
QualType getLValueReferenceType(QualType T, bool SpelledAsLValue=true) const
Return the uniqued reference to the type for an lvalue reference to the specified type.
CanQualType UnsignedLongTy
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location,...
CanQualType UnsignedIntTy
QualType getTemplateSpecializationType(ElaboratedTypeKeyword Keyword, TemplateName T, ArrayRef< TemplateArgument > SpecifiedArgs, ArrayRef< TemplateArgument > CanonicalArgs, QualType Underlying=QualType()) const
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
QualType getTemplateTypeParmType(int Depth, int Index, bool ParameterPack, TemplateTypeParmDecl *ParmDecl=nullptr) const
Retrieve the template type parameter type for a template parameter or parameter pack with the given d...
QualType getExtVectorType(QualType VectorType, unsigned NumElts) const
Return the unique reference to an extended vector type of the specified element type and size.
QualType getAddrSpaceQualType(QualType T, LangAS AddressSpace) const
Return the uniqued reference to the type for an address space qualified type with the specified type ...
QualType getDependentSizedExtVectorType(QualType VectorType, Expr *SizeExpr, SourceLocation AttrLoc) const
A builtin binary operation expression such as "x + y" or "x <= y".
static BinaryOperator * Create(const ASTContext &C, Expr *lhs, Expr *rhs, Opcode opc, QualType ResTy, ExprValueKind VK, ExprObjectKind OK, SourceLocation opLoc, FPOptionsOverride FPFeatures)
Represents a C++ struct/union/class.
static CanQual< Type > CreateUnsafe(QualType Other)
Declaration of a class template.
void AddPartialSpecialization(ClassTemplatePartialSpecializationDecl *D, llvm::FoldingSetInsertToken InsertToken)
Insert the specified partial specialization knowing that it is not already in.
static ClassTemplatePartialSpecializationDecl * Create(ASTContext &Context, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, TemplateParameterList *Params, ClassTemplateDecl *SpecializedTemplate, ArrayRef< TemplateArgument > Args, CanQualType CanonInjectedTST, ClassTemplatePartialSpecializationDecl *PrevDecl)
Declaration of a C++20 concept.
static ConceptDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, Expr *ConstraintExpr=nullptr)
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
void addDecl(Decl *D)
Add the declaration D into this context.
bool hasExternalLexicalStorage() const
Whether this DeclContext has external storage containing additional declarations that are lexically i...
decl_iterator decls_begin() const
static DeclRefExpr * Create(const ASTContext &Context, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, ValueDecl *D, bool RefersToEnclosingVariableOrCapture, SourceLocation NameLoc, QualType T, ExprValueKind VK, NamedDecl *FoundD=nullptr, const TemplateArgumentListInfo *TemplateArgs=nullptr, NonOdrUseReason NOUR=NOUR_None)
Decl - This represents one declaration (or definition), e.g.
void setImplicit(bool I=true)
DeclContext * getDeclContext()
The name of a declaration.
This represents one expression.
Represents difference between two FPOptions values.
Represents a function declaration or definition.
static FunctionDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation NLoc, DeclarationName N, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool UsesFPIntrin=false, bool isInlineSpecified=false, bool hasWrittenPrototype=true, ConstexprSpecKind ConstexprKind=ConstexprSpecKind::Unspecified, const AssociatedConstraint &TrailingRequiresClause={})
void CompleteType(TagDecl *Tag) override
Complete an incomplete HLSL builtin type.
void InitializeSema(Sema &S) override
Initialize the semantic source with the Sema instance being used to perform semantic analysis on the ...
One of these records is kept for each identifier that is lexed.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
static IntegerLiteral * Create(const ASTContext &C, const llvm::APInt &V, QualType type, SourceLocation l)
Returns a new integer literal with value 'V' and type 'type'.
Represents the results of name lookup.
Represent a C++ namespace.
static NamespaceDecl * Create(ASTContext &C, DeclContext *DC, bool Inline, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, NamespaceDecl *PrevDecl, bool Nested)
A C++ nested-name-specifier augmented with source location information.
static NonTypeTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, int D, int P, const IdentifierInfo *Id, QualType T, bool ParameterPack, TypeSourceInfo *TInfo)
Represents a parameter to a function.
void setScopeInfo(unsigned scopeDepth, unsigned parameterIndex)
static ParmVarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg)
IdentifierTable & getIdentifierTable()
A (possibly-)qualified type.
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
QualType getInoutParameterType(QualType Ty)
Sema - This implements semantic analysis and AST building for C.
@ LookupNamespaceName
Look up a namespace name within a C++ using directive or namespace alias definition,...
Preprocessor & getPreprocessor() const
ASTContext & getASTContext() const
DeclRefExpr * BuildDeclRefExpr(ValueDecl *D, QualType Ty, ExprValueKind VK, SourceLocation Loc, const CXXScopeSpec *SS=nullptr)
const LangOptions & getLangOpts() const
TemplateArgumentLoc getTrivialTemplateArgumentLoc(const TemplateArgument &Arg, QualType NTTPType, SourceLocation Loc)
Allocate a TemplateArgumentLoc where all locations have been initialized to the given location.
bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, bool InUnqualifiedLookup=false)
Perform qualified name lookup into a given context.
Encodes a location in the source.
A trivial tuple used to represent a source range.
Represents the declaration of a struct/union/class/enum.
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
A convenient class for passing around template argument information.
void addArgument(const TemplateArgumentLoc &Loc)
Location wrapper for a TemplateArgument.
Represents a template argument.
void setTemplateParameters(TemplateParameterList *TParams)
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Represents a C++ template name within the type system.
Stores a list of template parameters for a TemplateDecl and its derived classes.
NamedDecl * getParam(unsigned Idx)
static TemplateParameterList * Create(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc, Expr *RequiresClause)
Declaration of a template type parameter.
static TemplateTypeParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation KeyLoc, SourceLocation NameLoc, int D, int P, IdentifierInfo *Id, bool Typename, bool ParameterPack, bool HasTypeConstraint=false, UnsignedOrNone NumExpanded=std::nullopt)
static TypeAliasDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, TypeSourceInfo *TInfo)
static TypeAliasTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
Create a function template node.
A container of type source information.
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
static TypeTraitExpr * Create(const ASTContext &C, QualType T, SourceLocation Loc, TypeTrait Kind, ArrayRef< TypeSourceInfo * > Args, SourceLocation RParenLoc, bool Value)
Create a new type trait expression.
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand.
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
static UnaryOperator * Create(const ASTContext &C, Expr *input, Opcode opc, QualType type, ExprValueKind VK, ExprObjectKind OK, SourceLocation l, bool CanOverflow, FPOptionsOverride FPFeatures)
Represents a C++ using-declaration.
static UsingDirectiveDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc, SourceLocation NamespaceLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation IdentLoc, NamedDecl *Nominated, DeclContext *CommonAncestor)
Represents a GCC generic vector type.
BuiltinTypeDeclBuilder & addRWTextureLoadMethods(ResourceDimension Dim, bool IsArray=false)
BuiltinTypeDeclBuilder & addDefaultHandleConstructor(AccessSpecifier Access=AccessSpecifier::AS_public)
BuiltinTypeDeclBuilder & addConsumeMethod()
BuiltinTypeDeclBuilder & addSampleGradMethods(ResourceDimension Dim, bool IsArray=false)
BuiltinTypeDeclBuilder & addCopyAssignmentOperator(AccessSpecifier Access=AccessSpecifier::AS_public)
BuiltinTypeDeclBuilder & addGatherCmpMethods(ResourceDimension Dim, bool IsArray=false)
BuiltinTypeDeclBuilder & addGetDimensionsMethodForBuffer()
BuiltinTypeDeclBuilder & addTextureLoadMSMethods(ResourceDimension Dim, bool IsArray=false)
BuiltinTypeDeclBuilder & addConstantBufferConversionToType()
BuiltinTypeDeclBuilder & addSamplerHandle()
BuiltinTypeDeclBuilder & addTextureLoadMethods(ResourceDimension Dim, bool IsArray=false)
BuiltinTypeDeclBuilder & completeDefinition()
BuiltinTypeDeclBuilder & addSampleBiasMethods(ResourceDimension Dim, bool IsArray=false)
BuiltinTypeDeclBuilder & addBufferHandles(ResourceClass RC, bool IsROV, bool RawBuffer, bool HasCounter, AccessSpecifier Access=AccessSpecifier::AS_private)
BuiltinTypeDeclBuilder & addByteAddressBufferStoreMethods()
BuiltinTypeDeclBuilder & addSampleMethods(ResourceDimension Dim, bool IsArray=false)
BuiltinTypeDeclBuilder & addArraySubscriptOperators(ResourceDimension Dim=ResourceDimension::Unknown, bool IsArray=false)
BuiltinTypeDeclBuilder & addSampleLevelMethods(ResourceDimension Dim, bool IsArray=false)
BuiltinTypeDeclBuilder & addCopyConstructor(AccessSpecifier Access=AccessSpecifier::AS_public)
BuiltinTypeDeclBuilder & addAppendMethod()
BuiltinTypeDeclBuilder & addHeapResourceInfoConstructor(bool HasCounter=false)
BuiltinTypeDeclBuilder & addIncrementCounterMethod()
BuiltinTypeDeclBuilder & addSampleCmpMethods(ResourceDimension Dim, bool IsArray=false)
BuiltinTypeDeclBuilder & addMipsMember(ResourceDimension Dim)
BuiltinTypeDeclBuilder & addHeapSamplerInfoConstructor()
BuiltinTypeDeclBuilder & addByteAddressBufferLoadMethods()
BuiltinTypeDeclBuilder & addStaticInitializationFunctions(bool HasCounter)
BuiltinTypeDeclBuilder & addGatherMethods(ResourceDimension Dim, bool IsArray=false)
BuiltinTypeDeclBuilder & addCalculateLodMethods(ResourceDimension Dim)
BuiltinTypeDeclBuilder & addGetDimensionsMethods(ResourceDimension Dim)
BuiltinTypeDeclBuilder & addByteAddressBufferInterlockedMethods()
BuiltinTypeDeclBuilder & addDecrementCounterMethod()
BuiltinTypeDeclBuilder & addTextureHandle(ResourceClass RC, bool IsROV, bool IsArray, ResourceDimension RD, Expr *SampleCountExpr=nullptr, AccessSpecifier Access=AccessSpecifier::AS_private)
BuiltinTypeDeclBuilder & addLoadMethods()
BuiltinTypeDeclBuilder & addSampleCmpLevelZeroMethods(ResourceDimension Dim, bool IsArray=false)
@ LLVM_MARK_AS_BITMASK_ENUM
const internal::ArgumentAdaptingMatcherFunc< internal::HasMatcher > has
Matches AST nodes that have child AST nodes that match the provided matcher.
bool Load(InterpState &S, CodePtr OpPC)
std::variant< struct RequiresDecl, struct HeaderDecl, struct UmbrellaDirDecl, struct ModuleDecl, struct ExcludeDecl, struct ExportDecl, struct ExportAsDecl, struct ExternModuleDecl, struct UseDecl, struct LinkDecl, struct ConfigMacrosDecl, struct ConflictDecl > Decl
All declarations that can appear in a module declaration.
Top level wrappers for InstallAPI frontend operations.
bool isa(CodeGen::Address addr)
@ OK_Ordinary
An ordinary object is located at an address in memory.
LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE()
@ Default
Set to the current date and time.
@ Result
The result type of a method or function.
const FunctionProtoType * T
@ Template
We are parsing a template declaration.
LangAS
Defines the address space values used by the address space qualifier of QualType.
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
U cast(CodeGen::Address addr)
@ Class
The "class" keyword introduces the elaborated-type-specifier.
static const ASTTemplateArgumentListInfo * Create(const ASTContext &C, const TemplateArgumentListInfo &List)
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
Extra information about a function prototype.
const ExtParameterInfo * ExtParameterInfos