[clang] [llvm] [SemaHLSL] Correct descriptor range overflow validation (PR #159475)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 19 20:35:07 PDT 2025
================
@@ -1377,32 +1378,28 @@ bool SemaHLSL::handleRootSignatureElements(
if (Clause->NumDescriptors == 0)
return true;
- if (Clause->Offset !=
- llvm::hlsl::rootsig::DescriptorTableOffsetAppend) {
- // Manually specified the offset
+ bool IsAppending =
+ Clause->Offset == llvm::hlsl::rootsig::DescriptorTableOffsetAppend;
+ if (!IsAppending)
Offset = Clause->Offset;
----------------
joaosaffran wrote:
It seems like, if you check if the offset is overflowing before updating it you might be able to simplify this like:
```cpp
if (!verifyNoOverflowedOffset(Offset))
Diag(Loc, diag::err_hlsl_appending_onto_unbound);
if(Clause->Offset != llvm::hlsl::rootsig::DescriptorTableOffsetAppend)
Offset = Clause->Offset;
```
And wouldn't need to keep track of `Unbound`
https://github.com/llvm/llvm-project/pull/159475
More information about the llvm-commits
mailing list