Skip to content

Commit 53fce75

Browse files
authored
[clang-tidy] Fix readability-uppercase-literal-suffix warning with hex literals (#156584)
This is a regression I introduced in #148275 and was [noticed by](#148275 (comment)) nettle. The check incorrectly fires on hex literals containing the letter `b`. (I felt a revert was unnecessary in this case. Maybe others disagree?)
1 parent 9d7449a commit 53fce75

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

clang-tools-extra/clang-tidy/readability/UppercaseLiteralSuffixCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ struct IntegerLiteralCheck {
2929
// integer (wb), and can be a complex number ('i', 'j'). In MS compatibility
3030
// mode, suffixes like i32 are supported.
3131
static constexpr llvm::StringLiteral Suffixes =
32-
llvm::StringLiteral("uUlLzZwWbBiIjJ");
32+
llvm::StringLiteral("uUlLzZwWiIjJ");
3333
};
3434

3535
struct FloatingLiteralCheck {

clang-tools-extra/test/clang-tidy/checkers/cert/uppercase-literal-suffix-integer.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,12 @@ void integer_suffix() {
128128
static_assert(is_same<decltype(v24), const unsigned long long>::value, "");
129129
static_assert(v24 == 1, "");
130130
}
131+
132+
void no_warning_on_hex_literals() {
133+
int a = 0xa;
134+
int b = 0xb;
135+
int c = 0xc;
136+
int d = 0xd;
137+
int e = 0xe;
138+
int f = 0xf;
139+
}

0 commit comments

Comments
 (0)