[clang] Implement resource binding type prefix mismatch errors (PR #87578)

Justin Bogner via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 22 11:50:34 PDT 2024


================
@@ -7334,6 +7334,81 @@ static void handleHLSLShaderAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
     D->addAttr(NewAttr);
 }
 
+static void DiagnoseHLSLResourceRegType(Sema &S, SourceLocation &ArgLoc,
+                                        Decl *D, StringRef &Slot) {
+  // Samplers, UAVs, and SRVs are VarDecl types
+  VarDecl *SamplerUAVOrSRV = dyn_cast<VarDecl>(D);
+  // Cbuffers and Tbuffers are HLSLBufferDecl types
+  HLSLBufferDecl *CBufferOrTBuffer = dyn_cast<HLSLBufferDecl>(D);
+  if (!SamplerUAVOrSRV && !CBufferOrTBuffer)
+    return;
+
+  llvm::hlsl::ResourceClass DeclResourceClass;
+  StringRef varTy = "";
----------------
bogner wrote:

LLVM style prefers `VarTy`

https://github.com/llvm/llvm-project/pull/87578


More information about the cfe-commits mailing list