Skip to content

Commit f0756e0

Browse files
committed
Revert "[clang-format] Add an option to format integer literal separators"
Revert "[clang-format] Disable FixRanges in IntegerLiteralSeparatorTest" Breaks buildbots, details in https://reviews.llvm.org/D140543 This reverts commit 879bd91. This reverts commit 46c94e5.
1 parent dfec6f7 commit f0756e0

File tree

9 files changed

+0
-555
lines changed

9 files changed

+0
-555
lines changed

clang/docs/ClangFormatStyleOptions.rst

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3159,37 +3159,6 @@ the configuration (without a prefix: ``Auto``).
31593159

31603160

31613161

3162-
**IntegerLiteralSeparator** (``IntegerLiteralSeparatorStyle``) :versionbadge:`clang-format 16`
3163-
Format integer literal separators (``'`` for C++ and ``_`` for C#, Java,
3164-
and JavaScript).
3165-
3166-
Nested configuration flags:
3167-
3168-
Separator format of integer literals of different bases.
3169-
<0: Remove separators.
3170-
0: Leave the literal as is.
3171-
>0: Insert separators between digits, starting from the rightmost digit.
3172-
3173-
* ``int8_t Binary`` .. code-block:: c++
3174-
3175-
-1: 0b100111101101
3176-
0: 0b10011'11'0110'1
3177-
3: 0b100'111'101'101
3178-
4: 0b1001'1110'1101
3179-
3180-
* ``int8_t Decimal`` .. code-block:: c++
3181-
3182-
-1: 18446744073709550592ull
3183-
0: 184467'440737'0'95505'92ull
3184-
3: 18'446'744'073'709'550'592ull
3185-
3186-
* ``int8_t Hex`` .. code-block:: c++
3187-
3188-
-1: 0xDEADBEEFDEADBEEFuz
3189-
0: 0xDEAD'BEEF'DE'AD'BEE'Fuz
3190-
2: 0xDE'AD'BE'EF'DE'AD'BE'EFuz
3191-
3192-
31933162
**JavaImportGroups** (``List of Strings``) :versionbadge:`clang-format 8`
31943163
A vector of prefixes ordered by the desired groups for Java imports.
31953164

clang/docs/ReleaseNotes.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -867,8 +867,6 @@ clang-format
867867
- Add ``RequiresExpressionIndentation`` option for configuring the alignment of requires-expressions.
868868
The default value of this option is ``OuterScope``, which differs in behavior from clang-format 15.
869869
To match the default behavior of clang-format 15, use the ``Keyword`` value.
870-
- Add ``IntegerLiteralSeparator`` option for fixing integer literal separators
871-
in C++, C#, Java, and JavaScript.
872870

873871
clang-extdef-mapping
874872
--------------------

clang/include/clang/Format/Format.h

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2450,37 +2450,6 @@ struct FormatStyle {
24502450
/// \version 11
24512451
TrailingCommaStyle InsertTrailingCommas;
24522452

2453-
/// Separator format of integer literals of different bases.
2454-
/// <0: Remove separators.
2455-
/// 0: Leave the literal as is.
2456-
/// >0: Insert separators between digits, starting from the rightmost digit.
2457-
struct IntegerLiteralSeparatorStyle {
2458-
/// \code
2459-
/// -1: 0b100111101101
2460-
/// 0: 0b10011'11'0110'1
2461-
/// 3: 0b100'111'101'101
2462-
/// 4: 0b1001'1110'1101
2463-
/// \endcode
2464-
int8_t Binary;
2465-
/// \code
2466-
/// -1: 18446744073709550592ull
2467-
/// 0: 184467'440737'0'95505'92ull
2468-
/// 3: 18'446'744'073'709'550'592ull
2469-
/// \endcode
2470-
int8_t Decimal;
2471-
/// \code
2472-
/// -1: 0xDEADBEEFDEADBEEFuz
2473-
/// 0: 0xDEAD'BEEF'DE'AD'BEE'Fuz
2474-
/// 2: 0xDE'AD'BE'EF'DE'AD'BE'EFuz
2475-
/// \endcode
2476-
int8_t Hex;
2477-
};
2478-
2479-
/// Format integer literal separators (``'`` for C++ and ``_`` for C#, Java,
2480-
/// and JavaScript).
2481-
/// \version 16
2482-
IntegerLiteralSeparatorStyle IntegerLiteralSeparator;
2483-
24842453
/// A vector of prefixes ordered by the desired groups for Java imports.
24852454
///
24862455
/// One group's prefix can be a subset of another - the longest prefix is
@@ -4120,10 +4089,6 @@ struct FormatStyle {
41204089
IndentWidth == R.IndentWidth &&
41214090
IndentWrappedFunctionNames == R.IndentWrappedFunctionNames &&
41224091
InsertBraces == R.InsertBraces &&
4123-
IntegerLiteralSeparator.Binary == R.IntegerLiteralSeparator.Binary &&
4124-
IntegerLiteralSeparator.Decimal ==
4125-
R.IntegerLiteralSeparator.Decimal &&
4126-
IntegerLiteralSeparator.Hex == R.IntegerLiteralSeparator.Hex &&
41274092
JavaImportGroups == R.JavaImportGroups &&
41284093
JavaScriptQuotes == R.JavaScriptQuotes &&
41294094
JavaScriptWrapImports == R.JavaScriptWrapImports &&

clang/lib/Format/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ add_clang_library(clangFormat
88
Format.cpp
99
FormatToken.cpp
1010
FormatTokenLexer.cpp
11-
IntegerLiteralSeparatorFixer.cpp
1211
MacroCallReconstructor.cpp
1312
MacroExpander.cpp
1413
NamespaceEndCommentsFixer.cpp

clang/lib/Format/Format.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include "FormatInternal.h"
2121
#include "FormatToken.h"
2222
#include "FormatTokenLexer.h"
23-
#include "IntegerLiteralSeparatorFixer.h"
2423
#include "NamespaceEndCommentsFixer.h"
2524
#include "QualifierAlignmentFixer.h"
2625
#include "SortJavaScriptImports.h"
@@ -336,14 +335,6 @@ struct ScalarEnumerationTraits<FormatStyle::IndentExternBlockStyle> {
336335
}
337336
};
338337

339-
template <> struct MappingTraits<FormatStyle::IntegerLiteralSeparatorStyle> {
340-
static void mapping(IO &IO, FormatStyle::IntegerLiteralSeparatorStyle &Base) {
341-
IO.mapOptional("Binary", Base.Binary);
342-
IO.mapOptional("Decimal", Base.Decimal);
343-
IO.mapOptional("Hex", Base.Hex);
344-
}
345-
};
346-
347338
template <> struct ScalarEnumerationTraits<FormatStyle::JavaScriptQuoteStyle> {
348339
static void enumeration(IO &IO, FormatStyle::JavaScriptQuoteStyle &Value) {
349340
IO.enumCase(Value, "Leave", FormatStyle::JSQS_Leave);
@@ -890,7 +881,6 @@ template <> struct MappingTraits<FormatStyle> {
890881
Style.IndentWrappedFunctionNames);
891882
IO.mapOptional("InsertBraces", Style.InsertBraces);
892883
IO.mapOptional("InsertTrailingCommas", Style.InsertTrailingCommas);
893-
IO.mapOptional("IntegerLiteralSeparator", Style.IntegerLiteralSeparator);
894884
IO.mapOptional("JavaImportGroups", Style.JavaImportGroups);
895885
IO.mapOptional("JavaScriptQuotes", Style.JavaScriptQuotes);
896886
IO.mapOptional("JavaScriptWrapImports", Style.JavaScriptWrapImports);
@@ -1345,7 +1335,6 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind Language) {
13451335
LLVMStyle.IndentWrappedFunctionNames = false;
13461336
LLVMStyle.InsertBraces = false;
13471337
LLVMStyle.InsertTrailingCommas = FormatStyle::TCS_None;
1348-
LLVMStyle.IntegerLiteralSeparator = {/*Binary=*/0, /*Decimal=*/0, /*Hex=*/0};
13491338
LLVMStyle.JavaScriptQuotes = FormatStyle::JSQS_Leave;
13501339
LLVMStyle.JavaScriptWrapImports = true;
13511340
LLVMStyle.KeepEmptyLinesAtTheStartOfBlocks = true;
@@ -3402,10 +3391,6 @@ reformat(const FormatStyle &Style, StringRef Code,
34023391
AnalyzerPass;
34033392
SmallVector<AnalyzerPass, 8> Passes;
34043393

3405-
Passes.emplace_back([&](const Environment &Env) {
3406-
return IntegerLiteralSeparatorFixer().process(Env, Expanded);
3407-
});
3408-
34093394
if (Style.isCpp()) {
34103395
if (Style.QualifierAlignment != FormatStyle::QAS_Leave) {
34113396
Passes.emplace_back([&](const Environment &Env) {

clang/lib/Format/IntegerLiteralSeparatorFixer.cpp

Lines changed: 0 additions & 201 deletions
This file was deleted.

clang/lib/Format/IntegerLiteralSeparatorFixer.h

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)