[clang] Implement resource binding type prefix mismatch diagnostic infrastructure (PR #97103)
Helena Kotas via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 22 14:12:35 PDT 2024
================
@@ -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;
----------------
hekota wrote:
```suggestion
return TheDecl && isa<HLSLBufferDecl>(TheDecl->getDeclContext());
```
https://github.com/llvm/llvm-project/pull/97103
More information about the cfe-commits
mailing list