Skip to content

Commit 5ff2197

Browse files
committed
[clang][NFC] Update code style conventions
1 parent 30ed47b commit 5ff2197

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,9 @@ Improvements to Clang's diagnostics
156156
- The ``-Wshorten-64-to-32`` diagnostic is now grouped under ``-Wimplicit-int-conversion`` instead
157157
of ``-Wconversion``. Fixes `#69444 <https://github.com/llvm/llvm-project/issues/69444>`_.
158158

159+
- Clang now uses thousand separators when printing large numbers in integer overflow diagnostics.
160+
Fixes `#80939 <https://github.com/llvm/llvm-project/issues/80939>`_.
161+
159162
Improvements to Clang's time-trace
160163
----------------------------------
161164

llvm/include/llvm/ADT/APInt.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1627,7 +1627,7 @@ class [[nodiscard]] APInt {
16271627
/// digits.
16281628
void toString(SmallVectorImpl<char> &Str, unsigned Radix, bool Signed,
16291629
bool formatAsCLiteral = false, bool UpperCase = true,
1630-
bool insertSeparators = false) const;
1630+
bool InsertSeparators = false) const;
16311631

16321632
/// Considers the APInt to be unsigned and converts it into a string in the
16331633
/// radix given. The radix can be 2, 8, 10 16, or 36.

llvm/include/llvm/ADT/StringExtras.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,9 +330,9 @@ inline std::string itostr(int64_t X) {
330330

331331
inline std::string toString(const APInt &I, unsigned Radix, bool Signed,
332332
bool formatAsCLiteral = false,
333-
bool upperCase = true, bool addSeparators = false) {
333+
bool UpperCase = true, bool InsertSeparators = false) {
334334
SmallString<40> S;
335-
I.toString(S, Radix, Signed, formatAsCLiteral, upperCase, addSeparators);
335+
I.toString(S, Radix, Signed, formatAsCLiteral, UpperCase, InsertSeparators);
336336
return std::string(S);
337337
}
338338

llvm/lib/Support/APInt.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2162,7 +2162,7 @@ void APInt::fromString(unsigned numbits, StringRef str, uint8_t radix) {
21622162

21632163
void APInt::toString(SmallVectorImpl<char> &Str, unsigned Radix, bool Signed,
21642164
bool formatAsCLiteral, bool UpperCase,
2165-
bool insertSeparators) const {
2165+
bool InsertSeparators) const {
21662166
assert((Radix == 10 || Radix == 8 || Radix == 16 || Radix == 2 ||
21672167
Radix == 36) &&
21682168
"Radix should be 2, 8, 10, 16, or 36!");
@@ -2229,9 +2229,8 @@ void APInt::toString(SmallVectorImpl<char> &Str, unsigned Radix, bool Signed,
22292229

22302230
int Pos = 0;
22312231
while (N) {
2232-
if (insertSeparators && Pos % Grouping == 0 && Pos > 0) {
2232+
if (InsertSeparators && Pos % Grouping == 0 && Pos > 0)
22332233
*--BufPtr = '\'';
2234-
}
22352234
*--BufPtr = Digits[N % Radix];
22362235
N /= Radix;
22372236
Pos++;
@@ -2269,9 +2268,9 @@ void APInt::toString(SmallVectorImpl<char> &Str, unsigned Radix, bool Signed,
22692268
int Pos = 0;
22702269
while (Tmp.getBoolValue()) {
22712270
unsigned Digit = unsigned(Tmp.getRawData()[0]) & MaskAmt;
2272-
if (insertSeparators && Pos % Grouping == 0 && Pos > 0) {
2271+
if (InsertSeparators && Pos % Grouping == 0 && Pos > 0)
22732272
Str.push_back('\'');
2274-
}
2273+
22752274
Str.push_back(Digits[Digit]);
22762275
Tmp.lshrInPlace(ShiftAmt);
22772276
Pos++;
@@ -2282,9 +2281,9 @@ void APInt::toString(SmallVectorImpl<char> &Str, unsigned Radix, bool Signed,
22822281
uint64_t Digit;
22832282
udivrem(Tmp, Radix, Tmp, Digit);
22842283
assert(Digit < Radix && "divide failed");
2285-
if (insertSeparators && Pos % Grouping == 0 && Pos > 0) {
2284+
if (InsertSeparators && Pos % Grouping == 0 && Pos > 0)
22862285
Str.push_back('\'');
2287-
}
2286+
22882287
Str.push_back(Digits[Digit]);
22892288
Pos++;
22902289
}

0 commit comments

Comments
 (0)