clang
20.0.0git
lib
Format
IntegerLiteralSeparatorFixer.cpp
Go to the documentation of this file.
1
//===--- IntegerLiteralSeparatorFixer.cpp -----------------------*- C++ -*-===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
///
9
/// \file
10
/// This file implements IntegerLiteralSeparatorFixer that fixes C++ integer
11
/// literal separators.
12
///
13
//===----------------------------------------------------------------------===//
14
15
#include "
IntegerLiteralSeparatorFixer.h
"
16
17
namespace
clang
{
18
namespace
format {
19
20
enum class
Base
{
Binary
,
Decimal
,
Hex
,
Other
};
21
22
static
Base
getBase
(
const
StringRef
IntegerLiteral
) {
23
assert(
IntegerLiteral
.size() > 1);
24
25
if
(
IntegerLiteral
[0] >
'0'
) {
26
assert(
IntegerLiteral
[0] <=
'9'
);
27
return
Base::Decimal
;
28
}
29
30
assert(