[clang] [clang] Check upperbound for attribute param index (PR #180424)
Thibault Monnier via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 9 02:51:41 PST 2026
Marius =?utf-8?q?D=C3=B6rner?= <marius.doerner1 at icloud.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/180424 at github.com>
================
@@ -5186,8 +5186,9 @@ class Sema final : public SemaBase {
return false;
}
- unsigned IdxSource = IdxInt->getLimitedValue(UINT_MAX);
- if (IdxSource < 1 ||
+ constexpr unsigned Limit = 1 << ParamIdx::IdxBitWidth;
+ unsigned IdxSource = IdxInt->getLimitedValue(Limit);
+ if (IdxSource < 1 || IdxSource == Limit ||
----------------
Thibault-Monnier wrote:
Wouldn't it be simpler to directly check if `IdxSource >= Limit`?
https://github.com/llvm/llvm-project/pull/180424
More information about the cfe-commits
mailing list