[clang] [HLSL] Remove variables that are used only in assert (PR #107299)
Damyan Pepper via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 4 13:03:03 PDT 2024
================
@@ -834,17 +834,10 @@ static void ValidateMultipleRegisterAnnotations(Sema &S, Decl *TheDecl,
static void DiagnoseHLSLRegisterAttribute(Sema &S, SourceLocation &ArgLoc,
Decl *TheDecl, RegisterType regType) {
- // 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)) &&
+ assert(((isa<VarDecl>(TheDecl) && !isa<HLSLBufferDecl>(TheDecl)) ||
+ (!isa<VarDecl>(TheDecl) && isa<HLSLBufferDecl>(TheDecl))) &&
"either TheVarDecl or CBufferOrTBuffer should be set");
----------------
damyanp wrote:
The text that goes with this assert doesn't really make sense any more.
https://github.com/llvm/llvm-project/pull/107299
More information about the cfe-commits
mailing list