[clang] Implement resource binding type prefix mismatch diagnostic infrastructure (PR #97103)
Joshua Batista via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 9 13:52:42 PDT 2024
================
@@ -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.");
----------------
bob80905 wrote:
Agreed, fixed.
https://github.com/llvm/llvm-project/pull/97103
More information about the cfe-commits
mailing list