[clang] [HLSL] Add a warning for implicit bindings (PR #135909)
Justin Bogner via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 16 11:23:24 PDT 2025
================
@@ -3278,6 +3284,9 @@ void SemaHLSL::processExplicitBindingsOnDecl(VarDecl *VD) {
<< static_cast<int>(RT);
}
}
+
+ if (!HasBinding && VD->getType()->isHLSLResourceRecord())
+ SemaRef.Diag(VD->getLocation(), diag::warn_hlsl_implicit_binding);
----------------
bogner wrote:
`ActOnFinishBuffer` executes when finishing a `cbuffer {...}` or `tbuffer {...}` block. The word "buffer" in that function name specifically refers to those blocks, not the various resource types that happen to be buffers. So the logic here is needed for the warnings on things like `RWBuffer<T> x;`
https://github.com/llvm/llvm-project/pull/135909
More information about the cfe-commits
mailing list