30#include "llvm/ADT/SmallVector.h"
32using namespace llvm::hlsl;
40static FunctionDecl *lookupBuiltinFunction(Sema &S, StringRef Name) {
42 S.getASTContext().Idents.get(Name, tok::TokenKind::identifier);
43 DeclarationNameInfo NameInfo =
44 DeclarationNameInfo(DeclarationName(&II), SourceLocation());
48 S.LookupName(R, S.getCurScope());
51 assert(
R.isSingleResult() &&
52 "Since this is a builtin it should always resolve!");
56static QualType lookupBuiltinType(Sema &S, StringRef Name, DeclContext *DC) {
58 S.getASTContext().Idents.get(Name, tok::TokenKind::identifier);
60 S.LookupQualifiedName(
Result, DC);
61 assert(!
Result.empty() &&
"Builtin type not found");
63 S.getASTContext().getTypeDeclType(
Result.getAsSingle<TypeDecl>());
64 S.RequireCompleteType(SourceLocation(), Ty,
65 diag::err_tentative_def_incomplete_type);
69CXXConstructorDecl *lookupCopyConstructor(QualType ResTy) {
70 assert(ResTy->isRecordType() &&
"not a CXXRecord type");
71 for (
auto *CD : ResTy->getAsCXXRecordDecl()->ctors())
72 if (CD->isCopyConstructor())
78convertParamModifierToParamABI(HLSLParamModifierAttr::Spelling Modifier) {
79 assert(Modifier != HLSLParamModifierAttr::Spelling::Keyword_in &&
80 "HLSL 'in' parameters modifier cannot be converted to ParameterABI");
82 case HLSLParamModifierAttr::Spelling::Keyword_out:
84 case HLSLParamModifierAttr::Spelling::Keyword_inout:
87 llvm_unreachable(
"Invalid HLSL parameter modifier");
91QualType getInoutParameterType(ASTContext &AST, QualType Ty) {
92 assert(!Ty->isReferenceType() &&
93 "Pointer and reference types cannot be inout or out parameters");
148 HLSLParamModifierAttr::Spelling Modifier;
150 HLSLParamModifierAttr::Spelling Modifier)
151 : NameII(NameII), Ty(Ty), Modifier(Modifier) {}
158 LocalVar(StringRef Name,
QualType Ty) : Name(Name), Ty(Ty),
Decl(
nullptr) {}
182 enum class PlaceHolder {
195 Expr *convertPlaceholder(PlaceHolder PH);
196 Expr *convertPlaceholder(LocalVar &Var);
197 Expr *convertPlaceholder(
Expr *E) {
return E; }
205 QualType ReturnTy,
bool IsConst =
false,
207 : DeclBuilder(DB), Name(Name), ReturnTy(ReturnTy), Method(
nullptr),
208 IsConst(IsConst), IsCtor(IsCtor), SC(SC) {}
211 QualType ReturnTy,
bool IsConst =
false,
221 HLSLParamModifierAttr::Spelling Modifier =
222 HLSLParamModifierAttr::Keyword_in);
225 template <
typename... Ts>
227 QualType ReturnType, Ts &&...ArgSpecs);
228 template <
typename TLHS,
typename TRHS>
231 template <
typename V,
typename S>
234 template <
typename T>
236 template <
typename T>
239 template <
typename ValueT>
242 template <
typename ResourceT,
typename ValueT>
247 template <
typename T>
250 template <
typename ResourceT,
typename ValueT>
265 void ensureCompleteDecl() {
278 assert(!
Builder.Record->isCompleteDefinition() &&
279 "record is already complete");
281 unsigned Position =
static_cast<unsigned>(
Params.size());
285 &AST.
Idents.
get(Name, tok::TokenKind::identifier),
289 if (!DefaultValue.
isNull())
290 Decl->setDefaultArgument(AST,
291 Builder.SemaRef.getTrivialTemplateArgumentLoc(
333 "unexpected concept decl parameter count");
342 Builder.Record->getDeclContext(),
352 T->setDeclContext(DC);
354 QualType ConceptTType = Context.getTypeDeclType(ConceptTTPD);
360 QualType CSETType = Context.getTypeDeclType(T);
368 Context,
Builder.Record->getDeclContext(), Loc, {CSETA});
408 Builder.Template->setImplicit(
true);
409 Builder.Template->setLexicalDeclContext(
Builder.Record->getDeclContext());
420Expr *BuiltinTypeMethodBuilder::convertPlaceholder(PlaceHolder PH) {
421 if (PH == PlaceHolder::Handle)
423 if (PH == PlaceHolder::CounterHandle)
425 if (PH == PlaceHolder::This) {
428 Method->getFunctionObjectParameterType(),
432 if (PH == PlaceHolder::LastStmt) {
433 assert(!StmtsList.empty() &&
"no statements in the list");
434 Stmt *LastStmt = StmtsList.pop_back_val();
435 assert(
isa<ValueStmt>(LastStmt) &&
"last statement does not have a value");
444 ParmVarDecl *ParamDecl = Method->getParamDecl(
static_cast<unsigned>(PH));
446 AST, NestedNameSpecifierLoc(), SourceLocation(), ParamDecl,
false,
447 DeclarationNameInfo(ParamDecl->getDeclName(), SourceLocation()),
448 ParamDecl->getType().getNonReferenceType(),
VK_LValue);
451Expr *BuiltinTypeMethodBuilder::convertPlaceholder(LocalVar &Var) {
452 VarDecl *VD = Var.Decl;
453 assert(VD &&
"local variable is not declared");
455 VD->getASTContext(), NestedNameSpecifierLoc(), SourceLocation(), VD,
456 false, DeclarationNameInfo(VD->getDeclName(), SourceLocation()),
460Expr *BuiltinTypeMethodBuilder::convertPlaceholder(QualType Ty) {
461 ASTContext &AST = DeclBuilder.SemaRef.getASTContext();
464 return new (AST) CXXScalarValueInitExpr(
472 bool IsConst,
bool IsCtor,
474 : DeclBuilder(DB), ReturnTy(ReturnTy), Method(
nullptr), IsConst(IsConst),
475 IsCtor(IsCtor), SC(SC) {
477 assert((!NameStr.empty() || IsCtor) &&
"method needs a name");
478 assert(((IsCtor && !IsConst) || !IsCtor) &&
"constructor cannot be const");
486 AST.
Idents.
get(NameStr, tok::TokenKind::identifier);
493 HLSLParamModifierAttr::Spelling Modifier) {
494 assert(Method ==
nullptr &&
"Cannot add param, method already created");
495 const IdentifierInfo &II = DeclBuilder.SemaRef.getASTContext().Idents.get(
496 Name, tok::TokenKind::identifier);
497 Params.emplace_back(II, Ty, Modifier);
501 assert(Method ==
nullptr &&
502 "Cannot add template param, method already created");
503 ASTContext &AST = DeclBuilder.SemaRef.getASTContext();
504 unsigned Position =
static_cast<unsigned>(TemplateParamDecls.size());
508 &AST.
Idents.
get(Name, tok::TokenKind::identifier),
512 TemplateParamDecls.push_back(
Decl);
517void BuiltinTypeMethodBuilder::createDecl() {
518 assert(
Method ==
nullptr &&
"Method or constructor is already created");
524 uint32_t ArgIndex = 0;
527 bool UseParamExtInfo =
false;
528 for (Param &MP : Params) {
529 if (MP.Modifier != HLSLParamModifierAttr::Keyword_in) {
530 UseParamExtInfo =
true;
532 ParamExtInfos[ArgIndex] =
533 PI.
withABI(convertParamModifierToParamABI(MP.Modifier));
534 if (!MP.Ty->isDependentType())
535 MP.Ty = getInoutParameterType(AST, MP.Ty);
537 ParamTypes.emplace_back(MP.Ty);
541 FunctionProtoType::ExtProtoInfo ExtInfo;
543 ExtInfo.ExtParameterInfos = ParamExtInfos.data();
545 ExtInfo.TypeQuals.addConst();
551 DeclarationNameInfo NameInfo = DeclarationNameInfo(Name, SourceLocation());
554 AST, DeclBuilder.Record, SourceLocation(), NameInfo, FuncTy, TSInfo,
555 ExplicitSpecifier(),
false,
true,
false,
559 AST, DeclBuilder.Record, SourceLocation(), NameInfo, FuncTy, TSInfo,
560 false,
true, ExplicitSpecifier(),
564 AST, DeclBuilder.Record, SourceLocation(), NameInfo, FuncTy, TSInfo, SC,
571 Method->getTypeSourceInfo()->getTypeLoc().getAs<FunctionProtoTypeLoc>();
572 for (
int I = 0, E = Params.size(); I != E; I++) {
573 Param &MP = Params[I];
575 AST, Method, SourceLocation(), SourceLocation(), &MP.NameII, MP.Ty,
578 if (MP.Modifier != HLSLParamModifierAttr::Keyword_in) {
580 HLSLParamModifierAttr::Create(AST, SourceRange(), MP.Modifier);
583 Parm->setScopeInfo(CurScopeDepth, I);
584 ParmDecls.push_back(Parm);
585 FnProtoLoc.setParam(I, Parm);
587 Method->setParams({ParmDecls});
591 ensureCompleteDecl();
593 ASTContext &AST = DeclBuilder.SemaRef.getASTContext();
595 AST,
SourceLocation(), Method->getFunctionObjectParameterType(),
true);
596 FieldDecl *HandleField = DeclBuilder.getResourceHandleField();
603 ensureCompleteDecl();
605 ASTContext &AST = DeclBuilder.SemaRef.getASTContext();
607 AST,
SourceLocation(), Method->getFunctionObjectParameterType(),
true);
608 FieldDecl *HandleField = DeclBuilder.getResourceCounterHandleField();
616 ensureCompleteDecl();
618 assert(Var.Decl ==
nullptr &&
"local variable is already declared");
620 ASTContext &AST = DeclBuilder.SemaRef.getASTContext();
623 &AST.
Idents.
get(Var.Name, tok::TokenKind::identifier), Var.Ty,
627 StmtsList.push_back(DS);
631template <
typename V,
typename S>
634 assert(ResultTy->
isVectorType() &&
"The result type must be a vector type.");
635 ASTContext &AST = DeclBuilder.SemaRef.getASTContext();
636 Expr *VecExpr = convertPlaceholder(Vec);
638 Expr *ScalarExpr = convertPlaceholder(Scalar);
642 LocalVar VecVar(
"vec_tmp", VecTy->desugar());
646 QualType EltTy = VecTy->getElementType();
647 unsigned NumElts = VecTy->getNumElements();
650 for (
unsigned I = 0; I < NumElts; ++I) {
652 convertPlaceholder(VecVar), DeclBuilder.getConstantIntExpr(I), EltTy,
655 Elts.push_back(ScalarExpr);
661 ExprResult Cast = DeclBuilder.SemaRef.BuildCStyleCastExpr(
664 assert(!Cast.isInvalid() &&
"Cast cannot fail!");
665 StmtsList.push_back(Cast.get());
671 ASTContext &AST = DeclBuilder.SemaRef.getASTContext();
675 StmtsList.push_back(ThisExpr);
679template <
typename... Ts>
682 QualType ReturnType, Ts &&...ArgSpecs) {
683 ensureCompleteDecl();
685 std::array<
Expr *,
sizeof...(ArgSpecs)> Args{
686 convertPlaceholder(std::forward<Ts>(ArgSpecs))...};
688 ASTContext &AST = DeclBuilder.SemaRef.getASTContext();
689 FunctionDecl *FD = lookupBuiltinFunction(DeclBuilder.SemaRef, BuiltinName);
697 assert(!
Call.isInvalid() &&
"Call to builtin cannot fail!");
700 if (!ReturnType.
isNull() &&
702 ExprResult CastResult = DeclBuilder.SemaRef.BuildCStyleCastExpr(
705 assert(!CastResult.isInvalid() &&
"Cast cannot fail!");
706 E = CastResult.get();
709 StmtsList.push_back(E);
713template <
typename TLHS,
typename TRHS>
715 Expr *LHSExpr = convertPlaceholder(LHS);
716 Expr *RHSExpr = convertPlaceholder(RHS);
718 DeclBuilder.SemaRef.getASTContext(), LHSExpr, RHSExpr, BO_Assign,
721 StmtsList.push_back(AssignStmt);
727 Expr *PtrExpr = convertPlaceholder(Ptr);
733 StmtsList.push_back(Deref);
740 ensureCompleteDecl();
742 Expr *ResourceExpr = convertPlaceholder(ResourceRecord);
745 ASTContext &AST = DeclBuilder.SemaRef.getASTContext();
748 if (ResourceTypeDecl == DeclBuilder.Record)
749 HandleField = DeclBuilder.getResourceHandleField();
752 for (
auto *
Decl : ResourceTypeDecl->lookup(&II)) {
753 if ((HandleField = dyn_cast<FieldDecl>(
Decl)))
756 assert(HandleField &&
"Resource handle field not found");
762 StmtsList.push_back(HandleExpr);
770 ensureCompleteDecl();
771 Expr *
Base = convertPlaceholder(ResourceRecord);
773 ASTContext &AST = DeclBuilder.SemaRef.getASTContext();
777 StmtsList.push_back(
Member);
782 FieldDecl *MipsField = DeclBuilder.Fields.lookup(
"mips");
786 ASTContext &AST = DeclBuilder.SemaRef.getASTContext();
788 const auto *RT = MipsTy->
castAs<RecordType>();
792 assert(MipsRecord->field_begin() != MipsRecord->field_end() &&
793 "mips_type must have at least one field");
794 assert(std::next(MipsRecord->field_begin()) == MipsRecord->field_end() &&
795 "mips_type must have exactly one field");
796 FieldDecl *MipsHandleField = *MipsRecord->field_begin();
798 FieldDecl *HandleField = DeclBuilder.getResourceHandleField();
799 Expr *ResExpr = convertPlaceholder(ResourceRecord);
808 AST, MipsMemberExpr,
false, MipsHandleField, MipsHandleField->
getType(),
812 AST, MipsHandleMemberExpr, HandleMemberExpr, BO_Assign,
816 StmtsList.push_back(AssignStmt);
819template <
typename ValueT>
822 ValueT HandleValue) {
824 DeclBuilder.getResourceHandleField());
829template <
typename ResourceT,
typename ValueT>
832 ResourceT ResourceRecord, ValueT HandleValue) {
834 DeclBuilder.getResourceCounterHandleField());
837template <
typename ResourceT,
typename ValueT>
839 ResourceT ResourceRecord, ValueT HandleValue,
FieldDecl *HandleField) {
840 ensureCompleteDecl();
842 Expr *ResourceExpr = convertPlaceholder(ResourceRecord);
845 "Getting the field from the wrong resource type.");
847 Expr *HandleValueExpr = convertPlaceholder(HandleValue);
849 ASTContext &AST = DeclBuilder.SemaRef.getASTContext();
854 DeclBuilder.SemaRef.getASTContext(), HandleMemberExpr, HandleValueExpr,
857 StmtsList.push_back(AssignStmt);
864 ensureCompleteDecl();
866 Expr *ResourceExpr = convertPlaceholder(ResourceRecord);
868 "Getting the field from the wrong resource type.");
870 ASTContext &AST = DeclBuilder.SemaRef.getASTContext();
871 FieldDecl *HandleField = DeclBuilder.getResourceCounterHandleField();
875 StmtsList.push_back(HandleExpr);
881 ensureCompleteDecl();
883 Expr *ReturnValueExpr = convertPlaceholder(ReturnValue);
884 ASTContext &AST = DeclBuilder.SemaRef.getASTContext();
887 if (Ty->
isRecordType() && !Method->getReturnType()->isReferenceType()) {
894 assert(CD &&
"no copy constructor found");
909 assert(!DeclBuilder.Record->isCompleteDefinition() &&
910 "record is already complete");
912 ensureCompleteDecl();
914 if (!Method->hasBody()) {
915 ASTContext &AST = DeclBuilder.SemaRef.getASTContext();
916 assert((ReturnTy == AST.
VoidTy || !StmtsList.empty()) &&
917 "nothing to return from non-void method");
918 if (ReturnTy != AST.
VoidTy) {
919 if (
Expr *LastExpr = dyn_cast<Expr>(StmtsList.back())) {
921 ReturnTy.getNonReferenceType()) &&
922 "Return type of the last statement must match the return type "
925 StmtsList.pop_back();
934 Method->setLexicalDeclContext(DeclBuilder.Record);
935 Method->setAccess(Access);
936 Method->setImplicitlyInline();
937 Method->addAttr(AlwaysInlineAttr::CreateImplicit(
938 AST,
SourceRange(), AlwaysInlineAttr::CXX11_clang_always_inline));
939 Method->addAttr(ConvergentAttr::CreateImplicit(AST));
940 if (!TemplateParamDecls.empty()) {
947 TemplateParams, Method);
949 FuncTemplate->setLexicalDeclContext(DeclBuilder.Record);
950 FuncTemplate->setImplicit(
true);
951 Method->setDescribedFunctionTemplate(FuncTemplate);
952 DeclBuilder.Record->addDecl(FuncTemplate);
954 DeclBuilder.Record->addDecl(Method);
961 : SemaRef(SemaRef), Record(R) {
962 Record->startDefinition();
963 Template = Record->getDescribedClassTemplate();
969 : SemaRef(SemaRef), HLSLNamespace(Namespace) {
975 if (SemaRef.LookupQualifiedName(
Result, HLSLNamespace)) {
978 if (
auto *TD = dyn_cast<ClassTemplateDecl>(
Found)) {
979 PrevDecl = TD->getTemplatedDecl();
982 PrevDecl = dyn_cast<CXXRecordDecl>(
Found);
983 assert(PrevDecl &&
"Unexpected lookup result type.");
988 Template = PrevTemplate;
995 Record->setImplicit(
true);
996 Record->setLexicalDeclContext(HLSLNamespace);
997 Record->setHasExternalLexicalStorage();
1001 FinalAttr::CreateImplicit(AST,
SourceRange(), FinalAttr::Keyword_final));
1005 if (HLSLNamespace && !Template && Record->getDeclContext() == HLSLNamespace)
1006 HLSLNamespace->addDecl(Record);
1013 assert(!Record->isCompleteDefinition() &&
"record is already complete");
1014 assert(Record->isBeingDefined() &&
1015 "Definition must be started before adding members!");
1024 Field->setAccess(Access);
1025 Field->setImplicit(
true);
1026 for (
Attr *A : Attrs) {
1031 Record->addDecl(Field);
1032 Fields[Name] = Field;
1038 bool RawBuffer,
bool HasCounter,
1040 QualType ElementTy = getHandleElementType();
1041 addHandleMember(RC, ResourceDimension::Unknown, IsROV, RawBuffer,
1042 false, ElementTy, Access);
1044 addCounterHandleMember(RC, IsROV, RawBuffer, ElementTy, Access);
1050 bool IsArray, ResourceDimension RD,
1052 addHandleMember(RC, RD, IsROV,
false, IsArray,
1053 getHandleElementType(), Access);
1058 addHandleMember(ResourceClass::Sampler, ResourceDimension::Unknown,
1059 false,
false,
false,
1060 getHandleElementType());
1066 assert(!Record->isCompleteDefinition() &&
"record is already complete");
1068 using PH = BuiltinTypeMethodBuilder::PlaceHolder;
1070 QualType ElemTy = getHandleElementType();
1080 .callBuiltin(
"__builtin_hlsl_resource_getpointer",
1082 .dereference(PH::LastStmt)
1088 assert(!
Record->isCompleteDefinition() &&
"record is already complete");
1099CXXRecordDecl *BuiltinTypeDeclBuilder::addPrivateNestedRecord(StringRef Name) {
1100 assert(!
Record->isCompleteDefinition() &&
"record is already complete");
1109 Record->addDecl(NestedRecord);
1110 return NestedRecord;
1114 ResourceClass RC, ResourceDimension RD,
bool IsROV,
bool RawBuffer,
1115 bool IsArray, QualType ElementTy, AccessSpecifier Access) {
1116 return addResourceMember(
"__handle", RC, RD, IsROV, RawBuffer,
1117 false, IsArray, ElementTy, Access);
1121 ResourceClass RC,
bool IsROV,
bool RawBuffer, QualType ElementTy,
1123 return addResourceMember(
"__counter_handle", RC, ResourceDimension::Unknown,
1124 IsROV, RawBuffer,
true,
1125 false, ElementTy, Access);
1129 StringRef MemberName,
ResourceClass RC, ResourceDimension RD,
bool IsROV,
1130 bool RawBuffer,
bool IsCounter,
bool IsArray, QualType ElementTy,
1132 assert(!Record->isCompleteDefinition() &&
"record is already complete");
1134 ASTContext &Ctx = SemaRef.getASTContext();
1136 assert(!ElementTy.isNull() &&
1137 "The caller should always pass in the type for the handle.");
1138 TypeSourceInfo *ElementTypeInfo =
1142 QualType AttributedResTy = QualType();
1143 SmallVector<const Attr *> Attrs = {
1144 HLSLResourceClassAttr::CreateImplicit(Ctx, RC),
1145 IsROV ? HLSLROVAttr::CreateImplicit(Ctx) :
nullptr,
1146 RawBuffer ? HLSLRawBufferAttr::CreateImplicit(Ctx) :
nullptr,
1147 RD != ResourceDimension::
Unknown
1148 ? HLSLResourceDimensionAttr::CreateImplicit(Ctx, RD)
1151 ? HLSLContainedTypeAttr::CreateImplicit(Ctx, ElementTypeInfo)
1154 Attrs.push_back(HLSLIsCounterAttr::CreateImplicit(Ctx));
1156 Attrs.push_back(HLSLIsArrayAttr::CreateImplicit(Ctx));
1168 assert(!Record->isCompleteDefinition() &&
"record is already complete");
1170 using PH = BuiltinTypeMethodBuilder::PlaceHolder;
1171 QualType HandleType = getResourceHandleField()->getType();
1174 .callBuiltin(
"__builtin_hlsl_resource_uninitializedhandle", HandleType,
1176 .assign(PH::Handle, PH::LastStmt)
1183 addCreateFromBindingWithImplicitCounter();
1184 addCreateFromImplicitBindingWithImplicitCounter();
1186 addCreateFromBinding();
1187 addCreateFromImplicitBinding();
1204 assert(!
Record->isCompleteDefinition() &&
"record is already complete");
1206 using PH = BuiltinTypeMethodBuilder::PlaceHolder;
1210 BuiltinTypeMethodBuilder::LocalVar TmpVar(
"tmp", RecordType);
1216 .addParam(
"range", AST.
IntTy)
1219 .declareLocalVar(TmpVar)
1220 .accessHandleFieldOnResource(TmpVar)
1221 .callBuiltin(
"__builtin_hlsl_resource_handlefrombinding", HandleType,
1222 PH::LastStmt, PH::_0, PH::_1, PH::_2, PH::_3, PH::_4)
1223 .setHandleFieldOnResource(TmpVar, PH::LastStmt)
1224 .returnValue(TmpVar)
1241 assert(!
Record->isCompleteDefinition() &&
"record is already complete");
1243 using PH = BuiltinTypeMethodBuilder::PlaceHolder;
1247 BuiltinTypeMethodBuilder::LocalVar TmpVar(
"tmp", RecordType);
1253 .addParam(
"range", AST.
IntTy)
1256 .declareLocalVar(TmpVar)
1257 .accessHandleFieldOnResource(TmpVar)
1258 .callBuiltin(
"__builtin_hlsl_resource_handlefromimplicitbinding",
1259 HandleType, PH::LastStmt, PH::_0, PH::_1, PH::_2, PH::_3,
1261 .setHandleFieldOnResource(TmpVar, PH::LastStmt)
1262 .returnValue(TmpVar)
1282BuiltinTypeDeclBuilder::addCreateFromBindingWithImplicitCounter() {
1283 assert(!
Record->isCompleteDefinition() &&
"record is already complete");
1285 using PH = BuiltinTypeMethodBuilder::PlaceHolder;
1287 QualType HandleType = getResourceHandleField()->
getType();
1288 QualType CounterHandleType = getResourceCounterHandleField()->
getType();
1290 BuiltinTypeMethodBuilder::LocalVar TmpVar(
"tmp", RecordType);
1293 "__createFromBindingWithImplicitCounter",
1297 .addParam(
"range", AST.
IntTy)
1301 .declareLocalVar(TmpVar)
1302 .accessHandleFieldOnResource(TmpVar)
1303 .callBuiltin(
"__builtin_hlsl_resource_handlefrombinding", HandleType,
1304 PH::LastStmt, PH::_0, PH::_1, PH::_2, PH::_3, PH::_4)
1305 .setHandleFieldOnResource(TmpVar, PH::LastStmt)
1306 .accessHandleFieldOnResource(TmpVar)
1307 .callBuiltin(
"__builtin_hlsl_resource_counterhandlefromimplicitbinding",
1308 CounterHandleType, PH::LastStmt, PH::_5, PH::_1)
1309 .setCounterHandleFieldOnResource(TmpVar, PH::LastStmt)
1310 .returnValue(TmpVar)
1331BuiltinTypeDeclBuilder::addCreateFromImplicitBindingWithImplicitCounter() {
1332 assert(!Record->isCompleteDefinition() &&
"record is already complete");
1334 using PH = BuiltinTypeMethodBuilder::PlaceHolder;
1335 ASTContext &AST = SemaRef.getASTContext();
1336 QualType HandleType = getResourceHandleField()->getType();
1337 QualType CounterHandleType = getResourceCounterHandleField()->getType();
1339 BuiltinTypeMethodBuilder::LocalVar TmpVar(
"tmp", RecordType);
1342 *
this,
"__createFromImplicitBindingWithImplicitCounter",
1346 .addParam(
"range", AST.
IntTy)
1350 .declareLocalVar(TmpVar)
1351 .accessHandleFieldOnResource(TmpVar)
1352 .callBuiltin(
"__builtin_hlsl_resource_handlefromimplicitbinding",
1353 HandleType, PH::LastStmt, PH::_0, PH::_1, PH::_2, PH::_3,
1355 .setHandleFieldOnResource(TmpVar, PH::LastStmt)
1356 .accessHandleFieldOnResource(TmpVar)
1357 .callBuiltin(
"__builtin_hlsl_resource_counterhandlefromimplicitbinding",
1358 CounterHandleType, PH::LastStmt, PH::_5, PH::_1)
1359 .setCounterHandleFieldOnResource(TmpVar, PH::LastStmt)
1360 .returnValue(TmpVar)
1366 assert(!Record->isCompleteDefinition() &&
"record is already complete");
1373 using PH = BuiltinTypeMethodBuilder::PlaceHolder;
1377 MMB.
addParam(
"other", ConstRecordRefType);
1379 for (
auto *Field : Record->fields()) {
1389 assert(!Record->isCompleteDefinition() &&
"record is already complete");
1397 using PH = BuiltinTypeMethodBuilder::PlaceHolder;
1400 MMB.
addParam(
"other", ConstRecordRefType);
1402 for (
auto *Field : Record->fields()) {
1413 assert(!Record->isCompleteDefinition() &&
"record is already complete");
1416 uint32_t VecSize = 1;
1417 if (
Dim != ResourceDimension::Unknown)
1428 getResourceAttrs().ResourceClass !=
1429 llvm::dxil::ResourceClass::UAV,
1436 assert(!Record->isCompleteDefinition() &&
"record is already complete");
1450CXXRecordDecl *BuiltinTypeDeclBuilder::addMipsSliceType(ResourceDimension
Dim,
1458 using PH = BuiltinTypeMethodBuilder::PlaceHolder;
1463 CXXRecordDecl *MipsSliceRecord = addPrivateNestedRecord(
"mips_slice_type");
1465 MipsSliceBuilder.addFriend(
Record)
1466 .addHandleMember(getResourceAttrs().ResourceClass,
Dim,
1467 getResourceAttrs().IsROV,
false,
1468 getResourceAttrs().IsArray, ReturnType,
1475 FieldDecl *LevelField = MipsSliceBuilder.Fields[
"__level"];
1476 assert(LevelField &&
"Could not find the level field.");
1484 .addParam(
"Coord", IndexTy)
1485 .accessFieldOnResource(PH::This, LevelField)
1486 .concat(PH::_0, PH::LastStmt, CoordLevelTy)
1487 .callBuiltin(
"__builtin_hlsl_resource_load_level", ReturnType, PH::Handle,
1491 MipsSliceBuilder.completeDefinition();
1492 return MipsSliceRecord;
1495CXXRecordDecl *BuiltinTypeDeclBuilder::addMipsType(ResourceDimension Dim,
1496 QualType ReturnType) {
1498 QualType IntTy = AST.
IntTy;
1499 using PH = BuiltinTypeMethodBuilder::PlaceHolder;
1502 CXXRecordDecl *MipsSliceRecord = addMipsSliceType(Dim, ReturnType);
1507 CXXRecordDecl *MipsRecord = addPrivateNestedRecord(
"mips_type");
1509 MipsBuilder.addFriend(
Record)
1511 getResourceAttrs().IsROV,
false,
1512 getResourceAttrs().IsArray, ReturnType,
1520 DeclarationName SubscriptName =
1524 auto FieldIt = MipsSliceRecord->field_begin();
1525 FieldDecl *MipsSliceHandleField = *FieldIt;
1527 assert(MipsSliceHandleField->getName() ==
"__handle" &&
1528 LevelField->getName() ==
"__level" &&
1529 "Could not find fields on mips_slice_type");
1532 BuiltinTypeMethodBuilder::LocalVar MipsSliceVar(
"slice", MipsSliceTy);
1535 .addParam(
"Level", IntTy)
1536 .declareLocalVar(MipsSliceVar)
1537 .accessHandleFieldOnResource(PH::This)
1538 .setFieldOnResource(MipsSliceVar, PH::LastStmt, MipsSliceHandleField)
1539 .setFieldOnResource(MipsSliceVar, PH::_0, LevelField)
1540 .returnValue(MipsSliceVar)
1543 MipsBuilder.completeDefinition();
1549 assert(!Record->isCompleteDefinition() &&
"record is already complete");
1551 QualType ReturnType = getHandleElementType();
1565 assert(!Record->isCompleteDefinition() &&
"record is already complete");
1568 uint32_t CoordSize = OffsetSize + (IsArray ? 2 : 1);
1572 QualType ReturnType = getHandleElementType();
1574 using PH = BuiltinTypeMethodBuilder::PlaceHolder;
1578 .addParam(
"Location", LocationTy)
1579 .callBuiltin(
"__builtin_hlsl_resource_load_level", ReturnType, PH::Handle,
1585 .addParam(
"Location", LocationTy)
1586 .addParam(
"Offset", OffsetTy)
1587 .callBuiltin(
"__builtin_hlsl_resource_load_level", ReturnType, PH::Handle,
1594 assert(!Record->isCompleteDefinition() &&
"record is already complete");
1598 auto AddLoads = [&](StringRef MethodName,
QualType ReturnType) {
1618 assert(!Record->isCompleteDefinition() &&
"record is already complete");
1622 auto AddStore = [&](StringRef MethodName,
QualType ValueType) {
1640 assert(!Record->isCompleteDefinition() &&
"record is already complete");
1642 QualType ReturnType = getHandleElementType();
1644 lookupBuiltinType(SemaRef,
"SamplerState", Record->getDeclContext());
1646 uint32_t CoordSize = OffsetSize + (IsArray ? 1 : 0);
1651 using PH = BuiltinTypeMethodBuilder::PlaceHolder;
1655 .addParam(
"Sampler", SamplerStateType)
1656 .addParam(
"Location", CoordTy)
1657 .accessHandleFieldOnResource(PH::_0)
1658 .callBuiltin(
"__builtin_hlsl_resource_sample", ReturnType, PH::Handle,
1659 PH::LastStmt, PH::_1)
1660 .returnValue(PH::LastStmt)
1665 .addParam(
"Sampler", SamplerStateType)
1666 .addParam(
"Location", CoordTy)
1667 .addParam(
"Offset", OffsetTy)
1668 .accessHandleFieldOnResource(PH::_0)
1669 .callBuiltin(
"__builtin_hlsl_resource_sample", ReturnType, PH::Handle,
1670 PH::LastStmt, PH::_1, PH::_2)
1671 .returnValue(PH::LastStmt)
1676 .addParam(
"Sampler", SamplerStateType)
1677 .addParam(
"Location", CoordTy)
1678 .addParam(
"Offset", OffsetTy)
1679 .addParam(
"Clamp", FloatTy)
1680 .accessHandleFieldOnResource(PH::_0)
1681 .callBuiltin(
"__builtin_hlsl_resource_sample", ReturnType, PH::Handle,
1682 PH::LastStmt, PH::_1, PH::_2, PH::_3)
1683 .returnValue(PH::LastStmt)
1690 assert(!Record->isCompleteDefinition() &&
"record is already complete");
1692 QualType ReturnType = getHandleElementType();
1694 lookupBuiltinType(SemaRef,
"SamplerState", Record->getDeclContext());
1696 uint32_t CoordSize = OffsetSize + (IsArray ? 1 : 0);
1701 using PH = BuiltinTypeMethodBuilder::PlaceHolder;
1705 .addParam(
"Sampler", SamplerStateType)
1706 .addParam(
"Location", CoordTy)
1707 .addParam(
"Bias", FloatTy)
1708 .accessHandleFieldOnResource(PH::_0)
1709 .callBuiltin(
"__builtin_hlsl_resource_sample_bias", ReturnType,
1710 PH::Handle, PH::LastStmt, PH::_1, PH::_2)
1711 .returnValue(PH::LastStmt)
1716 .addParam(
"Sampler", SamplerStateType)
1717 .addParam(
"Location", CoordTy)
1718 .addParam(
"Bias", FloatTy)
1719 .addParam(
"Offset", OffsetTy)
1720 .accessHandleFieldOnResource(PH::_0)
1721 .callBuiltin(
"__builtin_hlsl_resource_sample_bias", ReturnType,
1722 PH::Handle, PH::LastStmt, PH::_1, PH::_2, PH::_3)
1723 .returnValue(PH::LastStmt)
1729 .addParam(
"Sampler", SamplerStateType)
1730 .addParam(
"Location", CoordTy)
1731 .addParam(
"Bias", FloatTy)
1732 .addParam(
"Offset", OffsetTy)
1733 .addParam(
"Clamp", FloatTy)
1734 .accessHandleFieldOnResource(PH::_0)
1735 .callBuiltin(
"__builtin_hlsl_resource_sample_bias", ReturnType,
1736 PH::Handle, PH::LastStmt, PH::_1, PH::_2, PH::_3, PH::_4)
1737 .returnValue(PH::LastStmt)
1744 assert(!Record->isCompleteDefinition() &&
"record is already complete");
1746 QualType ReturnType = getHandleElementType();
1748 lookupBuiltinType(SemaRef,
"SamplerState", Record->getDeclContext());
1750 uint32_t CoordSize = OffsetSize + (IsArray ? 1 : 0);
1756 using PH = BuiltinTypeMethodBuilder::PlaceHolder;
1760 .addParam(
"Sampler", SamplerStateType)
1761 .addParam(
"Location", CoordTy)
1762 .addParam(
"DDX", OffsetFloatTy)
1763 .addParam(
"DDY", OffsetFloatTy)
1764 .accessHandleFieldOnResource(PH::_0)
1765 .callBuiltin(
"__builtin_hlsl_resource_sample_grad", ReturnType,
1766 PH::Handle, PH::LastStmt, PH::_1, PH::_2, PH::_3)
1767 .returnValue(PH::LastStmt)
1773 .addParam(
"Sampler", SamplerStateType)
1774 .addParam(
"Location", CoordTy)
1775 .addParam(
"DDX", OffsetFloatTy)
1776 .addParam(
"DDY", OffsetFloatTy)
1777 .addParam(
"Offset", OffsetTy)
1778 .accessHandleFieldOnResource(PH::_0)
1779 .callBuiltin(
"__builtin_hlsl_resource_sample_grad", ReturnType,
1780 PH::Handle, PH::LastStmt, PH::_1, PH::_2, PH::_3, PH::_4)
1781 .returnValue(PH::LastStmt)
1787 .addParam(
"Sampler", SamplerStateType)
1788 .addParam(
"Location", CoordTy)
1789 .addParam(
"DDX", OffsetFloatTy)
1790 .addParam(
"DDY", OffsetFloatTy)
1791 .addParam(
"Offset", OffsetTy)
1792 .addParam(
"Clamp", FloatTy)
1793 .accessHandleFieldOnResource(PH::_0)
1794 .callBuiltin(
"__builtin_hlsl_resource_sample_grad", ReturnType,
1795 PH::Handle, PH::LastStmt, PH::_1, PH::_2, PH::_3, PH::_4,
1797 .returnValue(PH::LastStmt)
1804 assert(!Record->isCompleteDefinition() &&
"record is already complete");
1806 QualType ReturnType = getHandleElementType();
1808 lookupBuiltinType(SemaRef,
"SamplerState", Record->getDeclContext());
1810 uint32_t CoordSize = OffsetSize + (IsArray ? 1 : 0);
1815 using PH = BuiltinTypeMethodBuilder::PlaceHolder;
1819 .addParam(
"Sampler", SamplerStateType)
1820 .addParam(
"Location", CoordTy)
1821 .addParam(
"LOD", FloatTy)
1822 .accessHandleFieldOnResource(PH::_0)
1823 .callBuiltin(
"__builtin_hlsl_resource_sample_level", ReturnType,
1824 PH::Handle, PH::LastStmt, PH::_1, PH::_2)
1825 .returnValue(PH::LastStmt)
1830 .addParam(
"Sampler", SamplerStateType)
1831 .addParam(
"Location", CoordTy)
1832 .addParam(
"LOD", FloatTy)
1833 .addParam(
"Offset", OffsetTy)
1834 .accessHandleFieldOnResource(PH::_0)
1835 .callBuiltin(
"__builtin_hlsl_resource_sample_level", ReturnType,
1836 PH::Handle, PH::LastStmt, PH::_1, PH::_2, PH::_3)
1837 .returnValue(PH::LastStmt)
1844 assert(!Record->isCompleteDefinition() &&
"record is already complete");
1847 QualType SamplerComparisonStateType = lookupBuiltinType(
1848 SemaRef,
"SamplerComparisonState", Record->getDeclContext());
1850 uint32_t CoordSize = OffsetSize + (IsArray ? 1 : 0);
1855 using PH = BuiltinTypeMethodBuilder::PlaceHolder;
1859 .addParam(
"Sampler", SamplerComparisonStateType)
1860 .addParam(
"Location", CoordTy)
1861 .addParam(
"CompareValue", FloatTy)
1862 .accessHandleFieldOnResource(PH::_0)
1863 .callBuiltin(
"__builtin_hlsl_resource_sample_cmp", ReturnType, PH::Handle,
1864 PH::LastStmt, PH::_1, PH::_2)
1865 .returnValue(PH::LastStmt)
1871 .addParam(
"Sampler", SamplerComparisonStateType)
1872 .addParam(
"Location", CoordTy)
1873 .addParam(
"CompareValue", FloatTy)
1874 .addParam(
"Offset", OffsetTy)
1875 .accessHandleFieldOnResource(PH::_0)
1876 .callBuiltin(
"__builtin_hlsl_resource_sample_cmp", ReturnType, PH::Handle,
1877 PH::LastStmt, PH::_1, PH::_2, PH::_3)
1878 .returnValue(PH::LastStmt)
1884 .addParam(
"Sampler", SamplerComparisonStateType)
1885 .addParam(
"Location", CoordTy)
1886 .addParam(
"CompareValue", FloatTy)
1887 .addParam(
"Offset", OffsetTy)
1888 .addParam(
"Clamp", FloatTy)
1889 .accessHandleFieldOnResource(PH::_0)
1890 .callBuiltin(
"__builtin_hlsl_resource_sample_cmp", ReturnType, PH::Handle,
1891 PH::LastStmt, PH::_1, PH::_2, PH::_3, PH::_4)
1892 .returnValue(PH::LastStmt)
1899 assert(!Record->isCompleteDefinition() &&
"record is already complete");
1902 QualType SamplerComparisonStateType = lookupBuiltinType(
1903 SemaRef,
"SamplerComparisonState", Record->getDeclContext());
1905 uint32_t CoordSize = OffsetSize + (IsArray ? 1 : 0);
1910 using PH = BuiltinTypeMethodBuilder::PlaceHolder;
1915 .addParam(
"Sampler", SamplerComparisonStateType)
1916 .addParam(
"Location", CoordTy)
1917 .addParam(
"CompareValue", FloatTy)
1918 .accessHandleFieldOnResource(PH::_0)
1919 .callBuiltin(
"__builtin_hlsl_resource_sample_cmp_level_zero", ReturnType,
1920 PH::Handle, PH::LastStmt, PH::_1, PH::_2)
1921 .returnValue(PH::LastStmt)
1927 .addParam(
"Sampler", SamplerComparisonStateType)
1928 .addParam(
"Location", CoordTy)
1929 .addParam(
"CompareValue", FloatTy)
1930 .addParam(
"Offset", OffsetTy)
1931 .accessHandleFieldOnResource(PH::_0)
1932 .callBuiltin(
"__builtin_hlsl_resource_sample_cmp_level_zero", ReturnType,
1933 PH::Handle, PH::LastStmt, PH::_1, PH::_2, PH::_3)
1934 .returnValue(PH::LastStmt)
1940 assert(!Record->isCompleteDefinition() &&
"record is already complete");
1941 using PH = BuiltinTypeMethodBuilder::PlaceHolder;
1945 assert(
Dim != ResourceDimension::Unknown);
1949 QualType Params[] = {UIntTy, FloatTy};
1952 if (
Dim == ResourceDimension::Dim2D) {
1953 StringRef XYName =
"__builtin_hlsl_resource_getdimensions_xy";
1954 StringRef LevelsXYName =
1955 "__builtin_hlsl_resource_getdimensions_levels_xy";
1957 if (OutTy == FloatTy) {
1958 XYName =
"__builtin_hlsl_resource_getdimensions_xy_float";
1959 LevelsXYName =
"__builtin_hlsl_resource_getdimensions_levels_xy_float";
1964 .addParam(
"width", OutTy, HLSLParamModifierAttr::Keyword_out)
1965 .addParam(
"height", OutTy, HLSLParamModifierAttr::Keyword_out)
1966 .callBuiltin(XYName,
QualType(), PH::Handle, PH::_0, PH::_1)
1972 .addParam(
"mipLevel", UIntTy)
1973 .addParam(
"width", OutTy, HLSLParamModifierAttr::Keyword_out)
1974 .addParam(
"height", OutTy, HLSLParamModifierAttr::Keyword_out)
1975 .addParam(
"numberOfLevels", OutTy, HLSLParamModifierAttr::Keyword_out)
1976 .callBuiltin(LevelsXYName,
QualType(), PH::Handle, PH::_0, PH::_1,
1987 assert(!Record->isCompleteDefinition() &&
"record is already complete");
1991 lookupBuiltinType(SemaRef,
"SamplerState", Record->getDeclContext());
1995 using PH = BuiltinTypeMethodBuilder::PlaceHolder;
1999 .addParam(
"Sampler", SamplerStateType)
2000 .addParam(
"Location", LocationTy)
2001 .accessHandleFieldOnResource(PH::_0)
2002 .callBuiltin(
"__builtin_hlsl_resource_calculate_lod", ReturnType,
2003 PH::Handle, PH::LastStmt, PH::_1)
2009 .addParam(
"Sampler", SamplerStateType)
2010 .addParam(
"Location", LocationTy)
2011 .accessHandleFieldOnResource(PH::_0)
2012 .callBuiltin(
"__builtin_hlsl_resource_calculate_lod_unclamped",
2013 ReturnType, PH::Handle, PH::LastStmt, PH::_1)
2017QualType BuiltinTypeDeclBuilder::getGatherReturnType() {
2019 QualType T = getHandleElementType();
2024 T = VT->getElementType();
2026 T = DT->getElementType();
2033 assert(!Record->isCompleteDefinition() &&
"record is already complete");
2035 QualType ReturnType = getGatherReturnType();
2038 lookupBuiltinType(SemaRef,
"SamplerState", Record->getDeclContext());
2040 uint32_t CoordSize = OffsetSize + (IsArray ? 1 : 0);
2045 using PH = BuiltinTypeMethodBuilder::PlaceHolder;
2048 struct GatherVariant {
2052 GatherVariant Variants[] = {{
"Gather", 0},
2056 {
"GatherAlpha", 3}};
2058 for (
const auto &
V : Variants) {
2061 .addParam(
"Sampler", SamplerStateType)
2062 .addParam(
"Location", CoordTy)
2063 .accessHandleFieldOnResource(PH::_0)
2064 .callBuiltin(
"__builtin_hlsl_resource_gather", ReturnType, PH::Handle,
2065 PH::LastStmt, PH::_1,
2066 getConstantUnsignedIntExpr(
V.Component))
2071 .addParam(
"Sampler", SamplerStateType)
2072 .addParam(
"Location", CoordTy)
2073 .addParam(
"Offset", OffsetTy)
2074 .accessHandleFieldOnResource(PH::_0)
2075 .callBuiltin(
"__builtin_hlsl_resource_gather", ReturnType, PH::Handle,
2076 PH::LastStmt, PH::_1,
2077 getConstantUnsignedIntExpr(
V.Component), PH::_2)
2087 assert(!Record->isCompleteDefinition() &&
"record is already complete");
2091 QualType SamplerComparisonStateType = lookupBuiltinType(
2092 SemaRef,
"SamplerComparisonState", Record->getDeclContext());
2094 uint32_t CoordSize = OffsetSize + (IsArray ? 1 : 0);
2099 using PH = BuiltinTypeMethodBuilder::PlaceHolder;
2103 struct GatherVariant {
2107 GatherVariant Variants[] = {{
"GatherCmp", 0},
2108 {
"GatherCmpRed", 0},
2109 {
"GatherCmpGreen", 1},
2110 {
"GatherCmpBlue", 2},
2111 {
"GatherCmpAlpha", 3}};
2113 for (
const auto &
V : Variants) {
2117 .addParam(
"Sampler", SamplerComparisonStateType)
2118 .addParam(
"Location", CoordTy)
2119 .addParam(
"CompareValue", FloatTy)
2120 .accessHandleFieldOnResource(PH::_0)
2121 .callBuiltin(
"__builtin_hlsl_resource_gather_cmp", ReturnType,
2122 PH::Handle, PH::LastStmt, PH::_1, PH::_2,
2123 getConstantUnsignedIntExpr(
V.Component))
2129 .addParam(
"Sampler", SamplerComparisonStateType)
2130 .addParam(
"Location", CoordTy)
2131 .addParam(
"CompareValue", FloatTy)
2132 .addParam(
"Offset", OffsetTy)
2133 .accessHandleFieldOnResource(PH::_0)
2134 .callBuiltin(
"__builtin_hlsl_resource_gather_cmp", ReturnType,
2135 PH::Handle, PH::LastStmt, PH::_1, PH::_2,
2136 getConstantUnsignedIntExpr(
V.Component), PH::_3)
2143FieldDecl *BuiltinTypeDeclBuilder::getResourceHandleField()
const {
2144 auto I = Fields.find(
"__handle");
2145 assert(I != Fields.end() &&
2146 I->second->getType()->isHLSLAttributedResourceType() &&
2147 "record does not have resource handle field");
2151FieldDecl *BuiltinTypeDeclBuilder::getResourceCounterHandleField()
const {
2152 auto I = Fields.find(
"__counter_handle");
2153 if (I == Fields.end() ||
2154 !I->second->getType()->isHLSLAttributedResourceType())
2159QualType BuiltinTypeDeclBuilder::getFirstTemplateTypeParam() {
2160 assert(
Template &&
"record it not a template");
2161 if (
const auto *TTD = dyn_cast<TemplateTypeParmDecl>(
2162 Template->getTemplateParameters()->getParam(0))) {
2163 return QualType(TTD->getTypeForDecl(), 0);
2168QualType BuiltinTypeDeclBuilder::getHandleElementType() {
2170 return getFirstTemplateTypeParam();
2172 if (
auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(Record)) {
2173 const auto &Args = Spec->getTemplateArgs();
2175 return Args[0].getAsType();
2179 return SemaRef.getASTContext().Char8Ty;
2182HLSLAttributedResourceType::Attributes
2183BuiltinTypeDeclBuilder::getResourceAttrs()
const {
2184 QualType HandleType = getResourceHandleField()->getType();
2189 assert(!Record->isCompleteDefinition() &&
"record is already complete");
2190 assert(Record->isBeingDefined() &&
2191 "Definition must be started before completing it.");
2193 Record->completeDefinition();
2194 Record->setIsHLSLBuiltinRecord(
true);
2198Expr *BuiltinTypeDeclBuilder::getConstantIntExpr(
int value) {
2205Expr *BuiltinTypeDeclBuilder::getConstantUnsignedIntExpr(
unsigned value) {
2222 if (Record->isCompleteDefinition()) {
2223 assert(Template &&
"existing record it not a template");
2224 assert(Template->getTemplateParameters()->size() == Names.size() &&
2225 "template param count mismatch");
2229 assert((DefaultTypes.empty() || DefaultTypes.size() == Names.size()) &&
2230 "template default argument count mismatch");
2233 for (
unsigned i = 0; i < Names.size(); ++i) {
2235 Builder.addTypeParameter(Names[i], DefaultTy);
2237 return Builder.finalizeTemplateArgs(CD);
2241 using PH = BuiltinTypeMethodBuilder::PlaceHolder;
2242 QualType UnsignedIntTy = SemaRef.getASTContext().UnsignedIntTy;
2244 .callBuiltin(
"__builtin_hlsl_buffer_update_counter", UnsignedIntTy,
2245 PH::CounterHandle, getConstantIntExpr(1))
2250 using PH = BuiltinTypeMethodBuilder::PlaceHolder;
2251 QualType UnsignedIntTy = SemaRef.getASTContext().UnsignedIntTy;
2253 .callBuiltin(
"__builtin_hlsl_buffer_update_counter", UnsignedIntTy,
2254 PH::CounterHandle, getConstantIntExpr(-1))
2261 assert(!Record->isCompleteDefinition() &&
"record is already complete");
2263 using PH = BuiltinTypeMethodBuilder::PlaceHolder;
2264 bool NeedsTypedBuiltin = !ReturnTy.
isNull();
2270 if (!NeedsTypedBuiltin)
2271 ReturnTy = getHandleElementType();
2274 MMB.ReturnTy = ReturnTy;
2278 HLSLParamModifierAttr::Keyword_out);
2280 if (NeedsTypedBuiltin)
2281 MMB.
callBuiltin(
"__builtin_hlsl_resource_load_with_status_typed", ReturnTy,
2282 PH::Handle, PH::_0, PH::_1, ReturnTy);
2284 MMB.
callBuiltin(
"__builtin_hlsl_resource_load_with_status", ReturnTy,
2285 PH::Handle, PH::_0, PH::_1);
2293 assert(!Record->isCompleteDefinition() &&
"record is already complete");
2295 using PH = BuiltinTypeMethodBuilder::PlaceHolder;
2296 bool NeedsTypedBuiltin = !ElemTy.
isNull();
2302 if (!NeedsTypedBuiltin)
2303 ElemTy = getHandleElementType();
2312 ReturnTy = AddrSpaceElemTy;
2317 assert(!IsConstReturn &&
"There shouldn't be any resource methods with a "
2318 "const ref return value");
2321 MMB.ReturnTy = ReturnTy;
2325 if (NeedsTypedBuiltin)
2326 MMB.
callBuiltin(
"__builtin_hlsl_resource_getpointer_typed", ElemPtrTy,
2327 PH::Handle, PH::_0, ElemTy);
2329 MMB.
callBuiltin(
"__builtin_hlsl_resource_getpointer", ElemPtrTy, PH::Handle,
2338 assert(!Record->isCompleteDefinition() &&
"record is already complete");
2340 using PH = BuiltinTypeMethodBuilder::PlaceHolder;
2352 .
callBuiltin(
"__builtin_hlsl_resource_getpointer_typed", ElemPtrTy,
2353 PH::Handle, PH::_0, ValueTy)
2355 .
assign(PH::LastStmt, PH::_1)
2360 using PH = BuiltinTypeMethodBuilder::PlaceHolder;
2362 QualType ElemTy = getHandleElementType();
2366 .addParam(
"value", ElemTy)
2367 .callBuiltin(
"__builtin_hlsl_buffer_update_counter", AST.
UnsignedIntTy,
2368 PH::CounterHandle, getConstantIntExpr(1))
2369 .callBuiltin(
"__builtin_hlsl_resource_getpointer",
2372 .dereference(PH::LastStmt)
2373 .assign(PH::LastStmt, PH::_0)
2378 using PH = BuiltinTypeMethodBuilder::PlaceHolder;
2380 QualType ElemTy = getHandleElementType();
2384 .callBuiltin(
"__builtin_hlsl_buffer_update_counter", AST.
UnsignedIntTy,
2385 PH::CounterHandle, getConstantIntExpr(-1))
2386 .callBuiltin(
"__builtin_hlsl_resource_getpointer",
2389 .dereference(PH::LastStmt)
2395 using PH = BuiltinTypeMethodBuilder::PlaceHolder;
2399 QualType HandleTy = getResourceHandleField()->getType();
2404 if (AttrResTy->getAttrs().RawBuffer &&
2405 AttrResTy->getContainedType() != AST.
Char8Ty) {
2407 .addParam(
"numStructs", UIntTy, HLSLParamModifierAttr::Keyword_out)
2408 .addParam(
"stride", UIntTy, HLSLParamModifierAttr::Keyword_out)
2409 .callBuiltin(
"__builtin_hlsl_resource_getdimensions_x",
QualType(),
2411 .callBuiltin(
"__builtin_hlsl_resource_getstride",
QualType(),
2419 .addParam(
"dim", UIntTy, HLSLParamModifierAttr::Keyword_out)
2420 .callBuiltin(
"__builtin_hlsl_resource_getdimensions_x",
QualType(),
Defines the clang::ASTContext interface.
llvm::dxil::ResourceClass ResourceClass
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the C++ template declaration subclasses.
llvm::MachO::Record Record
This file declares semantic analysis for HLSL constructs.
Defines the clang::SourceLocation class and associated facilities.
Defines various enumerations that describe declaration and type specifiers.
C Language Family Type Representation.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
DeclarationNameTable DeclarationNames
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.
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location,...
QualType getTypeDeclType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier Qualifier, const TypeDecl *Decl) const
CanQualType UnsignedIntTy
CanQualType getCanonicalTagType(const TagDecl *TD) const
Represents a member of a struct/union/class.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
static CanQualType getCanonicalType(QualType T)
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
DeclarationNameTable DeclarationNames
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.
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location,...
QualType getTypeDeclType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier Qualifier, const TypeDecl *Decl) const
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 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 ...
CanQualType getCanonicalTagType(const TagDecl *TD) const
static bool hasSameUnqualifiedType(QualType T1, QualType T2)
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Attr - This represents one attribute.
static BinaryOperator * Create(const ASTContext &C, Expr *lhs, Expr *rhs, Opcode opc, QualType ResTy, ExprValueKind VK, ExprObjectKind OK, SourceLocation opLoc, FPOptionsOverride FPFeatures)
static CXXConstructExpr * Create(const ASTContext &Ctx, QualType Ty, SourceLocation Loc, CXXConstructorDecl *Ctor, bool Elidable, ArrayRef< Expr * > Args, bool HadMultipleCandidates, bool ListInitialization, bool StdInitListInitialization, bool ZeroInitialization, CXXConstructionKind ConstructKind, SourceRange ParenOrBraceRange)
Create a C++ construction expression.
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(), const AssociatedConstraint &TrailingRequiresClause={})
static CXXConversionDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool UsesFPIntrin, bool isInline, ExplicitSpecifier ES, ConstexprSpecKind ConstexprKind, SourceLocation EndLocation, const AssociatedConstraint &TrailingRequiresClause={})
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, const AssociatedConstraint &TrailingRequiresClause={})
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)
Represents the this expression in C++.
static CXXThisExpr * Create(const ASTContext &Ctx, SourceLocation L, QualType Ty, bool IsImplicit)
QualType withConst() const
Retrieves a version of this type with const applied.
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.
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, TemplateDecl *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...
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)
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
Decl - This represents one declaration (or definition), e.g.
void setAccess(AccessSpecifier AS)
void setImplicit(bool I=true)
void setLexicalDeclContext(DeclContext *DC)
The name of a declaration.
@ CXXConversionFunctionName
NameKind getNameKind() const
Determine what kind of name this is.
Represents an extended vector type where either the type or size is dependent.
This represents one expression.
Represents difference between two FPOptions values.
Represents a member of a struct/union/class.
const RecordDecl * getParent() const
Returns the parent of this field declaration, which is the struct in which this field is defined.
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)
FriendDecl - Represents the declaration of a friend entity, which can be a function,...
static FriendDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, FriendUnion Friend_, SourceLocation FriendL, SourceLocation EllipsisLoc={})
Represents a function declaration or definition.
DeclarationNameInfo getNameInfo() const
static FunctionTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
Create a function template node.
Interesting information about a specific parameter that can't simply be reflected in parameter's type...
ExtParameterInfo withABI(ParameterABI kind) const
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 ImplicitCastExpr * Create(const ASTContext &Context, QualType T, CastKind Kind, Expr *Operand, const CXXCastPath *BasePath, ExprValueKind Cat, FPOptionsOverride FPO)
static ImplicitConceptSpecializationDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation SL, ArrayRef< TemplateArgument > ConvertedArgs)
Describes an C or C++ initializer list.
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.
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
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.
A C++ nested-name-specifier augmented with source location information.
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.
QualType withConst() const
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.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
static ReturnStmt * Create(const ASTContext &Ctx, SourceLocation RL, Expr *E, const VarDecl *NRVOCandidate)
Create a return statement.
unsigned getDepth() const
Returns the depth of this scope. The translation-unit has scope depth 0.
Sema - This implements semantic analysis and AST building for C.
Scope * getCurScope() const
Retrieve the parser's current scope.
@ LookupOrdinaryName
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....
@ LookupTagName
Tag name lookup, which finds the names of enums, classes, structs, and unions.
ASTContext & getASTContext() const
TemplateArgumentLoc getTrivialTemplateArgumentLoc(const TemplateArgument &Arg, QualType NTTPType, SourceLocation Loc)
Allocate a TemplateArgumentLoc where all locations have been initialized to the given location.
Encodes a location in the source.
A trivial tuple used to represent a source range.
Stmt - This represents one statement.
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.
@ Type
The template argument is a type.
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, int D, int P, IdentifierInfo *Id, bool Typename, bool ParameterPack, bool HasTypeConstraint=false, UnsignedOrNone NumExpanded=std::nullopt)
A container of type source information.
The base class of the type hierarchy.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
const T * castAs() const
Member-template castAs<specific type>.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isVectorType() const
bool isRecordType() const
static UnaryOperator * Create(const ASTContext &C, Expr *input, Opcode opc, QualType type, ExprValueKind VK, ExprObjectKind OK, SourceLocation l, bool CanOverflow, FPOptionsOverride FPFeatures)
Represents a variable declaration or definition.
static VarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S)
Represents a GCC generic vector type.
BuiltinTypeDeclBuilder & addStoreFunction(DeclarationName &Name, bool IsConst, QualType ValueType)
friend struct BuiltinTypeMethodBuilder
BuiltinTypeDeclBuilder & addDefaultHandleConstructor(AccessSpecifier Access=AccessSpecifier::AS_public)
BuiltinTypeDeclBuilder(Sema &SemaRef, CXXRecordDecl *R)
BuiltinTypeDeclBuilder & addMemberVariable(StringRef Name, QualType Type, llvm::ArrayRef< Attr * > Attrs, AccessSpecifier Access=AccessSpecifier::AS_private)
BuiltinTypeDeclBuilder & addHandleAccessFunction(DeclarationName &Name, bool IsConstReturn, bool IsRef, QualType IndexTy, QualType ElemTy=QualType())
BuiltinTypeDeclBuilder & addConsumeMethod()
BuiltinTypeDeclBuilder & addSampleGradMethods(ResourceDimension Dim, bool IsArray=false)
BuiltinTypeDeclBuilder & addCopyAssignmentOperator(AccessSpecifier Access=AccessSpecifier::AS_public)
~BuiltinTypeDeclBuilder()
BuiltinTypeDeclBuilder & addGatherCmpMethods(ResourceDimension Dim, bool IsArray=false)
friend struct TemplateParameterListBuilder
BuiltinTypeDeclBuilder & addGetDimensionsMethodForBuffer()
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 & addTextureHandle(ResourceClass RC, bool IsROV, bool IsArray, ResourceDimension RD, AccessSpecifier Access=AccessSpecifier::AS_private)
BuiltinTypeDeclBuilder & addLoadWithStatusFunction(DeclarationName &Name, QualType ReturnTy=QualType())
BuiltinTypeDeclBuilder & addIncrementCounterMethod()
BuiltinTypeDeclBuilder & addSampleCmpMethods(ResourceDimension Dim, bool IsArray=false)
BuiltinTypeDeclBuilder & addMipsMember(ResourceDimension Dim)
BuiltinTypeDeclBuilder & addByteAddressBufferLoadMethods()
BuiltinTypeDeclBuilder & addStaticInitializationFunctions(bool HasCounter)
BuiltinTypeDeclBuilder & addGatherMethods(ResourceDimension Dim, bool IsArray=false)
BuiltinTypeDeclBuilder & addCalculateLodMethods(ResourceDimension Dim)
BuiltinTypeDeclBuilder & addGetDimensionsMethods(ResourceDimension Dim)
BuiltinTypeDeclBuilder & addSimpleTemplateParams(ArrayRef< StringRef > Names, ConceptDecl *CD=nullptr)
BuiltinTypeDeclBuilder & addDecrementCounterMethod()
BuiltinTypeDeclBuilder & addLoadMethods()
BuiltinTypeDeclBuilder & addSampleCmpLevelZeroMethods(ResourceDimension Dim, bool IsArray=false)
uint32_t getResourceDimensions(llvm::dxil::ResourceDimension Dim)
The JSON file list parser is used to communicate input to InstallAPI.
bool isa(CodeGen::Address addr)
if(T->getSizeExpr()) TRY_TO(TraverseStmt(const_cast< Expr * >(T -> getSizeExpr())))
@ ICIS_NoInit
No in-class initializer.
@ OK_Ordinary
An ordinary object is located at an address in memory.
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
nullptr
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
StorageClass
Storage classes.
MutableArrayRef< Expr * > MultiExprArg
@ Result
The result type of a method or function.
ParameterABI
Kinds of parameter ABI.
@ Template
We are parsing a template declaration.
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_XValue
An x-value expression is a reference to an object with independent storage but which can be "moved",...
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
U cast(CodeGen::Address addr)
ActionResult< Expr * > ExprResult
@ Other
Other implicit parameter.
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...
BuiltinTypeMethodBuilder & concat(V Vec, S Scalar, QualType ResultTy)
BuiltinTypeMethodBuilder & addParam(StringRef Name, QualType Ty, HLSLParamModifierAttr::Spelling Modifier=HLSLParamModifierAttr::Keyword_in)
BuiltinTypeMethodBuilder & accessFieldOnResource(T ResourceRecord, FieldDecl *Field)
Expr * getResourceHandleExpr()
BuiltinTypeDeclBuilder & finalize(AccessSpecifier Access=AccessSpecifier::AS_public)
BuiltinTypeMethodBuilder & callBuiltin(StringRef BuiltinName, QualType ReturnType, Ts &&...ArgSpecs)
BuiltinTypeMethodBuilder & accessHandleFieldOnResource(T ResourceRecord)
Expr * getResourceCounterHandleExpr()
BuiltinTypeMethodBuilder & setHandleFieldOnResource(LocalVar &ResourceRecord, ValueT HandleValue)
BuiltinTypeMethodBuilder & operator=(const BuiltinTypeMethodBuilder &Other)=delete
BuiltinTypeMethodBuilder & returnThis()
BuiltinTypeMethodBuilder & dereference(T Ptr)
~BuiltinTypeMethodBuilder()
BuiltinTypeMethodBuilder & declareLocalVar(LocalVar &Var)
BuiltinTypeMethodBuilder & assign(TLHS LHS, TRHS RHS)
BuiltinTypeMethodBuilder(const BuiltinTypeMethodBuilder &Other)=delete
BuiltinTypeMethodBuilder & accessCounterHandleFieldOnResource(T ResourceRecord)
BuiltinTypeMethodBuilder & setFieldOnResource(ResourceT ResourceRecord, ValueT HandleValue, FieldDecl *HandleField)
BuiltinTypeMethodBuilder & setCounterHandleFieldOnResource(ResourceT ResourceRecord, ValueT HandleValue)
friend BuiltinTypeDeclBuilder
BuiltinTypeMethodBuilder & returnValue(T ReturnValue)
QualType addTemplateTypeParam(StringRef Name)
BuiltinTypeMethodBuilder(BuiltinTypeDeclBuilder &DB, DeclarationName &Name, QualType ReturnTy, bool IsConst=false, bool IsCtor=false, StorageClass SC=SC_None)
void setMipsHandleField(LocalVar &ResourceRecord)
TemplateParameterListBuilder & addTypeParameter(StringRef Name, QualType DefaultValue=QualType())
BuiltinTypeDeclBuilder & finalizeTemplateArgs(ConceptDecl *CD=nullptr)
llvm::SmallVector< NamedDecl * > Params
~TemplateParameterListBuilder()
TemplateParameterListBuilder(BuiltinTypeDeclBuilder &RB)
ConceptSpecializationExpr * constructConceptSpecializationExpr(Sema &S, ConceptDecl *CD)
BuiltinTypeDeclBuilder & Builder