https://github.com/localspook created https://github.com/llvm/llvm-project/pull/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` ([godbolt](https://godbolt.org/z/rcb77h6ef)). (I felt a revert was unnecessary in this case. Maybe others disagree?) >From b76f3cce1348e995e0e1f2d704fbedbb4534c224 Mon Sep 17 00:00:00 2001 From: Victor Chernyakin <[email protected]> Date: Tue, 2 Sep 2025 21:33:38 -0700 Subject: [PATCH] [clang-tidy] Fix `readability-uppercase-literal-suffix` warning with hex literals --- .../readability/UppercaseLiteralSuffixCheck.cpp | 2 +- .../checkers/cert/uppercase-literal-suffix-integer.cpp | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/clang-tools-extra/clang-tidy/readability/UppercaseLiteralSuffixCheck.cpp b/clang-tools-extra/clang-tidy/readability/UppercaseLiteralSuffixCheck.cpp index 4ec2a63ab33fc..e66e1c52b5979 100644 --- a/clang-tools-extra/clang-tidy/readability/UppercaseLiteralSuffixCheck.cpp +++ b/clang-tools-extra/clang-tidy/readability/UppercaseLiteralSuffixCheck.cpp @@ -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 { diff --git a/clang-tools-extra/test/clang-tidy/checkers/cert/uppercase-literal-suffix-integer.cpp b/clang-tools-extra/test/clang-tidy/checkers/cert/uppercase-literal-suffix-integer.cpp index e7c0dd679871b..6d6d83d6cac49 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/cert/uppercase-literal-suffix-integer.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/cert/uppercase-literal-suffix-integer.cpp @@ -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; +} _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
