[clang] [HLSL] Adjust resource binding diagnostic flags code (PR #106657)
Kazu Hirata via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 3 14:43:47 PDT 2024
kazutakahirata wrote:
I've fixed the warnings from this PR with b2dabd2b06cb0ca5ea534bafe33c5cff5521be18.
Now, I'm not familiar with the code here, but is it still important to do the consistency check on these two variables if you don't use them in `DiagnoseHLSLRegisterAttribute` at all other than in the `assert`? If not, you might want to just remove the block of code. Thanks!
```
// Samplers, UAVs, and SRVs are VarDecl types
VarDecl *TheVarDecl = dyn_cast<VarDecl>(TheDecl);
// Cbuffers and Tbuffers are HLSLBufferDecl types
HLSLBufferDecl *CBufferOrTBuffer = dyn_cast<HLSLBufferDecl>(TheDecl);
// exactly one of these two types should be set
assert(((TheVarDecl && !CBufferOrTBuffer) ||
(!TheVarDecl && CBufferOrTBuffer)) &&
"either TheVarDecl or CBufferOrTBuffer should be set");
(void)TheVarDecl;
(void)CBufferOrTBuffer;```
https://github.com/llvm/llvm-project/pull/106657
More information about the cfe-commits
mailing list