llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-hlsl Author: Helena Kotas (hekota) <details> <summary>Changes</summary> Changes the assert to test the same condition without using the variables. This change is done in response to a comment [here](https://github.com/llvm/llvm-project/pull/106657#issuecomment-2327493439). --- Full diff: https://github.com/llvm/llvm-project/pull/107299.diff 1 Files Affected: - (modified) clang/lib/Sema/SemaHLSL.cpp (+2-9) ``````````diff diff --git a/clang/lib/Sema/SemaHLSL.cpp b/clang/lib/Sema/SemaHLSL.cpp index 778d524a005482..aa41a7c809880b 100644 --- a/clang/lib/Sema/SemaHLSL.cpp +++ b/clang/lib/Sema/SemaHLSL.cpp @@ -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"); - (void)TheVarDecl; - (void)CBufferOrTBuffer; RegisterBindingFlags Flags = HLSLFillRegisterBindingFlags(S, TheDecl); assert((int)Flags.Other + (int)Flags.Resource + (int)Flags.Basic + `````````` </details> https://github.com/llvm/llvm-project/pull/107299 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits