================ @@ -437,7 +453,409 @@ void SemaHLSL::handleShaderAttr(Decl *D, const ParsedAttr &AL) { D->addAttr(NewAttr); } +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; +}; + +bool isDeclaredWithinCOrTBuffer(const Decl *decl) { + if (!decl) + return false; + + // Traverse up the parent contexts + const DeclContext *context = decl->getDeclContext(); + while (context) { + if (isa<HLSLBufferDecl>(context)) { + return true; + } + context = context->getParent(); + } + + return false; +} + +const CXXRecordDecl *getRecordDeclFromVarDecl(VarDecl *VD) { + const Type *Ty = VD->getType()->getPointeeOrArrayElementType(); + if (!Ty) + llvm_unreachable("Resource class must have an element type."); + + if (const BuiltinType *BTy = dyn_cast<BuiltinType>(Ty)) { + return nullptr; + } ---------------- llvm-beanz wrote:
nit: Avoid braces on simple single-line expressions (see: https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements). nit: Use auto for cases where the type is obvious (see: https://llvm.org/docs/CodingStandards.html#use-auto-type-deduction-to-make-code-more-readable). ```suggestion if (const auto *BTy = dyn_cast<BuiltinType>(Ty)) return nullptr; ``` 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