================ @@ -459,7 +467,412 @@ void SemaHLSL::handleResourceClassAttr(Decl *D, const ParsedAttr &AL) { D->addAttr(HLSLResourceClassAttr::Create(getASTContext(), RC, ArgLoc)); } -void SemaHLSL::handleResourceBindingAttr(Decl *D, const ParsedAttr &AL) { +struct RegisterBindingFlags { + bool Resource = false; + bool UDT = false; + bool Other = false; + bool Basic = false; + + bool SRV = false; + bool UAV = false; + bool CBV = false; + bool Sampler = false; + + bool ContainsNumeric = false; + bool DefaultGlobals = false; +}; + +static bool isDeclaredWithinCOrTBuffer(const Decl *TheDecl) { + if (!TheDecl) + return false; + + // Traverse up the parent contexts + const DeclContext *context = TheDecl->getDeclContext(); + if (isa<HLSLBufferDecl>(context)) { + return true; + } + + return false; +} + +// get the record decl from a var decl that we expect +// represents a resource +static CXXRecordDecl *getRecordDeclFromVarDecl(VarDecl *VD) { + const Type *Ty = VD->getType()->getPointeeOrArrayElementType(); + assert(Ty && "Resource must have an element type."); + + if (const auto *TheBuiltinTy = dyn_cast<BuiltinType>(Ty)) ---------------- hekota wrote:
You can use the helper function `isBuiltinType()` if you don't need the actual pointer: ```suggestion if (Ty->isBuiltinType()) ``` https://github.com/llvm/llvm-project/pull/97103 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits