================ @@ -459,7 +468,413 @@ 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; +} + +static CXXRecordDecl *getRecordDeclFromVarDecl(VarDecl *VD) { ---------------- damyanp wrote:
Just looking at this function, I can't figure out what it is meant to do. The name is `getRecordDeclFromVarDecl`, but it has a bunch of asserts in it talking about resource classes and resource type declarations. It seems to be something more resource-specific that just generally finding a record decl? Or are the assert messages more specific than they should be? This could be resolved by thinking about the name of the function, or perhaps writing a comment above it trying to explain what it does. 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