;
30using namespacellvm::hlsl;
36structTemplateParameterListBuilder;
38classBuiltinTypeDeclBuilder {
42llvm::StringMap<FieldDecl *> Fields;
47 friend structTemplateParameterListBuilder;
50: SemaRef(SemaRef),
Record(R) {
51 Record->startDefinition();
52Template =
Record->getDescribedClassTemplate();
57: HLSLNamespace(
Namespace), SemaRef(SemaRef) {
66 if(
auto*TD = dyn_cast<ClassTemplateDecl>(
Found)) {
67PrevDecl = TD->getTemplatedDecl();
70PrevDecl = dyn_cast<CXXRecordDecl>(
Found);
71assert(PrevDecl &&
"Unexpected lookup result type.");
76Template = PrevTemplate;
83 Record->setImplicit(
true);
84 Record->setLexicalDeclContext(HLSLNamespace);
85 Record->setHasExternalLexicalStorage();
89FinalAttr::Keyword_final));
92~BuiltinTypeDeclBuilder() {
93 if(HLSLNamespace && !Template &&
Record->getDeclContext() == HLSLNamespace)
109BuiltinTypeDeclBuilder &
112assert(!
Record->isCompleteDefinition() &&
"record is already complete");
113assert(
Record->isBeingDefined() &&
114 "Definition must be started before adding members!");
122 nullptr,
false, InClassInitStyle::ICIS_NoInit);
123 Field->setAccess(Access);
124 Field->setImplicit(
true);
125 for(
Attr*A : Attrs) {
131Fields[Name] =
Field;
135BuiltinTypeDeclBuilder &
136addHandleMember(ResourceClass RC, ResourceKind RK,
boolIsROV,
boolRawBuffer,
138assert(!
Record->isCompleteDefinition() &&
"record is already complete");
147HLSLResourceClassAttr::CreateImplicit(Ctx, RC),
148IsROV ? HLSLROVAttr::CreateImplicit(Ctx) : nullptr,
149RawBuffer ? HLSLRawBufferAttr::CreateImplicit(Ctx) : nullptr,
151? HLSLContainedTypeAttr::CreateImplicit(Ctx, ElementTypeInfo)
153 Attr*ResourceAttr = HLSLResourceAttr::CreateImplicit(Ctx, RK);
156addMemberVariable(
"__handle", AttributedResTy, {ResourceAttr}, Access);
160BuiltinTypeDeclBuilder &addDefaultHandleConstructor() {
161 if(
Record->isCompleteDefinition())
175ConstexprSpecKind::Unspecified);
179 Constructor->setAccess(AccessSpecifier::AS_public);
180 Record->addDecl(Constructor);
184BuiltinTypeDeclBuilder &addArraySubscriptOperators() {
189addHandleAccessFunction(Subscript,
true,
true);
190addHandleAccessFunction(Subscript,
false,
true);
194BuiltinTypeDeclBuilder &addLoadMethods() {
195 if(
Record->isCompleteDefinition())
202addHandleAccessFunction(Load,
false,
false);
208 autoI = Fields.find(
"__handle");
209assert(I != Fields.end() &&
210I->second->getType()->isHLSLAttributedResourceType() &&
211 "record does not have resource handle field");
215 QualTypegetFirstTemplateTypeParam() {
216assert(Template &&
"record it not a template");
217 if(
const auto*TTD = dyn_cast<TemplateTypeParmDecl>(
219 return QualType(TTD->getTypeForDecl(), 0);
226 returngetFirstTemplateTypeParam();
231BuiltinTypeDeclBuilder &startDefinition() {
232assert(!
Record->isCompleteDefinition() &&
"record is already complete");
233 Record->startDefinition();
237BuiltinTypeDeclBuilder &completeDefinition() {
238assert(!
Record->isCompleteDefinition() &&
"record is already complete");
239assert(
Record->isBeingDefined() &&
240 "Definition must be started before completing it.");
242 Record->completeDefinition();
246 Expr*getConstantIntExpr(
intvalue) {
253TemplateParameterListBuilder addTemplateArgumentList();
258BuiltinTypeDeclBuilder &addIncrementCounterMethod();
259BuiltinTypeDeclBuilder &addDecrementCounterMethod();
260BuiltinTypeDeclBuilder &addHandleAccessFunction(
DeclarationName&Name,
261 boolIsConst,
boolIsRef);
262BuiltinTypeDeclBuilder &addAppendMethod();
263BuiltinTypeDeclBuilder &addConsumeMethod();
266structTemplateParameterListBuilder {
267BuiltinTypeDeclBuilder &Builder;
270TemplateParameterListBuilder(BuiltinTypeDeclBuilder &RB) : Builder(RB) {}
272~TemplateParameterListBuilder() { finalizeTemplateArgs(); }
274TemplateParameterListBuilder &
276assert(!Builder.Record->isCompleteDefinition() &&
277 "record is already complete");
278 ASTContext&AST = Builder.SemaRef.getASTContext();
279 unsignedPosition =
static_cast<unsigned>(Params.size());
283&AST.
Idents.
get(Name, tok::TokenKind::identifier),
287 if(!DefaultValue.isNull())
288 Decl->setDefaultArgument(AST,
289Builder.SemaRef.getTrivialTemplateArgumentLoc(
292Params.emplace_back(
Decl);
323 DeclContext*DC = Builder.Record->getDeclContext();
330 "unexpected concept decl parameter count");
339Builder.Record->getDeclContext(),
349 T->setDeclContext(DC);
365Context, Builder.Record->getDeclContext(),
Loc, {CSETA});
374TALI.addArgument(TAL);
389BuiltinTypeDeclBuilder &finalizeTemplateArgs(
ConceptDecl*CD =
nullptr) {
395CD ? constructConceptSpecializationExpr(Builder.SemaRef, CD) : nullptr;
396 auto*ParamList = TemplateParameterList::Create(
403Builder.Record->setDescribedClassTemplate(Builder.Template);
404Builder.Template->setImplicit(
true);
405Builder.Template->setLexicalDeclContext(Builder.Record->getDeclContext());
409Builder.Template->setPreviousDecl(Builder.PrevTemplate);
410Builder.Record->getDeclContext()->addDecl(Builder.Template);
413 QualType T= Builder.Template->getInjectedClassNameSpecialization();
442structBuiltinTypeMethodBuilder {
446HLSLParamModifierAttr::Spelling Modifier;
448HLSLParamModifierAttr::Spelling Modifier)
449: NameII(NameII), Ty(Ty), Modifier(Modifier) {}
452BuiltinTypeDeclBuilder &DeclBuilder;
467 enum classPlaceHolder { _0, _1,
_2, _3, Handle = 128, LastStmt };
469 Expr*convertPlaceholder(PlaceHolder PH) {
470 if(PH == PlaceHolder::Handle)
471 returngetResourceHandleExpr();
473 if(PH == PlaceHolder::LastStmt) {
474assert(!StmtsList.empty() &&
"no statements in the list");
475 Stmt*LastStmt = StmtsList.pop_back_val();
476assert(isa<ValueStmt>(LastStmt) &&
477 "last statement does not have a value");
478 returncast<ValueStmt>(LastStmt)->getExprStmt();
481 ASTContext&AST = DeclBuilder.SemaRef.getASTContext();
488 Expr*convertPlaceholder(
Expr*
E) {
return E; }
491BuiltinTypeMethodBuilder(BuiltinTypeDeclBuilder &DB,
DeclarationName&Name,
492 QualTypeReturnTy,
boolIsConst =
false)
494ReturnTy(ReturnTy), Method(nullptr), IsConst(IsConst) {}
496BuiltinTypeMethodBuilder(BuiltinTypeDeclBuilder &DB, StringRef Name,
497 QualTypeReturnTy,
boolIsConst =
false)
498: DeclBuilder(DB), ReturnTy(ReturnTy), Method(nullptr), IsConst(IsConst) {
500DB.SemaRef.getASTContext().Idents.get(Name, tok::TokenKind::identifier);
504BuiltinTypeMethodBuilder &addParam(StringRef Name,
QualTypeTy,
505HLSLParamModifierAttr::Spelling Modifier =
506HLSLParamModifierAttr::Keyword_in) {
507assert(Method ==
nullptr&&
"Cannot add param, method already created");
508 const IdentifierInfo&II = DeclBuilder.SemaRef.getASTContext().Idents.get(
509Name, tok::TokenKind::identifier);
510Params.emplace_back(II, Ty, Modifier);
515 voidcreateMethodDecl() {
516assert(Method ==
nullptr&&
"Method already created");
519 ASTContext&AST = DeclBuilder.SemaRef.getASTContext();
521 for(MethodParam &MP : Params)
522ParamTypes.emplace_back(MP.Ty);
534NameInfo, MethodTy, TSInfo,
SC_None,
false,
false,
541 for(
intI = 0,
E= Params.size(); I !=
E; I++) {
542MethodParam &MP = Params[I];
548 if(MP.Modifier != HLSLParamModifierAttr::Keyword_in) {
550HLSLParamModifierAttr::Create(AST,
SourceRange(), MP.Modifier);
553ParmDecls.push_back(Parm);
554FnProtoLoc.setParam(I, Parm);
560~BuiltinTypeMethodBuilder() { finalizeMethod(); }
562BuiltinTypeMethodBuilder(
constBuiltinTypeMethodBuilder &
Other) =
delete;
563BuiltinTypeMethodBuilder &
564operator=(
constBuiltinTypeMethodBuilder &
Other) =
delete;
566 Expr*getResourceHandleExpr() {
572 ASTContext&AST = DeclBuilder.SemaRef.getASTContext();
575 FieldDecl*HandleField = DeclBuilder.getResourceHandleField();
581 template<
typename... Ts>
582BuiltinTypeMethodBuilder &callBuiltin(StringRef BuiltinName,
583 QualTypeReturnType, Ts... ArgSpecs) {
584std::array<
Expr*,
sizeof...(ArgSpecs)> Args{
585convertPlaceholder(std::forward<Ts>(ArgSpecs))...};
592 ASTContext&AST = DeclBuilder.SemaRef.getASTContext();
598 if(ReturnType.
isNull())
603StmtsList.push_back(
Call);
607 template<
typenameTLHS,
typenameTRHS>
608BuiltinTypeMethodBuilder &assign(TLHS LHS, TRHS RHS) {
609 Expr*LHSExpr = convertPlaceholder(LHS);
610 Expr*RHSExpr = convertPlaceholder(RHS);
612DeclBuilder.SemaRef.getASTContext(), LHSExpr, RHSExpr, BO_Assign,
613LHSExpr->
getType(), ExprValueKind::VK_PRValue,
615StmtsList.push_back(AssignStmt);
619 template<
typenameT> BuiltinTypeMethodBuilder &
dereference(
TPtr) {
620 Expr*PtrExpr = convertPlaceholder(Ptr);
626StmtsList.push_back(Deref);
630BuiltinTypeDeclBuilder &finalizeMethod() {
631assert(!DeclBuilder.Record->isCompleteDefinition() &&
632 "record is already complete");
635 "method decl not created; are you missing a call to build the body?");
638 ASTContext&AST = DeclBuilder.SemaRef.getASTContext();
639assert((ReturnTy == AST.
VoidTy|| !StmtsList.empty()) &&
640 "nothing to return from non-void method");
641 if(ReturnTy != AST.
VoidTy) {
642 if(
Expr*LastExpr = dyn_cast<Expr>(StmtsList.back())) {
645 "Return type of the last statement must match the return type " 647 if(!isa<ReturnStmt>(LastExpr)) {
648StmtsList.pop_back();
658Method->
setAccess(AccessSpecifier::AS_public);
659Method->
addAttr(AlwaysInlineAttr::CreateImplicit(
660AST,
SourceRange(), AlwaysInlineAttr::CXX11_clang_always_inline));
661DeclBuilder.Record->addDecl(Method);
669TemplateParameterListBuilder BuiltinTypeDeclBuilder::addTemplateArgumentList() {
670 returnTemplateParameterListBuilder(*
this);
673BuiltinTypeDeclBuilder &
676 if(
Record->isCompleteDefinition()) {
677assert(Template &&
"existing record it not a template");
679 "template param count mismatch");
683TemplateParameterListBuilder Builder = this->addTemplateArgumentList();
684 for(StringRef Name : Names)
685Builder.addTypeParameter(Name);
686 returnBuilder.finalizeTemplateArgs(CD);
689BuiltinTypeDeclBuilder &BuiltinTypeDeclBuilder::addIncrementCounterMethod() {
690 usingPH = BuiltinTypeMethodBuilder::PlaceHolder;
691 returnBuiltinTypeMethodBuilder(*
this,
"IncrementCounter",
693.callBuiltin(
"__builtin_hlsl_buffer_update_counter",
QualType(),
694PH::Handle, getConstantIntExpr(1))
698BuiltinTypeDeclBuilder &BuiltinTypeDeclBuilder::addDecrementCounterMethod() {
699 usingPH = BuiltinTypeMethodBuilder::PlaceHolder;
700 returnBuiltinTypeMethodBuilder(*
this,
"DecrementCounter",
702.callBuiltin(
"__builtin_hlsl_buffer_update_counter",
QualType(),
703PH::Handle, getConstantIntExpr(-1))
707BuiltinTypeDeclBuilder &
708BuiltinTypeDeclBuilder::addHandleAccessFunction(
DeclarationName&Name,
709 boolIsConst,
boolIsRef) {
710assert(!
Record->isCompleteDefinition() &&
"record is already complete");
712 usingPH = BuiltinTypeMethodBuilder::PlaceHolder;
714 QualTypeElemTy = getHandleElementType();
723 returnBuiltinTypeMethodBuilder(*
this, Name, ReturnTy, IsConst)
725.callBuiltin(
"__builtin_hlsl_resource_getpointer", ElemPtrTy, PH::Handle,
727.dereference(PH::LastStmt)
731BuiltinTypeDeclBuilder &BuiltinTypeDeclBuilder::addAppendMethod() {
732 usingPH = BuiltinTypeMethodBuilder::PlaceHolder;
734 QualTypeElemTy = getHandleElementType();
735 returnBuiltinTypeMethodBuilder(*
this,
"Append", AST.
VoidTy)
736.addParam(
"value", ElemTy)
737.callBuiltin(
"__builtin_hlsl_buffer_update_counter", AST.
UnsignedIntTy,
738PH::Handle, getConstantIntExpr(1))
739.callBuiltin(
"__builtin_hlsl_resource_getpointer",
741.dereference(PH::LastStmt)
742.assign(PH::LastStmt, PH::_0)
746BuiltinTypeDeclBuilder &BuiltinTypeDeclBuilder::addConsumeMethod() {
747 usingPH = BuiltinTypeMethodBuilder::PlaceHolder;
749 QualTypeElemTy = getHandleElementType();
750 returnBuiltinTypeMethodBuilder(*
this,
"Consume", ElemTy)
751.callBuiltin(
"__builtin_hlsl_buffer_update_counter", AST.
UnsignedIntTy,
752PH::Handle, getConstantIntExpr(-1))
753.callBuiltin(
"__builtin_hlsl_resource_getpointer",
755.dereference(PH::LastStmt)
782defineTrivialHLSLTypes();
783defineHLSLTypesWithForwardDeclarations();
799voidHLSLExternalSemaSource::defineHLSLVectorAlias() {
806&AST.
Idents.
get(
"element", tok::TokenKind::identifier),
false,
false);
807TypeParam->setDefaultArgument(
811TemplateParams.emplace_back(TypeParam);
815&AST.
Idents.
get(
"element_count", tok::TokenKind::identifier), AST.
IntTy,
820SizeParam->setDefaultArgument(
823TemplateParams.emplace_back(SizeParam);
842 Record->setImplicit(
true);
848 Record->setDescribedAliasTemplate(Template);
851HLSLNamespace->
addDecl(Template);
854voidHLSLExternalSemaSource::defineTrivialHLSLTypes() {
855defineHLSLVectorAlias();
860ResourceClass RC, ResourceKind RK,
861 boolIsROV,
boolRawBuffer) {
862 returnBuiltinTypeDeclBuilder(S,
Decl)
863.addHandleMember(RC, RK, IsROV, RawBuffer)
864.addDefaultHandleConstructor();
886Context, BoolTy, NameLoc, UTT_IsTypedResourceElementCompatible,
887{TTypeSourceInfo}, NameLoc,
true);
913{TTypeSourceInfo}, NameLoc,
true);
922UETT_SizeOf, TTypeSourceInfo, BoolTy, NameLoc, NameLoc);
936Context, NotIntangibleExpr, SizeGEQOneExpr, BO_LAnd, BoolTy,
VK_LValue,
943 boolisTypedBuffer) {
957 T->setDeclContext(DC);
962Context, DeclLoc, DeclLoc, {
T}, DeclLoc,
nullptr);
965 Expr*ConstraintExpr =
nullptr;
969&Context.
Idents.
get(
"__is_typed_resource_element_compatible"));
973&Context.
Idents.
get(
"__is_structured_resource_element_compatible"));
980ConceptParams, ConstraintExpr);
991voidHLSLExternalSemaSource::defineHLSLTypesWithForwardDeclarations() {
994*SemaPtr, HLSLNamespace,
true);
996*SemaPtr, HLSLNamespace,
false);
997 Decl= BuiltinTypeDeclBuilder(*SemaPtr, HLSLNamespace,
"RWBuffer")
998.addSimpleTemplateParams({
"element_type"}, TypedBufferConcept)
999.finalizeForwardDeclaration();
1003ResourceKind::TypedBuffer,
false,
1005.addArraySubscriptOperators()
1007.completeDefinition();
1011BuiltinTypeDeclBuilder(*SemaPtr, HLSLNamespace,
"RasterizerOrderedBuffer")
1012.addSimpleTemplateParams({
"element_type"}, StructuredBufferConcept)
1013.finalizeForwardDeclaration();
1016ResourceKind::TypedBuffer,
true,
1018.addArraySubscriptOperators()
1020.completeDefinition();
1023 Decl= BuiltinTypeDeclBuilder(*SemaPtr, HLSLNamespace,
"StructuredBuffer")
1024.addSimpleTemplateParams({
"element_type"}, StructuredBufferConcept)
1025.finalizeForwardDeclaration();
1029.addArraySubscriptOperators()
1031.completeDefinition();
1034 Decl= BuiltinTypeDeclBuilder(*SemaPtr, HLSLNamespace,
"RWStructuredBuffer")
1035.addSimpleTemplateParams({
"element_type"}, StructuredBufferConcept)
1036.finalizeForwardDeclaration();
1040.addArraySubscriptOperators()
1042.addIncrementCounterMethod()
1043.addDecrementCounterMethod()
1044.completeDefinition();
1048BuiltinTypeDeclBuilder(*SemaPtr, HLSLNamespace,
"AppendStructuredBuffer")
1049.addSimpleTemplateParams({
"element_type"}, StructuredBufferConcept)
1050.finalizeForwardDeclaration();
1055.completeDefinition();
1059BuiltinTypeDeclBuilder(*SemaPtr, HLSLNamespace,
"ConsumeStructuredBuffer")
1060.addSimpleTemplateParams({
"element_type"}, StructuredBufferConcept)
1061.finalizeForwardDeclaration();
1066.completeDefinition();
1069 Decl= BuiltinTypeDeclBuilder(*SemaPtr, HLSLNamespace,
1070 "RasterizerOrderedStructuredBuffer")
1071.addSimpleTemplateParams({
"element_type"}, StructuredBufferConcept)
1072.finalizeForwardDeclaration();
1076.addArraySubscriptOperators()
1078.addIncrementCounterMethod()
1079.addDecrementCounterMethod()
1080.completeDefinition();
1083 Decl= BuiltinTypeDeclBuilder(*SemaPtr, HLSLNamespace,
"ByteAddressBuffer")
1084.finalizeForwardDeclaration();
1089.completeDefinition();
1091 Decl= BuiltinTypeDeclBuilder(*SemaPtr, HLSLNamespace,
"RWByteAddressBuffer")
1092.finalizeForwardDeclaration();
1097.completeDefinition();
1099 Decl= BuiltinTypeDeclBuilder(*SemaPtr, HLSLNamespace,
1100 "RasterizerOrderedByteAddressBuffer")
1101.finalizeForwardDeclaration();
1106.completeDefinition();
1111CompletionFunction Fn) {
1112 if(!
Record->isCompleteDefinition())
1113Completions.insert(std::make_pair(
Record->getCanonicalDecl(), Fn));
1117 if(!isa<CXXRecordDecl>(Tag))
1119 auto Record= cast<CXXRecordDecl>(Tag);
1123 if(
autoTDecl = dyn_cast<ClassTemplateSpecializationDecl>(
Record))
1124 Record= TDecl->getSpecializedTemplate()->getTemplatedDecl();
1126 autoIt = Completions.find(
Record);
1127 if(It == Completions.end())
1144 "Since this is a builtin it should always resolve!");
Defines the clang::ASTContext interface.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
static BuiltinTypeDeclBuilder setupBufferType(CXXRecordDecl *Decl, Sema &S, ResourceClass RC, ResourceKind RK, bool IsROV, bool RawBuffer)
Set up common members and attributes for buffer types.
static ConceptDecl * constructBufferConceptDecl(Sema &S, NamespaceDecl *NSD, bool isTypedBuffer)
static Expr * constructTypedBufferConstraintExpr(Sema &S, SourceLocation NameLoc, TemplateTypeParmDecl *T)
static FunctionDecl * lookupBuiltinFunction(Sema &S, StringRef Name)
static Expr * constructStructuredBufferConstraintExpr(Sema &S, SourceLocation NameLoc, TemplateTypeParmDecl *T)
llvm::MachO::Record Record
This file declares semantic analysis for HLSL constructs.
Defines the clang::SourceLocation class and associated facilities.
C Language Family Type Representation.
static std::optional< DereferenceInfo > dereference(ProgramStateRef State, const FieldRegion *FR)
Dereferences FR and returns with the pointee's region, and whether it needs to be casted back to it's...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
TranslationUnitDecl * getTranslationUnitDecl() const
unsigned getIntWidth(QualType T) const
DeclarationNameTable DeclarationNames
QualType getRecordType(const RecordDecl *Decl) const
QualType getInjectedClassNameType(CXXRecordDecl *Decl, QualType TST) const
getInjectedClassNameType - Return the unique reference to the injected class name type for the specif...
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
QualType getLValueReferenceType(QualType T, bool SpelledAsLValue=true) const
Return the uniqued reference to the type for an lvalue reference to the specified type.
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
QualType getTemplateTypeParmType(unsigned Depth, unsigned Index, bool ParameterPack, TemplateTypeParmDecl *ParmDecl=nullptr) const
Retrieve the template type parameter type for a template parameter or parameter pack with the given d...
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location,...
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
CanQualType UnsignedIntTy
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
QualType getDependentSizedExtVectorType(QualType VectorType, Expr *SizeExpr, SourceLocation AttrLoc) const
Attr - This represents one attribute.
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++ constructor within a class.
static CXXConstructorDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, ExplicitSpecifier ES, bool UsesFPIntrin, bool isInline, bool isImplicitlyDeclared, ConstexprSpecKind ConstexprKind, InheritedConstructor Inherited=InheritedConstructor(), Expr *TrailingRequiresClause=nullptr)
Represents a static or instance method of a struct/union/class.
static CXXMethodDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool UsesFPIntrin, bool isInline, ConstexprSpecKind ConstexprKind, SourceLocation EndLocation, Expr *TrailingRequiresClause=nullptr)
QualType getFunctionObjectParameterType() const
Represents a C++ struct/union/class.
static CXXRecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl=nullptr, bool DelayTypeCreation=false)
Represents the this expression in C++.
static CXXThisExpr * Create(const ASTContext &Ctx, SourceLocation L, QualType Ty, bool IsImplicit)
static CallExpr * Create(const ASTContext &Ctx, Expr *Fn, ArrayRef< Expr * > Args, QualType Ty, ExprValueKind VK, SourceLocation RParenLoc, FPOptionsOverride FPFeatures, unsigned MinNumArgs=0, ADLCallKind UsesADL=NotADL)
Create a call expression.
Declaration of a class template.
static ClassTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
Create a class template node.
static CompoundStmt * Create(const ASTContext &C, ArrayRef< Stmt * > Stmts, FPOptionsOverride FPFeatures, SourceLocation LB, SourceLocation RB)
Declaration of a C++20 concept.
static ConceptDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, Expr *ConstraintExpr=nullptr)
A reference to a concept and its template args, as it appears in the code.
static ConceptReference * Create(const ASTContext &C, NestedNameSpecifierLoc NNS, SourceLocation TemplateKWLoc, DeclarationNameInfo ConceptNameInfo, NamedDecl *FoundDecl, ConceptDecl *NamedConcept, const ASTTemplateArgumentListInfo *ArgsAsWritten)
Represents the specialization of a concept - evaluates to a prvalue of type bool.
static ConceptSpecializationExpr * Create(const ASTContext &C, ConceptReference *ConceptRef, ImplicitConceptSpecializationDecl *SpecDecl, const ConstraintSatisfaction *Satisfaction)
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
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...
void setHasExternalLexicalStorage(bool ES=true) const
State whether this DeclContext has external storage for declarations lexically in this context.
decl_iterator decls_begin() const
A reference to a declared variable, function, enum, etc.
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.
ASTContext & getASTContext() const LLVM_READONLY
void setAccess(AccessSpecifier AS)
void setImplicit(bool I=true)
DeclContext * getDeclContext()
void setLexicalDeclContext(DeclContext *DC)
The name of a declaration.
TypeSourceInfo * getTypeSourceInfo() const
Store information needed for an explicit specifier.
This represents one expression.
Represents difference between two FPOptions values.
Represents a member of a struct/union/class.
static FieldDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, Expr *BW, bool Mutable, InClassInitStyle InitStyle)
Represents a function declaration or definition.
const ParmVarDecl * getParamDecl(unsigned i) const
QualType getReturnType() const
DeclarationNameInfo getNameInfo() const
bool hasBody(const FunctionDecl *&Definition) const
Returns true if the function has a body.
void setParams(ArrayRef< ParmVarDecl * > NewParamInfo)
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 ...
~HLSLExternalSemaSource() override
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 ImplicitConceptSpecializationDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation SL, ArrayRef< TemplateArgument > ConvertedArgs)
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.
NamedDecl * getFoundDecl() const
Fetch the unique decl found by this lookup.
bool isSingleResult() const
Determines if this names a single result which is not an unresolved value using decl.
static MemberExpr * CreateImplicit(const ASTContext &C, Expr *Base, bool IsArrow, ValueDecl *MemberDecl, QualType T, ExprValueKind VK, ExprObjectKind OK)
Create an implicit MemberExpr, with no location, qualifier, template arguments, and so on.
This represents a decl that may have a name.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Represent a C++ namespace.
NamespaceDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this 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, unsigned D, unsigned P, const IdentifierInfo *Id, QualType T, bool ParameterPack, TypeSourceInfo *TInfo)
Represents a parameter to a function.
static ParmVarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg)
A (possibly-)qualified type.
void addConst()
Add the const type qualifier to this QualType.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
QualType getNonReferenceType() const
If Type is a reference type (e.g., const int&), returns the type that the reference refers to ("const...
static ReturnStmt * Create(const ASTContext &Ctx, SourceLocation RL, Expr *E, const VarDecl *NRVOCandidate)
Create a return statement.
Sema - This implements semantic analysis and AST building for C.
TemplateArgumentLoc getTrivialTemplateArgumentLoc(const TemplateArgument &Arg, QualType NTTPType, SourceLocation Loc, NamedDecl *TemplateParam=nullptr)
Allocate a TemplateArgumentLoc where all locations have been initialized to the given location.
Scope * getCurScope() const
Retrieve the parser's current scope.
@ LookupOrdinaryName
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....
@ LookupNamespaceName
Look up a namespace name within a C++ using directive or namespace alias definition,...
@ LookupTagName
Tag name lookup, which finds the names of enums, classes, structs, and unions.
ASTContext & getASTContext() const
bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, bool InUnqualifiedLookup=false)
Perform qualified name lookup into a given context.
bool LookupName(LookupResult &R, Scope *S, bool AllowBuiltinCreation=false, bool ForceNoCPlusPlus=false)
Perform unqualified name lookup starting from a given scope.
Encodes a location in the source.
A trivial tuple used to represent a source range.
Stmt - This represents one statement.
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.
Location wrapper for a TemplateArgument.
Represents a template argument.
void setTemplateParameters(TemplateParameterList *TParams)
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
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, unsigned D, unsigned P, IdentifierInfo *Id, bool Typename, bool ParameterPack, bool HasTypeConstraint=false, std::optional< unsigned > 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.
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
A container of type source information.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
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.
The base class of the type hierarchy.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
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)
__inline void unsigned int _2
bool This(InterpState &S, CodePtr OpPC)
bool Load(InterpState &S, CodePtr OpPC)
The JSON file list parser is used to communicate input to InstallAPI.
@ OK_Ordinary
An ordinary object is located at an address in memory.
@ Result
The result type of a method or function.
bool CreateHLSLAttributedResourceType(Sema &S, QualType Wrapped, ArrayRef< const Attr * > AttrList, QualType &ResType, HLSLAttributedResourceLocInfo *LocInfo=nullptr)
@ 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.
const FunctionProtoType * T
@ Other
Other implicit parameter.
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
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.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4