[clang-tidy] Fix readability-uppercase-literal-suffix warning with hex literals (#156584)

This is a regression I introduced in #148275 and was [noticed
by](https://github.com/llvm/llvm-project/pull/148275#issuecomment-3246670841)
nettle. The check incorrectly fires on hex literals containing the
letter `b`.

(I felt a revert was unnecessary in this case. Maybe others disagree?)
This commit is contained in:
Victor Chernyakin
2025-09-03 08:00:48 -07:00
committed by GitHub
parent 9d7449a82b
commit 53fce759fb
2 changed files with 10 additions and 1 deletions

View File

@@ -29,7 +29,7 @@ struct IntegerLiteralCheck {
// integer (wb), and can be a complex number ('i', 'j'). In MS compatibility
// mode, suffixes like i32 are supported.
static constexpr llvm::StringLiteral Suffixes =
llvm::StringLiteral("uUlLzZwWbBiIjJ");
llvm::StringLiteral("uUlLzZwWiIjJ");
};
struct FloatingLiteralCheck {

View File

@@ -128,3 +128,12 @@ void integer_suffix() {
static_assert(is_same<decltype(v24), const unsigned long long>::value, "");
static_assert(v24 == 1, "");
}
void no_warning_on_hex_literals() {
int a = 0xa;
int b = 0xb;
int c = 0xc;
int d = 0xd;
int e = 0xe;
int f = 0xf;
}