[llvm] [clang] [clang-tools-extra] [clang-tidy] modernize-use-digit-separator issue #35414 (PR #76153)

Arkhipov Ivan via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 9 07:48:33 PST 2024


https://github.com/IvanArkhipov1999 updated https://github.com/llvm/llvm-project/pull/76153

>From 3b83f8608791ea0c270424af855acd365d9a7fdd Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Sat, 2 Dec 2023 18:00:48 +0300
Subject: [PATCH 01/76] Add empty files for use-digit-separator-check

---
 .../clang-tidy/modernize/CMakeLists.txt       |  1 +
 .../modernize/ModernizeTidyModule.cpp         |  3 ++
 .../modernize/UseDigitSeparatorCheck.cpp      | 33 +++++++++++++++++++
 .../modernize/UseDigitSeparatorCheck.h        | 30 +++++++++++++++++
 clang-tools-extra/docs/ReleaseNotes.rst       |  5 +++
 .../docs/clang-tidy/checks/list.rst           |  1 +
 6 files changed, 73 insertions(+)
 create mode 100644 clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
 create mode 100644 clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.h

diff --git a/clang-tools-extra/clang-tidy/modernize/CMakeLists.txt b/clang-tools-extra/clang-tidy/modernize/CMakeLists.txt
index 717c400c479033..872c37147104c8 100644
--- a/clang-tools-extra/clang-tidy/modernize/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/modernize/CMakeLists.txt
@@ -31,6 +31,7 @@ add_clang_library(clangTidyModernizeModule
   UseBoolLiteralsCheck.cpp
   UseConstraintsCheck.cpp
   UseDefaultMemberInitCheck.cpp
+  UseDigitSeparatorCheck.cpp
   UseEmplaceCheck.cpp
   UseEqualsDefaultCheck.cpp
   UseEqualsDeleteCheck.cpp
diff --git a/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp b/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp
index 73751cf2705068..e799eafbfc866b 100644
--- a/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp
@@ -32,6 +32,7 @@
 #include "UseBoolLiteralsCheck.h"
 #include "UseConstraintsCheck.h"
 #include "UseDefaultMemberInitCheck.h"
+#include "UseDigitSeparatorCheck.h"
 #include "UseEmplaceCheck.h"
 #include "UseEqualsDefaultCheck.h"
 #include "UseEqualsDeleteCheck.h"
@@ -66,6 +67,8 @@ class ModernizeModule : public ClangTidyModule {
     CheckFactories.registerCheck<MakeSharedCheck>("modernize-make-shared");
     CheckFactories.registerCheck<MakeUniqueCheck>("modernize-make-unique");
     CheckFactories.registerCheck<PassByValueCheck>("modernize-pass-by-value");
+    CheckFactories.registerCheck<UseDigitSeparatorCheck>(
+        "modernize-use-digit-separator");
     CheckFactories.registerCheck<UseStdPrintCheck>("modernize-use-std-print");
     CheckFactories.registerCheck<RawStringLiteralCheck>(
         "modernize-raw-string-literal");
diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
new file mode 100644
index 00000000000000..3d9ddb14e49245
--- /dev/null
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -0,0 +1,33 @@
+//===--- UseDigitSeparatorCheck.cpp - clang-tidy --------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "UseDigitSeparatorCheck.h"
+#include "clang/AST/ASTContext.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+
+using namespace clang::ast_matchers;
+
+namespace clang::tidy::modernize {
+
+void UseDigitSeparatorCheck::registerMatchers(MatchFinder *Finder) {
+  // FIXME: Add matchers.
+  Finder->addMatcher(functionDecl().bind("x"), this);
+}
+
+void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
+  // FIXME: Add callback implementation.
+  const auto *MatchedDecl = Result.Nodes.getNodeAs<FunctionDecl>("x");
+  if (!MatchedDecl->getIdentifier() || MatchedDecl->getName().startswith("awesome_"))
+    return;
+  diag(MatchedDecl->getLocation(), "function %0 is insufficiently awesome")
+      << MatchedDecl
+      << FixItHint::CreateInsertion(MatchedDecl->getLocation(), "awesome_");
+  diag(MatchedDecl->getLocation(), "insert 'awesome'", DiagnosticIDs::Note);
+}
+
+} // namespace clang::tidy::modernize
diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.h b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.h
new file mode 100644
index 00000000000000..8bbd2b3947c931
--- /dev/null
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.h
@@ -0,0 +1,30 @@
+//===--- UseDigitSeparatorCheck.h - clang-tidy ------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_USEDIGITSEPARATORCHECK_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_USEDIGITSEPARATORCHECK_H
+
+#include "../ClangTidyCheck.h"
+
+namespace clang::tidy::modernize {
+
+/// FIXME: Write a short description.
+///
+/// For the user-facing documentation see:
+/// http://clang.llvm.org/extra/clang-tidy/checks/modernize/use-digit-separator.html
+class UseDigitSeparatorCheck : public ClangTidyCheck {
+public:
+  UseDigitSeparatorCheck(StringRef Name, ClangTidyContext *Context)
+      : ClangTidyCheck(Name, Context) {}
+  void registerMatchers(ast_matchers::MatchFinder *Finder) override;
+  void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
+};
+
+} // namespace clang::tidy::modernize
+
+#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_USEDIGITSEPARATORCHECK_H
diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst
index 6d5f49dc062545..ae9d69e1434df9 100644
--- a/clang-tools-extra/docs/ReleaseNotes.rst
+++ b/clang-tools-extra/docs/ReleaseNotes.rst
@@ -186,6 +186,11 @@ New checks
 
   Replace ``enable_if`` with C++20 requires clauses.
 
+- New :doc:`modernize-use-digit-separator
+  <clang-tidy/checks/modernize/use-digit-separator>` check.
+
+  FIXME: add release notes.
+
 - New :doc:`performance-enum-size
   <clang-tidy/checks/performance/enum-size>` check.
 
diff --git a/clang-tools-extra/docs/clang-tidy/checks/list.rst b/clang-tools-extra/docs/clang-tidy/checks/list.rst
index 6f987ba1672e3f..f4fe9726e9b2b0 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/list.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/list.rst
@@ -285,6 +285,7 @@ Clang-Tidy Checks
    :doc:`modernize-use-bool-literals <modernize/use-bool-literals>`, "Yes"
    :doc:`modernize-use-constraints <modernize/use-constraints>`, "Yes"
    :doc:`modernize-use-default-member-init <modernize/use-default-member-init>`, "Yes"
+   :doc:`modernize-use-digit-separator <modernize/use-digit-separator>`, "Yes"
    :doc:`modernize-use-emplace <modernize/use-emplace>`, "Yes"
    :doc:`modernize-use-equals-default <modernize/use-equals-default>`, "Yes"
    :doc:`modernize-use-equals-delete <modernize/use-equals-delete>`, "Yes"

>From 0560b3c2518b797849c15d7c9c502c46c009d2a3 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Sat, 2 Dec 2023 19:21:34 +0300
Subject: [PATCH 02/76] Finding integer value

---
 .../modernize/UseDigitSeparatorCheck.cpp      | 22 ++++++++++++-------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 3d9ddb14e49245..7a5b40840eab9d 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -16,18 +16,24 @@ namespace clang::tidy::modernize {
 
 void UseDigitSeparatorCheck::registerMatchers(MatchFinder *Finder) {
   // FIXME: Add matchers.
-  Finder->addMatcher(functionDecl().bind("x"), this);
+//  Finder->addMatcher(functionDecl().bind("x"), this);
+  Finder->addMatcher(integerLiteral().bind("integerLiteral"), this);
 }
 
 void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
   // FIXME: Add callback implementation.
-  const auto *MatchedDecl = Result.Nodes.getNodeAs<FunctionDecl>("x");
-  if (!MatchedDecl->getIdentifier() || MatchedDecl->getName().startswith("awesome_"))
-    return;
-  diag(MatchedDecl->getLocation(), "function %0 is insufficiently awesome")
-      << MatchedDecl
-      << FixItHint::CreateInsertion(MatchedDecl->getLocation(), "awesome_");
-  diag(MatchedDecl->getLocation(), "insert 'awesome'", DiagnosticIDs::Note);
+//  const auto *MatchedDecl = Result.Nodes.getNodeAs<FunctionDecl>("x");
+//  if (!MatchedDecl->getIdentifier() || MatchedDecl->getName().startswith("awesome_"))
+//    return;
+//  diag(MatchedDecl->getLocation(), "function %0 is insufficiently awesome")
+//      << MatchedDecl
+//      << FixItHint::CreateInsertion(MatchedDecl->getLocation(), "awesome_");
+//  diag(MatchedDecl->getLocation(), "insert 'awesome'", DiagnosticIDs::Note);
+  const auto *MatchedInteger = Result.Nodes.getNodeAs<IntegerLiteral>("integerLiteral");
+  const auto IntegerValue = MatchedInteger->getValue();
+  diag(MatchedInteger->getLocation(), "integer warning %0") << toString(IntegerValue, 10, true)
+        << FixItHint::CreateInsertion(MatchedInteger->getLocation(), "this is integer");
+  diag(MatchedInteger->getLocation(), "integer", DiagnosticIDs::Note);
 }
 
 } // namespace clang::tidy::modernize

>From 7e648539bf0514f897760de5db4a2e4439e7c73e Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Sun, 3 Dec 2023 18:06:17 +0300
Subject: [PATCH 03/76] Splitting integer string by 3 digits

---
 .../modernize/UseDigitSeparatorCheck.cpp      | 32 ++++++++++++-------
 1 file changed, 21 insertions(+), 11 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 7a5b40840eab9d..2cc6aab4b96615 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -6,32 +6,42 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include <algorithm>
+#include <numeric>
+
 #include "UseDigitSeparatorCheck.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
 
 using namespace clang::ast_matchers;
 
+namespace {
+  std::vector<std::basic_string<char>> splitString3Symbols(const std::basic_string<char> &String) {
+    std::vector<std::basic_string<char>> Result;
+    std::basic_string<char> ReversedString(String.rbegin(), String.rend());
+
+    for (size_t I = 0; I < ReversedString.size(); I += 3) {
+      Result.push_back(ReversedString.substr(I, 3));
+    }
+
+    std::reverse(Result.begin(), Result.end());
+
+    return Result;
+  }
+} // namespace
+
 namespace clang::tidy::modernize {
 
 void UseDigitSeparatorCheck::registerMatchers(MatchFinder *Finder) {
-  // FIXME: Add matchers.
-//  Finder->addMatcher(functionDecl().bind("x"), this);
   Finder->addMatcher(integerLiteral().bind("integerLiteral"), this);
 }
 
 void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
-  // FIXME: Add callback implementation.
-//  const auto *MatchedDecl = Result.Nodes.getNodeAs<FunctionDecl>("x");
-//  if (!MatchedDecl->getIdentifier() || MatchedDecl->getName().startswith("awesome_"))
-//    return;
-//  diag(MatchedDecl->getLocation(), "function %0 is insufficiently awesome")
-//      << MatchedDecl
-//      << FixItHint::CreateInsertion(MatchedDecl->getLocation(), "awesome_");
-//  diag(MatchedDecl->getLocation(), "insert 'awesome'", DiagnosticIDs::Note);
   const auto *MatchedInteger = Result.Nodes.getNodeAs<IntegerLiteral>("integerLiteral");
   const auto IntegerValue = MatchedInteger->getValue();
-  diag(MatchedInteger->getLocation(), "integer warning %0") << toString(IntegerValue, 10, true)
+  const auto IntegerString = splitString3Symbols(toString(IntegerValue, 10, true));
+  const auto FinalString = std::accumulate(IntegerString.begin(), IntegerString.end(), std::string(""), [](std::basic_string<char> S1, std::basic_string<char> S2) {return S1 + "\'" + S2;}).erase(0, 1);
+  diag(MatchedInteger->getLocation(), "integer warning %0") << FinalString
         << FixItHint::CreateInsertion(MatchedInteger->getLocation(), "this is integer");
   diag(MatchedInteger->getLocation(), "integer", DiagnosticIDs::Note);
 }

>From 43f66ac8da7a67beb2d31ec7bfc23d10391c3c77 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Sun, 3 Dec 2023 18:07:16 +0300
Subject: [PATCH 04/76] Formatting

---
 .../modernize/UseDigitSeparatorCheck.cpp      | 35 ++++++++++++-------
 1 file changed, 22 insertions(+), 13 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 2cc6aab4b96615..2e18f289e1a37b 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -16,18 +16,19 @@
 using namespace clang::ast_matchers;
 
 namespace {
-  std::vector<std::basic_string<char>> splitString3Symbols(const std::basic_string<char> &String) {
-    std::vector<std::basic_string<char>> Result;
-    std::basic_string<char> ReversedString(String.rbegin(), String.rend());
+std::vector<std::basic_string<char>>
+splitString3Symbols(const std::basic_string<char> &String) {
+  std::vector<std::basic_string<char>> Result;
+  std::basic_string<char> ReversedString(String.rbegin(), String.rend());
 
-    for (size_t I = 0; I < ReversedString.size(); I += 3) {
-      Result.push_back(ReversedString.substr(I, 3));
-    }
+  for (size_t I = 0; I < ReversedString.size(); I += 3) {
+    Result.push_back(ReversedString.substr(I, 3));
+  }
 
-    std::reverse(Result.begin(), Result.end());
+  std::reverse(Result.begin(), Result.end());
 
-    return Result;
-  }
+  return Result;
+}
 } // namespace
 
 namespace clang::tidy::modernize {
@@ -39,10 +40,18 @@ void UseDigitSeparatorCheck::registerMatchers(MatchFinder *Finder) {
 void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
   const auto *MatchedInteger = Result.Nodes.getNodeAs<IntegerLiteral>("integerLiteral");
   const auto IntegerValue = MatchedInteger->getValue();
-  const auto IntegerString = splitString3Symbols(toString(IntegerValue, 10, true));
-  const auto FinalString = std::accumulate(IntegerString.begin(), IntegerString.end(), std::string(""), [](std::basic_string<char> S1, std::basic_string<char> S2) {return S1 + "\'" + S2;}).erase(0, 1);
-  diag(MatchedInteger->getLocation(), "integer warning %0") << FinalString
-        << FixItHint::CreateInsertion(MatchedInteger->getLocation(), "this is integer");
+  const auto IntegerString =
+      splitString3Symbols(toString(IntegerValue, 10, true));
+  const auto FinalString =
+      std::accumulate(IntegerString.begin(), IntegerString.end(),
+                      std::string(""),
+                      [](std::basic_string<char> S1,
+                         std::basic_string<char> S2) { return S1 + "\'" + S2; })
+          .erase(0, 1);
+  diag(MatchedInteger->getLocation(), "integer warning %0")
+      << FinalString
+      << FixItHint::CreateInsertion(MatchedInteger->getLocation(),
+                                    "this is integer");
   diag(MatchedInteger->getLocation(), "integer", DiagnosticIDs::Note);
 }
 

>From 3a3667939df9599cb2c193709b215f701f185b21 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Mon, 4 Dec 2023 13:25:52 +0300
Subject: [PATCH 05/76] Checking formatting of integer literal

---
 .../modernize/UseDigitSeparatorCheck.cpp      | 33 +++++++++++++------
 1 file changed, 23 insertions(+), 10 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 2e18f289e1a37b..bbc1008553904d 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -12,6 +12,7 @@
 #include "UseDigitSeparatorCheck.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/Lex/Lexer.h"
 
 using namespace clang::ast_matchers;
 
@@ -38,21 +39,33 @@ void UseDigitSeparatorCheck::registerMatchers(MatchFinder *Finder) {
 }
 
 void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
-  const auto *MatchedInteger = Result.Nodes.getNodeAs<IntegerLiteral>("integerLiteral");
-  const auto IntegerValue = MatchedInteger->getValue();
-  const auto IntegerString =
+  const ASTContext &Context = *Result.Context;
+  const SourceManager &Source = Context.getSourceManager();
+  const IntegerLiteral *MatchedInteger = Result.Nodes.getNodeAs<IntegerLiteral>("integerLiteral");
+
+  // Get original literal source text
+  const StringRef OriginalLiteralString = Lexer::getSourceText(CharSourceRange::getTokenRange(MatchedInteger->getSourceRange()), Source, Context.getLangOpts());
+
+  // Get formatting literal text
+  const llvm::APInt IntegerValue = MatchedInteger->getValue();
+  const std::vector<std::string> SplittedIntegerLiteral =
       splitString3Symbols(toString(IntegerValue, 10, true));
-  const auto FinalString =
-      std::accumulate(IntegerString.begin(), IntegerString.end(),
+  const std::string FormatedLiteralString =
+      std::accumulate(SplittedIntegerLiteral.begin(),
+                      SplittedIntegerLiteral.end(),
                       std::string(""),
                       [](std::basic_string<char> S1,
                          std::basic_string<char> S2) { return S1 + "\'" + S2; })
           .erase(0, 1);
-  diag(MatchedInteger->getLocation(), "integer warning %0")
-      << FinalString
-      << FixItHint::CreateInsertion(MatchedInteger->getLocation(),
-                                    "this is integer");
-  diag(MatchedInteger->getLocation(), "integer", DiagnosticIDs::Note);
+
+  // Compare the original and formatted representation of a literal
+  if (OriginalLiteralString != FormatedLiteralString) {
+    diag(MatchedInteger->getLocation(), "integer warning %0 %1")
+        << FormatedLiteralString << OriginalLiteralString
+        << FixItHint::CreateInsertion(MatchedInteger->getLocation(),
+                                      "this is integer");
+    diag(MatchedInteger->getLocation(), "integer", DiagnosticIDs::Note);
+  }
 }
 
 } // namespace clang::tidy::modernize

>From 524aa8b7bfb806d0819dfc6a4e23a20d458313d2 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Mon, 4 Dec 2023 13:46:56 +0300
Subject: [PATCH 06/76] Messages of checking formatting integer literals

---
 .../clang-tidy/modernize/UseDigitSeparatorCheck.cpp        | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index bbc1008553904d..f8251a23b1326f 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -60,11 +60,10 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
 
   // Compare the original and formatted representation of a literal
   if (OriginalLiteralString != FormatedLiteralString) {
-    diag(MatchedInteger->getLocation(), "integer warning %0 %1")
-        << FormatedLiteralString << OriginalLiteralString
+    diag(MatchedInteger->getLocation(), "unformatted representation of integer literal '%0'")
+        << OriginalLiteralString
         << FixItHint::CreateInsertion(MatchedInteger->getLocation(),
-                                      "this is integer");
-    diag(MatchedInteger->getLocation(), "integer", DiagnosticIDs::Note);
+                                      FormatedLiteralString);
   }
 }
 

>From 78b1bf18d4a3f060fd7254197c3e97de5fcb02f3 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Mon, 4 Dec 2023 15:28:19 +0300
Subject: [PATCH 07/76] Support for various number systems

---
 .../modernize/UseDigitSeparatorCheck.cpp      | 28 +++++++++++++++----
 1 file changed, 23 insertions(+), 5 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index f8251a23b1326f..b02179b29290f1 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -18,15 +18,16 @@ using namespace clang::ast_matchers;
 
 namespace {
 std::vector<std::basic_string<char>>
-splitString3Symbols(const std::basic_string<char> &String) {
+splitStringByGroupSize(const std::basic_string<char> &String, size_t GroupSize) {
   std::vector<std::basic_string<char>> Result;
   std::basic_string<char> ReversedString(String.rbegin(), String.rend());
 
-  for (size_t I = 0; I < ReversedString.size(); I += 3) {
-    Result.push_back(ReversedString.substr(I, 3));
+  for (size_t I = 0; I < ReversedString.size(); I += GroupSize) {
+    Result.push_back(ReversedString.substr(I, GroupSize));
   }
 
   std::reverse(Result.begin(), Result.end());
+  std::for_each(Result.begin(), Result.end(), [](std::basic_string<char> &Str) {return std::reverse(Str.begin(), Str.end());});
 
   return Result;
 }
@@ -46,11 +47,28 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
   // Get original literal source text
   const StringRef OriginalLiteralString = Lexer::getSourceText(CharSourceRange::getTokenRange(MatchedInteger->getSourceRange()), Source, Context.getLangOpts());
 
+  // Configure formatting
+  unsigned int Radix;
+  size_t GroupSize;
+  std::string Prefix;
+  if (OriginalLiteralString.starts_with("0b")) {
+    Radix = 2;
+    GroupSize = 4;
+    Prefix = "0b";
+  } else if (OriginalLiteralString.starts_with("0x")) {
+    Radix = 16;
+    GroupSize = 4;
+    Prefix = "0x";
+  } else {
+      Radix = 10;
+      GroupSize = 3;
+  }
+
   // Get formatting literal text
   const llvm::APInt IntegerValue = MatchedInteger->getValue();
   const std::vector<std::string> SplittedIntegerLiteral =
-      splitString3Symbols(toString(IntegerValue, 10, true));
-  const std::string FormatedLiteralString =
+      splitStringByGroupSize(toString(IntegerValue, Radix, true), GroupSize);
+  const std::string FormatedLiteralString = Prefix +
       std::accumulate(SplittedIntegerLiteral.begin(),
                       SplittedIntegerLiteral.end(),
                       std::string(""),

>From 9d4430d1e6690a67a4177f84825b58267e0db4bb Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Mon, 4 Dec 2023 15:51:03 +0300
Subject: [PATCH 08/76] Support for octal number system

---
 .../clang-tidy/modernize/UseDigitSeparatorCheck.cpp           | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index b02179b29290f1..eafc7349837dc8 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -59,6 +59,10 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
     Radix = 16;
     GroupSize = 4;
     Prefix = "0x";
+  } else if (OriginalLiteralString.starts_with("0") && OriginalLiteralString != "0") {
+    Radix = 8;
+    GroupSize = 3;
+    Prefix = "0";
   } else {
       Radix = 10;
       GroupSize = 3;

>From d80dbbe6bf5ed50115e43bb1441b030893bb39f4 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Mon, 4 Dec 2023 15:51:53 +0300
Subject: [PATCH 09/76] Formatting

---
 .../clang-tidy/modernize/UseDigitSeparatorCheck.cpp        | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index eafc7349837dc8..82c0959c8b30ff 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -59,13 +59,14 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
     Radix = 16;
     GroupSize = 4;
     Prefix = "0x";
-  } else if (OriginalLiteralString.starts_with("0") && OriginalLiteralString != "0") {
+  } else if (OriginalLiteralString.starts_with("0") &&
+             OriginalLiteralString != "0") {
     Radix = 8;
     GroupSize = 3;
     Prefix = "0";
   } else {
-      Radix = 10;
-      GroupSize = 3;
+    Radix = 10;
+    GroupSize = 3;
   }
 
   // Get formatting literal text

>From 4bd9517ad87eff53adde22651efe7ef878c1a939 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Tue, 5 Dec 2023 17:10:17 +0300
Subject: [PATCH 10/76] Support integer literals with postfix

---
 .../modernize/UseDigitSeparatorCheck.cpp      | 23 ++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 82c0959c8b30ff..98027a725f7b63 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -8,6 +8,7 @@
 
 #include <algorithm>
 #include <numeric>
+//#include <regex>
 
 #include "UseDigitSeparatorCheck.h"
 #include "clang/AST/ASTContext.h"
@@ -51,6 +52,7 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
   unsigned int Radix;
   size_t GroupSize;
   std::string Prefix;
+  std::string Postfix;
   if (OriginalLiteralString.starts_with("0b")) {
     Radix = 2;
     GroupSize = 4;
@@ -69,17 +71,32 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
     GroupSize = 3;
   }
 
+  if (OriginalLiteralString.ends_with("L") || OriginalLiteralString.ends_with("l") || OriginalLiteralString.ends_with("U") || OriginalLiteralString.ends_with("u")) {
+    Postfix = OriginalLiteralString.back();
+  }
+
   // Get formatting literal text
   const llvm::APInt IntegerValue = MatchedInteger->getValue();
-  const std::vector<std::string> SplittedIntegerLiteral =
-      splitStringByGroupSize(toString(IntegerValue, Radix, true), GroupSize);
+  std::vector<std::string> SplittedIntegerLiteral = splitStringByGroupSize(toString(IntegerValue, Radix, true), GroupSize);
+//  if (OriginalLiteralString.contains('.')) {
+//    std::vector<std::string> SplitedString;
+//    const std::regex DotRegex(".");
+//    std::sregex_token_iterator
+//        Begin(OriginalLiteralString.str().begin(), OriginalLiteralString.str().end(), DotRegex, -1),
+//        End;
+//
+//    std::copy(Begin, End, std::back_inserter(SplitedString));
+////    const auto SplitedString = std::views::split(OriginalLiteralString, '.');
+//  } else {
+//    SplittedIntegerLiteral = splitStringByGroupSize(toString(IntegerValue, Radix, true), GroupSize);
+//  }
   const std::string FormatedLiteralString = Prefix +
       std::accumulate(SplittedIntegerLiteral.begin(),
                       SplittedIntegerLiteral.end(),
                       std::string(""),
                       [](std::basic_string<char> S1,
                          std::basic_string<char> S2) { return S1 + "\'" + S2; })
-          .erase(0, 1);
+          .erase(0, 1) + Postfix;
 
   // Compare the original and formatted representation of a literal
   if (OriginalLiteralString != FormatedLiteralString) {

>From c97e527ce9e7306346f4947a09a9d37ae79a4e3e Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Tue, 5 Dec 2023 18:08:36 +0300
Subject: [PATCH 11/76] Begin of work with float literals

---
 .clang-tidy | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.clang-tidy b/.clang-tidy
index 4e1cb114f43b2c..44eff925939802 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -1,4 +1,4 @@
-Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-const-correctness,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,-misc-no-recursion,-misc-use-anonymous-namespace,readability-identifier-naming'
+Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-const-correctness,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,-misc-no-recursion,-misc-use-anonymous-namespace,modernize-use-digit-separator,readability-identifier-naming'
 CheckOptions:
   - key:             readability-identifier-naming.ClassCase
     value:           CamelCase

>From 544d9f89a47b039328ad48cc6ce6f8dcf64be12a Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Tue, 5 Dec 2023 18:08:43 +0300
Subject: [PATCH 12/76] Begin of work with float literals

---
 .../modernize/UseDigitSeparatorCheck.cpp      | 150 +++++++++++-------
 1 file changed, 91 insertions(+), 59 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 98027a725f7b63..776c152095c5c9 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -38,72 +38,104 @@ namespace clang::tidy::modernize {
 
 void UseDigitSeparatorCheck::registerMatchers(MatchFinder *Finder) {
   Finder->addMatcher(integerLiteral().bind("integerLiteral"), this);
+  Finder->addMatcher(floatLiteral().bind("floatLiteral"), this);
 }
 
 void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
   const ASTContext &Context = *Result.Context;
   const SourceManager &Source = Context.getSourceManager();
   const IntegerLiteral *MatchedInteger = Result.Nodes.getNodeAs<IntegerLiteral>("integerLiteral");
-
-  // Get original literal source text
-  const StringRef OriginalLiteralString = Lexer::getSourceText(CharSourceRange::getTokenRange(MatchedInteger->getSourceRange()), Source, Context.getLangOpts());
-
-  // Configure formatting
-  unsigned int Radix;
-  size_t GroupSize;
-  std::string Prefix;
-  std::string Postfix;
-  if (OriginalLiteralString.starts_with("0b")) {
-    Radix = 2;
-    GroupSize = 4;
-    Prefix = "0b";
-  } else if (OriginalLiteralString.starts_with("0x")) {
-    Radix = 16;
-    GroupSize = 4;
-    Prefix = "0x";
-  } else if (OriginalLiteralString.starts_with("0") &&
-             OriginalLiteralString != "0") {
-    Radix = 8;
-    GroupSize = 3;
-    Prefix = "0";
+  const FloatingLiteral *MatchedFloat = Result.Nodes.getNodeAs<FloatingLiteral>("floatLiteral");
+
+  if (MatchedInteger != nullptr) {
+    // Get original literal source text
+    const StringRef OriginalLiteralString = Lexer::getSourceText(
+        CharSourceRange::getTokenRange(MatchedInteger->getSourceRange()),
+        Source, Context.getLangOpts());
+
+    // Configure formatting
+    unsigned int Radix;
+    size_t GroupSize;
+    std::string Prefix;
+    std::string Postfix;
+    if (OriginalLiteralString.starts_with("0b")) {
+      Radix = 2;
+      GroupSize = 4;
+      Prefix = "0b";
+    } else if (OriginalLiteralString.starts_with("0x")) {
+      Radix = 16;
+      GroupSize = 4;
+      Prefix = "0x";
+    } else if (OriginalLiteralString.starts_with("0") &&
+               OriginalLiteralString != "0") {
+      Radix = 8;
+      GroupSize = 3;
+      Prefix = "0";
+    } else {
+      Radix = 10;
+      GroupSize = 3;
+    }
+
+    if (OriginalLiteralString.ends_with("L") ||
+        OriginalLiteralString.ends_with("l") ||
+        OriginalLiteralString.ends_with("U") ||
+        OriginalLiteralString.ends_with("u")) {
+      Postfix = OriginalLiteralString.back();
+    }
+
+    // Get formatting literal text
+    const llvm::APInt IntegerValue = MatchedInteger->getValue();
+    const std::vector<std::string> SplittedIntegerLiteral =
+        splitStringByGroupSize(toString(IntegerValue, Radix, true), GroupSize);
+    //  if (OriginalLiteralString.contains('.')) {
+    //    std::vector<std::string> SplitedString;
+    //    const std::regex DotRegex(".");
+    //    std::sregex_token_iterator
+    //        Begin(OriginalLiteralString.str().begin(), OriginalLiteralString.str().end(), DotRegex, -1), End;
+    //
+    //    std::copy(Begin, End, std::back_inserter(SplitedString));
+    ////    const auto SplitedString = std::views::split(OriginalLiteralString, '.');
+    //  } else {
+    //    SplittedIntegerLiteral = splitStringByGroupSize(toString(IntegerValue, Radix, true), GroupSize);
+    //  }
+    const std::string FormatedLiteralString =
+        Prefix +
+        std::accumulate(
+            SplittedIntegerLiteral.begin(), SplittedIntegerLiteral.end(),
+            std::string(""),
+            [](std::basic_string<char> S1, std::basic_string<char> S2) {
+              return S1 + "\'" + S2;
+            })
+            .erase(0, 1) +
+        Postfix;
+
+    // Compare the original and formatted representation of a literal
+    if (OriginalLiteralString != FormatedLiteralString) {
+      diag(MatchedInteger->getLocation(),
+           "unformatted representation of integer literal '%0'")
+          << OriginalLiteralString
+          << FixItHint::CreateInsertion(MatchedInteger->getLocation(),
+                                        FormatedLiteralString);
+    }
+  } else if (MatchedFloat != nullptr) {
+    // Get original literal source text
+    const StringRef OriginalLiteralString = Lexer::getSourceText(
+        CharSourceRange::getTokenRange(MatchedFloat->getSourceRange()),
+        Source, Context.getLangOpts());
+
+    // Get formatting literal text
+    const std::string FormatedLiteralString;
+
+    // Compare the original and formatted representation of a literal
+    if (OriginalLiteralString != FormatedLiteralString) {
+      diag(MatchedFloat->getLocation(),
+           "unformatted representation of integer literal '%0'")
+          << OriginalLiteralString
+          << FixItHint::CreateInsertion(MatchedFloat->getLocation(),
+                                        FormatedLiteralString);
+    }
   } else {
-    Radix = 10;
-    GroupSize = 3;
-  }
-
-  if (OriginalLiteralString.ends_with("L") || OriginalLiteralString.ends_with("l") || OriginalLiteralString.ends_with("U") || OriginalLiteralString.ends_with("u")) {
-    Postfix = OriginalLiteralString.back();
-  }
-
-  // Get formatting literal text
-  const llvm::APInt IntegerValue = MatchedInteger->getValue();
-  std::vector<std::string> SplittedIntegerLiteral = splitStringByGroupSize(toString(IntegerValue, Radix, true), GroupSize);
-//  if (OriginalLiteralString.contains('.')) {
-//    std::vector<std::string> SplitedString;
-//    const std::regex DotRegex(".");
-//    std::sregex_token_iterator
-//        Begin(OriginalLiteralString.str().begin(), OriginalLiteralString.str().end(), DotRegex, -1),
-//        End;
-//
-//    std::copy(Begin, End, std::back_inserter(SplitedString));
-////    const auto SplitedString = std::views::split(OriginalLiteralString, '.');
-//  } else {
-//    SplittedIntegerLiteral = splitStringByGroupSize(toString(IntegerValue, Radix, true), GroupSize);
-//  }
-  const std::string FormatedLiteralString = Prefix +
-      std::accumulate(SplittedIntegerLiteral.begin(),
-                      SplittedIntegerLiteral.end(),
-                      std::string(""),
-                      [](std::basic_string<char> S1,
-                         std::basic_string<char> S2) { return S1 + "\'" + S2; })
-          .erase(0, 1) + Postfix;
-
-  // Compare the original and formatted representation of a literal
-  if (OriginalLiteralString != FormatedLiteralString) {
-    diag(MatchedInteger->getLocation(), "unformatted representation of integer literal '%0'")
-        << OriginalLiteralString
-        << FixItHint::CreateInsertion(MatchedInteger->getLocation(),
-                                      FormatedLiteralString);
+    assert(0);
   }
 }
 

>From 81151489e84f34a41010eac702e1be2a72a25d25 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Tue, 5 Dec 2023 18:09:04 +0300
Subject: [PATCH 13/76] Fix clang tidy

---
 .clang-tidy | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.clang-tidy b/.clang-tidy
index 44eff925939802..4e1cb114f43b2c 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -1,4 +1,4 @@
-Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-const-correctness,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,-misc-no-recursion,-misc-use-anonymous-namespace,modernize-use-digit-separator,readability-identifier-naming'
+Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-const-correctness,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,-misc-no-recursion,-misc-use-anonymous-namespace,readability-identifier-naming'
 CheckOptions:
   - key:             readability-identifier-naming.ClassCase
     value:           CamelCase

>From c9091cb64ad2778daaba66868a2b66ab035384f9 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Tue, 5 Dec 2023 22:32:41 +0300
Subject: [PATCH 14/76] Crazy (dirty) support for float literals

---
 .../modernize/UseDigitSeparatorCheck.cpp      | 42 ++++++++++++-------
 1 file changed, 27 insertions(+), 15 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 776c152095c5c9..849ddbd32d23eb 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -8,7 +8,7 @@
 
 #include <algorithm>
 #include <numeric>
-//#include <regex>
+#include <regex>
 
 #include "UseDigitSeparatorCheck.h"
 #include "clang/AST/ASTContext.h"
@@ -87,17 +87,6 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
     const llvm::APInt IntegerValue = MatchedInteger->getValue();
     const std::vector<std::string> SplittedIntegerLiteral =
         splitStringByGroupSize(toString(IntegerValue, Radix, true), GroupSize);
-    //  if (OriginalLiteralString.contains('.')) {
-    //    std::vector<std::string> SplitedString;
-    //    const std::regex DotRegex(".");
-    //    std::sregex_token_iterator
-    //        Begin(OriginalLiteralString.str().begin(), OriginalLiteralString.str().end(), DotRegex, -1), End;
-    //
-    //    std::copy(Begin, End, std::back_inserter(SplitedString));
-    ////    const auto SplitedString = std::views::split(OriginalLiteralString, '.');
-    //  } else {
-    //    SplittedIntegerLiteral = splitStringByGroupSize(toString(IntegerValue, Radix, true), GroupSize);
-    //  }
     const std::string FormatedLiteralString =
         Prefix +
         std::accumulate(
@@ -119,12 +108,35 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
     }
   } else if (MatchedFloat != nullptr) {
     // Get original literal source text
-    const StringRef OriginalLiteralString = Lexer::getSourceText(
+    const std::string OriginalLiteralString = Lexer::getSourceText(
         CharSourceRange::getTokenRange(MatchedFloat->getSourceRange()),
-        Source, Context.getLangOpts());
+        Source, Context.getLangOpts()).str();
 
     // Get formatting literal text
-    const std::string FormatedLiteralString;
+    std::string::size_type DotPosition = OriginalLiteralString.find('.');
+    std::string FirstSubString = OriginalLiteralString.substr(0, DotPosition);
+    std::string SecondSubString = OriginalLiteralString.substr(DotPosition + 1, OriginalLiteralString.size());
+    std::reverse(SecondSubString.begin(), SecondSubString.end());
+
+    std::vector<std::string> SplitedString = {FirstSubString, SecondSubString};
+    std::vector<std::string> SplittedFloatLiteral0 = splitStringByGroupSize(SplitedString[0], 3);
+    std::vector<std::string> SplittedFloatLiteral1 = splitStringByGroupSize(SplitedString[1], 3);
+    std::string SecondReversedString = std::accumulate(
+                                           SplittedFloatLiteral1.begin(), SplittedFloatLiteral1.end(),
+                                           std::string(""),
+                                           [](std::basic_string<char> S1, std::basic_string<char> S2) {
+                                             return S1 + "\'" + S2;
+                                           })
+                                           .erase(0, 1);
+    std::reverse(SecondReversedString.begin(), SecondReversedString.end());
+    const std::string FormatedLiteralString =
+        std::accumulate(
+            SplittedFloatLiteral0.begin(), SplittedFloatLiteral0.end(),
+            std::string(""),
+            [](std::basic_string<char> S1, std::basic_string<char> S2) {
+              return S1 + "\'" + S2;
+            })
+            .erase(0, 1) + '.' + SecondReversedString;
 
     // Compare the original and formatted representation of a literal
     if (OriginalLiteralString != FormatedLiteralString) {

>From ceb711a50723dfb38da4f9a516967ae649eba538 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Tue, 5 Dec 2023 22:34:52 +0300
Subject: [PATCH 15/76] Formatting

---
 .../modernize/UseDigitSeparatorCheck.cpp      | 35 +++++++++++--------
 1 file changed, 21 insertions(+), 14 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 849ddbd32d23eb..965462fcdd76aa 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -108,26 +108,32 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
     }
   } else if (MatchedFloat != nullptr) {
     // Get original literal source text
-    const std::string OriginalLiteralString = Lexer::getSourceText(
-        CharSourceRange::getTokenRange(MatchedFloat->getSourceRange()),
-        Source, Context.getLangOpts()).str();
+    const std::string OriginalLiteralString =
+        Lexer::getSourceText(
+            CharSourceRange::getTokenRange(MatchedFloat->getSourceRange()),
+            Source, Context.getLangOpts())
+            .str();
 
     // Get formatting literal text
     std::string::size_type DotPosition = OriginalLiteralString.find('.');
     std::string FirstSubString = OriginalLiteralString.substr(0, DotPosition);
-    std::string SecondSubString = OriginalLiteralString.substr(DotPosition + 1, OriginalLiteralString.size());
+    std::string SecondSubString = OriginalLiteralString.substr(
+        DotPosition + 1, OriginalLiteralString.size());
     std::reverse(SecondSubString.begin(), SecondSubString.end());
 
     std::vector<std::string> SplitedString = {FirstSubString, SecondSubString};
-    std::vector<std::string> SplittedFloatLiteral0 = splitStringByGroupSize(SplitedString[0], 3);
-    std::vector<std::string> SplittedFloatLiteral1 = splitStringByGroupSize(SplitedString[1], 3);
-    std::string SecondReversedString = std::accumulate(
-                                           SplittedFloatLiteral1.begin(), SplittedFloatLiteral1.end(),
-                                           std::string(""),
-                                           [](std::basic_string<char> S1, std::basic_string<char> S2) {
-                                             return S1 + "\'" + S2;
-                                           })
-                                           .erase(0, 1);
+    std::vector<std::string> SplittedFloatLiteral0 =
+        splitStringByGroupSize(SplitedString[0], 3);
+    std::vector<std::string> SplittedFloatLiteral1 =
+        splitStringByGroupSize(SplitedString[1], 3);
+    std::string SecondReversedString =
+        std::accumulate(
+            SplittedFloatLiteral1.begin(), SplittedFloatLiteral1.end(),
+            std::string(""),
+            [](std::basic_string<char> S1, std::basic_string<char> S2) {
+              return S1 + "\'" + S2;
+            })
+            .erase(0, 1);
     std::reverse(SecondReversedString.begin(), SecondReversedString.end());
     const std::string FormatedLiteralString =
         std::accumulate(
@@ -136,7 +142,8 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
             [](std::basic_string<char> S1, std::basic_string<char> S2) {
               return S1 + "\'" + S2;
             })
-            .erase(0, 1) + '.' + SecondReversedString;
+            .erase(0, 1) +
+        '.' + SecondReversedString;
 
     // Compare the original and formatted representation of a literal
     if (OriginalLiteralString != FormatedLiteralString) {

>From 6b933a90e10be7eb5cfb88e3f34b60a029a594fb Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Sun, 10 Dec 2023 13:18:13 +0300
Subject: [PATCH 16/76] Getting float value string

---
 .../clang-tidy/modernize/UseDigitSeparatorCheck.cpp  | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 965462fcdd76aa..80d02373357456 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -115,10 +115,14 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
             .str();
 
     // Get formatting literal text
-    std::string::size_type DotPosition = OriginalLiteralString.find('.');
-    std::string FirstSubString = OriginalLiteralString.substr(0, DotPosition);
-    std::string SecondSubString = OriginalLiteralString.substr(
-        DotPosition + 1, OriginalLiteralString.size());
+    const llvm::APFloat FloatValue = MatchedFloat->getValue();
+    llvm::SmallString<128> FloatString;
+    FloatValue.toString(FloatString);
+    const std::string SmallString = FloatString.str().str();
+    std::string::size_type DotPosition = SmallString.find('.');
+    std::string FirstSubString = SmallString.substr(0, DotPosition);
+    std::string SecondSubString = SmallString.substr(
+        DotPosition + 1, SmallString.size());
     std::reverse(SecondSubString.begin(), SecondSubString.end());
 
     std::vector<std::string> SplitedString = {FirstSubString, SecondSubString};

>From e66e18007c397148762c6bd966308e402c514682 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Sun, 10 Dec 2023 13:46:39 +0300
Subject: [PATCH 17/76] Some refactoring

---
 .../modernize/UseDigitSeparatorCheck.cpp      | 45 +++++++++++--------
 1 file changed, 26 insertions(+), 19 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 80d02373357456..3a5288cf5d168a 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -115,39 +115,46 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
             .str();
 
     // Get formatting literal text
+
+    // Get string representation of float value
     const llvm::APFloat FloatValue = MatchedFloat->getValue();
-    llvm::SmallString<128> FloatString;
-    FloatValue.toString(FloatString);
-    const std::string SmallString = FloatString.str().str();
-    std::string::size_type DotPosition = SmallString.find('.');
-    std::string FirstSubString = SmallString.substr(0, DotPosition);
-    std::string SecondSubString = SmallString.substr(
-        DotPosition + 1, SmallString.size());
-    std::reverse(SecondSubString.begin(), SecondSubString.end());
-
-    std::vector<std::string> SplitedString = {FirstSubString, SecondSubString};
-    std::vector<std::string> SplittedFloatLiteral0 =
-        splitStringByGroupSize(SplitedString[0], 3);
-    std::vector<std::string> SplittedFloatLiteral1 =
-        splitStringByGroupSize(SplitedString[1], 3);
-    std::string SecondReversedString =
+    llvm::SmallString<128> FloatSmallString;
+    FloatValue.toString(FloatSmallString);
+    const std::string FloatString = FloatSmallString.str().str();
+
+    // Get integer and fractional parts of float number
+    const std::string::size_type DotPosition = FloatString.find('.');
+    const std::string IntegerSubString = FloatString.substr(0, DotPosition);
+    std::string FractionalSubString = FloatString.substr(
+        DotPosition + 1, FloatString.size());
+
+    // Split integer and fractional parts of float number
+    std::reverse(FractionalSubString.begin(), FractionalSubString.end());
+    const std::vector<std::string> PartsOfFloat = {IntegerSubString, FractionalSubString};
+    const std::vector<std::string> SplittedIntegerSubString =
+        splitStringByGroupSize(PartsOfFloat[0], 3);
+    const std::vector<std::string> SplittedFractionalSubString =
+        splitStringByGroupSize(PartsOfFloat[1], 3);
+
+    // Get formatting literal text
+    std::string FormatedFractionalSubString =
         std::accumulate(
-            SplittedFloatLiteral1.begin(), SplittedFloatLiteral1.end(),
+            SplittedFractionalSubString.begin(), SplittedFractionalSubString.end(),
             std::string(""),
             [](std::basic_string<char> S1, std::basic_string<char> S2) {
               return S1 + "\'" + S2;
             })
             .erase(0, 1);
-    std::reverse(SecondReversedString.begin(), SecondReversedString.end());
+    std::reverse(FormatedFractionalSubString.begin(), FormatedFractionalSubString.end());
     const std::string FormatedLiteralString =
         std::accumulate(
-            SplittedFloatLiteral0.begin(), SplittedFloatLiteral0.end(),
+            SplittedIntegerSubString.begin(), SplittedIntegerSubString.end(),
             std::string(""),
             [](std::basic_string<char> S1, std::basic_string<char> S2) {
               return S1 + "\'" + S2;
             })
             .erase(0, 1) +
-        '.' + SecondReversedString;
+        '.' + FormatedFractionalSubString;
 
     // Compare the original and formatted representation of a literal
     if (OriginalLiteralString != FormatedLiteralString) {

>From 0092c076ba996be368cf886e3b08aa6cfbed01c4 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Sun, 10 Dec 2023 13:47:12 +0300
Subject: [PATCH 18/76] Formating

---
 .../modernize/UseDigitSeparatorCheck.cpp           | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 3a5288cf5d168a..d322d9869f0e05 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -125,12 +125,13 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
     // Get integer and fractional parts of float number
     const std::string::size_type DotPosition = FloatString.find('.');
     const std::string IntegerSubString = FloatString.substr(0, DotPosition);
-    std::string FractionalSubString = FloatString.substr(
-        DotPosition + 1, FloatString.size());
+    std::string FractionalSubString =
+        FloatString.substr(DotPosition + 1, FloatString.size());
 
     // Split integer and fractional parts of float number
     std::reverse(FractionalSubString.begin(), FractionalSubString.end());
-    const std::vector<std::string> PartsOfFloat = {IntegerSubString, FractionalSubString};
+    const std::vector<std::string> PartsOfFloat = {IntegerSubString,
+                                                   FractionalSubString};
     const std::vector<std::string> SplittedIntegerSubString =
         splitStringByGroupSize(PartsOfFloat[0], 3);
     const std::vector<std::string> SplittedFractionalSubString =
@@ -139,13 +140,14 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
     // Get formatting literal text
     std::string FormatedFractionalSubString =
         std::accumulate(
-            SplittedFractionalSubString.begin(), SplittedFractionalSubString.end(),
-            std::string(""),
+            SplittedFractionalSubString.begin(),
+            SplittedFractionalSubString.end(), std::string(""),
             [](std::basic_string<char> S1, std::basic_string<char> S2) {
               return S1 + "\'" + S2;
             })
             .erase(0, 1);
-    std::reverse(FormatedFractionalSubString.begin(), FormatedFractionalSubString.end());
+    std::reverse(FormatedFractionalSubString.begin(),
+                 FormatedFractionalSubString.end());
     const std::string FormatedLiteralString =
         std::accumulate(
             SplittedIntegerSubString.begin(), SplittedIntegerSubString.end(),

>From e7fddc9092a9d0f4c0dbce51b4249fb36288a2f9 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Sun, 10 Dec 2023 14:00:01 +0300
Subject: [PATCH 19/76] Support of format postfixes of floats

---
 .../modernize/UseDigitSeparatorCheck.cpp       | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index d322d9869f0e05..ff34f3b6d0d5d6 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -49,7 +49,7 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
 
   if (MatchedInteger != nullptr) {
     // Get original literal source text
-    const StringRef OriginalLiteralString = Lexer::getSourceText(
+    const llvm::StringRef OriginalLiteralString = Lexer::getSourceText(
         CharSourceRange::getTokenRange(MatchedInteger->getSourceRange()),
         Source, Context.getLangOpts());
 
@@ -108,11 +108,19 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
     }
   } else if (MatchedFloat != nullptr) {
     // Get original literal source text
-    const std::string OriginalLiteralString =
+    const llvm::StringRef OriginalLiteralString =
         Lexer::getSourceText(
             CharSourceRange::getTokenRange(MatchedFloat->getSourceRange()),
-            Source, Context.getLangOpts())
-            .str();
+            Source, Context.getLangOpts());
+
+    // Configure formatting
+    std::string Postfix;
+    if (OriginalLiteralString.ends_with("L") ||
+        OriginalLiteralString.ends_with("l") ||
+        OriginalLiteralString.ends_with("F") ||
+        OriginalLiteralString.ends_with("f")) {
+      Postfix = OriginalLiteralString.back();
+    }
 
     // Get formatting literal text
 
@@ -156,7 +164,7 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
               return S1 + "\'" + S2;
             })
             .erase(0, 1) +
-        '.' + FormatedFractionalSubString;
+        '.' + FormatedFractionalSubString + Postfix;
 
     // Compare the original and formatted representation of a literal
     if (OriginalLiteralString != FormatedLiteralString) {

>From e42ba55937dba7e8692fe0daf877318c50c553fd Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Sun, 10 Dec 2023 14:00:29 +0300
Subject: [PATCH 20/76] Formatting

---
 .../clang-tidy/modernize/UseDigitSeparatorCheck.cpp        | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index ff34f3b6d0d5d6..0ef53538d08b20 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -108,10 +108,9 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
     }
   } else if (MatchedFloat != nullptr) {
     // Get original literal source text
-    const llvm::StringRef OriginalLiteralString =
-        Lexer::getSourceText(
-            CharSourceRange::getTokenRange(MatchedFloat->getSourceRange()),
-            Source, Context.getLangOpts());
+    const llvm::StringRef OriginalLiteralString = Lexer::getSourceText(
+        CharSourceRange::getTokenRange(MatchedFloat->getSourceRange()), Source,
+        Context.getLangOpts());
 
     // Configure formatting
     std::string Postfix;

>From 28838f1092d462108d471b71e23b2e65886ec063 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Sun, 10 Dec 2023 21:34:42 +0300
Subject: [PATCH 21/76] Empty test

---
 .../checkers/modernize/use-digit-separator.cpp     | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp

diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
new file mode 100644
index 00000000000000..57bbc898706d6d
--- /dev/null
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
@@ -0,0 +1,14 @@
+// RUN: %check_clang_tidy %s modernize-use-digit-separator %t
+
+// FIXME: Add something that triggers the check here.
+void f();
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'f' is insufficiently awesome [modernize-use-digit-separator]
+
+// FIXME: Verify the applied fix.
+//   * Make the CHECK patterns specific enough and try to make verified lines
+//     unique to avoid incorrect matches.
+//   * Use {{}} for regular expressions.
+// CHECK-FIXES: {{^}}void awesome_f();{{$}}
+
+// FIXME: Add something that doesn't trigger the check here.
+void awesome_f2();

>From 9a9fa52f6b639e55f9d6fd65601d4a5994b5af9b Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Mon, 11 Dec 2023 19:01:14 +0300
Subject: [PATCH 22/76] Simple test

---
 .../checkers/modernize/use-digit-separator.cpp    | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
index 57bbc898706d6d..dc320837b9b437 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
@@ -1,14 +1,5 @@
 // RUN: %check_clang_tidy %s modernize-use-digit-separator %t
 
-// FIXME: Add something that triggers the check here.
-void f();
-// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'f' is insufficiently awesome [modernize-use-digit-separator]
-
-// FIXME: Verify the applied fix.
-//   * Make the CHECK patterns specific enough and try to make verified lines
-//     unique to avoid incorrect matches.
-//   * Use {{}} for regular expressions.
-// CHECK-FIXES: {{^}}void awesome_f();{{$}}
-
-// FIXME: Add something that doesn't trigger the check here.
-void awesome_f2();
+int NotFormattedInteger = 1234567;
+// CHECK-MESSAGES: :[[@LINE-1]]:27: warning: unformatted representation of integer literal '1234567' [modernize-use-digit-separator]
+// CHECK-FIXES: 1'234'567

>From 9ddfb123a62e0e1c36a972ee74fde12d46cf0114 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Tue, 12 Dec 2023 13:16:04 +0300
Subject: [PATCH 23/76] Add some tests

---
 .../modernize/use-digit-separator.cpp         | 32 +++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
index dc320837b9b437..d203b836224e80 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
@@ -3,3 +3,35 @@
 int NotFormattedInteger = 1234567;
 // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: unformatted representation of integer literal '1234567' [modernize-use-digit-separator]
 // CHECK-FIXES: 1'234'567
+
+int BinaryNotFormattedInteger = 0b11101101;
+// CHECK-MESSAGES: :[[@LINE-1]]:33: warning: unformatted representation of integer literal '0b11101101' [modernize-use-digit-separator]
+// CHECK-FIXES: 0b1110'1101
+
+int OctNotFormattedInteger = 037512;
+// CHECK-MESSAGES: :[[@LINE-1]]:30: warning: unformatted representation of integer literal '037512' [modernize-use-digit-separator]
+// CHECK-FIXES: 037'512
+
+int HexNotFormattedInteger = 0x4f356;
+// CHECK-MESSAGES: :[[@LINE-1]]:30: warning: unformatted representation of integer literal '0x4f356' [modernize-use-digit-separator]
+// CHECK-FIXES: 0x4'F356
+
+unsigned int UnsignedNotFormattedInteger = 10004U;
+// CHECK-MESSAGES: :[[@LINE-1]]:44: warning: unformatted representation of integer literal '10004U' [modernize-use-digit-separator]
+// CHECK-FIXES: 10'004U
+
+unsigned int UnsignedNotFormattedInteger1 = 100045u;
+// CHECK-MESSAGES: :[[@LINE-1]]:45: warning: unformatted representation of integer literal '100045u' [modernize-use-digit-separator]
+// CHECK-FIXES: 100'045u
+
+long LongNotFormattedInteger = 123456789101112L;
+// CHECK-MESSAGES: :[[@LINE-1]]:32: warning: unformatted representation of integer literal '123456789101112L' [modernize-use-digit-separator]
+// CHECK-FIXES: 123'456'789'101'112L
+
+long LongNotFormattedInteger1 = 12345678910111213l;
+// CHECK-MESSAGES: :[[@LINE-1]]:33: warning: unformatted representation of integer literal '12345678910111213l' [modernize-use-digit-separator]
+// CHECK-FIXES: 12'345'678'910'111'213l
+
+float NotFormattedFloat = 1234.56789;
+// CHECK-MESSAGES: :[[@LINE-1]]:27: warning: unformatted representation of integer literal '1234.56789' [modernize-use-digit-separator]
+// CHECK-FIXES: 1'234.567'89
\ No newline at end of file

>From 04e4091d0d027e4dcaa0bd4de9095efb95fe7d21 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Tue, 12 Dec 2023 18:10:41 +0300
Subject: [PATCH 24/76] Add tests with minus

---
 .../modernize/use-digit-separator.cpp         | 36 +++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
index d203b836224e80..c9f918ec9c5a56 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
@@ -4,34 +4,70 @@ int NotFormattedInteger = 1234567;
 // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: unformatted representation of integer literal '1234567' [modernize-use-digit-separator]
 // CHECK-FIXES: 1'234'567
 
+int MinusNotFormattedInteger = -1234567;
+// CHECK-MESSAGES: :[[@LINE-1]]:33: warning: unformatted representation of integer literal '1234567' [modernize-use-digit-separator]
+// CHECK-FIXES: 1'234'567
+
 int BinaryNotFormattedInteger = 0b11101101;
 // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: unformatted representation of integer literal '0b11101101' [modernize-use-digit-separator]
 // CHECK-FIXES: 0b1110'1101
 
+int MinusBinaryNotFormattedInteger = -0b11101101;
+// CHECK-MESSAGES: :[[@LINE-1]]:39: warning: unformatted representation of integer literal '0b11101101' [modernize-use-digit-separator]
+// CHECK-FIXES: 0b1110'1101
+
 int OctNotFormattedInteger = 037512;
 // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: unformatted representation of integer literal '037512' [modernize-use-digit-separator]
 // CHECK-FIXES: 037'512
 
+int MinusOctNotFormattedInteger = -037512;
+// CHECK-MESSAGES: :[[@LINE-1]]:36: warning: unformatted representation of integer literal '037512' [modernize-use-digit-separator]
+// CHECK-FIXES: 037'512
+
 int HexNotFormattedInteger = 0x4f356;
 // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: unformatted representation of integer literal '0x4f356' [modernize-use-digit-separator]
 // CHECK-FIXES: 0x4'F356
 
+int MinusHexNotFormattedInteger = -0x4f356;
+// CHECK-MESSAGES: :[[@LINE-1]]:36: warning: unformatted representation of integer literal '0x4f356' [modernize-use-digit-separator]
+// CHECK-FIXES: 0x4'F356
+
 unsigned int UnsignedNotFormattedInteger = 10004U;
 // CHECK-MESSAGES: :[[@LINE-1]]:44: warning: unformatted representation of integer literal '10004U' [modernize-use-digit-separator]
 // CHECK-FIXES: 10'004U
 
+unsigned int MinusUnsignedNotFormattedInteger = -10004U;
+// CHECK-MESSAGES: :[[@LINE-1]]:50: warning: unformatted representation of integer literal '10004U' [modernize-use-digit-separator]
+// CHECK-FIXES: 10'004U
+
 unsigned int UnsignedNotFormattedInteger1 = 100045u;
 // CHECK-MESSAGES: :[[@LINE-1]]:45: warning: unformatted representation of integer literal '100045u' [modernize-use-digit-separator]
 // CHECK-FIXES: 100'045u
 
+unsigned int MinusUnsignedNotFormattedInteger1 = -100045u;
+// CHECK-MESSAGES: :[[@LINE-1]]:51: warning: unformatted representation of integer literal '100045u' [modernize-use-digit-separator]
+// CHECK-FIXES: 100'045u
+
 long LongNotFormattedInteger = 123456789101112L;
 // CHECK-MESSAGES: :[[@LINE-1]]:32: warning: unformatted representation of integer literal '123456789101112L' [modernize-use-digit-separator]
 // CHECK-FIXES: 123'456'789'101'112L
 
+long MinusLongNotFormattedInteger = -123456789101112L;
+// CHECK-MESSAGES: :[[@LINE-1]]:38: warning: unformatted representation of integer literal '123456789101112L' [modernize-use-digit-separator]
+// CHECK-FIXES: 123'456'789'101'112L
+
 long LongNotFormattedInteger1 = 12345678910111213l;
 // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: unformatted representation of integer literal '12345678910111213l' [modernize-use-digit-separator]
 // CHECK-FIXES: 12'345'678'910'111'213l
 
+long MinusLongNotFormattedInteger1 = -12345678910111213l;
+// CHECK-MESSAGES: :[[@LINE-1]]:39: warning: unformatted representation of integer literal '12345678910111213l' [modernize-use-digit-separator]
+// CHECK-FIXES: 12'345'678'910'111'213l
+
 float NotFormattedFloat = 1234.56789;
 // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: unformatted representation of integer literal '1234.56789' [modernize-use-digit-separator]
+// CHECK-FIXES: 1'234.567'89
+
+float MinusNotFormattedFloat = -1234.56789;
+// CHECK-MESSAGES: :[[@LINE-1]]:33: warning: unformatted representation of integer literal '1234.56789' [modernize-use-digit-separator]
 // CHECK-FIXES: 1'234.567'89
\ No newline at end of file

>From 9152e1ef7bbd666b926e4a066d90ca9cda0ccda6 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Tue, 12 Dec 2023 19:15:01 +0300
Subject: [PATCH 25/76] Delete postfixes

---
 .../modernize/UseDigitSeparatorCheck.cpp      | 22 ++--------------
 .../modernize/use-digit-separator.cpp         | 25 ++++++++++++-------
 2 files changed, 18 insertions(+), 29 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 0ef53538d08b20..304973efa60972 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -57,7 +57,6 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
     unsigned int Radix;
     size_t GroupSize;
     std::string Prefix;
-    std::string Postfix;
     if (OriginalLiteralString.starts_with("0b")) {
       Radix = 2;
       GroupSize = 4;
@@ -76,13 +75,6 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
       GroupSize = 3;
     }
 
-    if (OriginalLiteralString.ends_with("L") ||
-        OriginalLiteralString.ends_with("l") ||
-        OriginalLiteralString.ends_with("U") ||
-        OriginalLiteralString.ends_with("u")) {
-      Postfix = OriginalLiteralString.back();
-    }
-
     // Get formatting literal text
     const llvm::APInt IntegerValue = MatchedInteger->getValue();
     const std::vector<std::string> SplittedIntegerLiteral =
@@ -95,8 +87,7 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
             [](std::basic_string<char> S1, std::basic_string<char> S2) {
               return S1 + "\'" + S2;
             })
-            .erase(0, 1) +
-        Postfix;
+            .erase(0, 1);
 
     // Compare the original and formatted representation of a literal
     if (OriginalLiteralString != FormatedLiteralString) {
@@ -112,15 +103,6 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
         CharSourceRange::getTokenRange(MatchedFloat->getSourceRange()), Source,
         Context.getLangOpts());
 
-    // Configure formatting
-    std::string Postfix;
-    if (OriginalLiteralString.ends_with("L") ||
-        OriginalLiteralString.ends_with("l") ||
-        OriginalLiteralString.ends_with("F") ||
-        OriginalLiteralString.ends_with("f")) {
-      Postfix = OriginalLiteralString.back();
-    }
-
     // Get formatting literal text
 
     // Get string representation of float value
@@ -163,7 +145,7 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
               return S1 + "\'" + S2;
             })
             .erase(0, 1) +
-        '.' + FormatedFractionalSubString + Postfix;
+        '.' + FormatedFractionalSubString;
 
     // Compare the original and formatted representation of a literal
     if (OriginalLiteralString != FormatedLiteralString) {
diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
index c9f918ec9c5a56..fe2102786dc15f 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
@@ -34,35 +34,35 @@ int MinusHexNotFormattedInteger = -0x4f356;
 
 unsigned int UnsignedNotFormattedInteger = 10004U;
 // CHECK-MESSAGES: :[[@LINE-1]]:44: warning: unformatted representation of integer literal '10004U' [modernize-use-digit-separator]
-// CHECK-FIXES: 10'004U
+// CHECK-FIXES: 10'004
 
 unsigned int MinusUnsignedNotFormattedInteger = -10004U;
 // CHECK-MESSAGES: :[[@LINE-1]]:50: warning: unformatted representation of integer literal '10004U' [modernize-use-digit-separator]
-// CHECK-FIXES: 10'004U
+// CHECK-FIXES: 10'004
 
 unsigned int UnsignedNotFormattedInteger1 = 100045u;
 // CHECK-MESSAGES: :[[@LINE-1]]:45: warning: unformatted representation of integer literal '100045u' [modernize-use-digit-separator]
-// CHECK-FIXES: 100'045u
+// CHECK-FIXES: 100'045
 
 unsigned int MinusUnsignedNotFormattedInteger1 = -100045u;
 // CHECK-MESSAGES: :[[@LINE-1]]:51: warning: unformatted representation of integer literal '100045u' [modernize-use-digit-separator]
-// CHECK-FIXES: 100'045u
+// CHECK-FIXES: 100'045
 
 long LongNotFormattedInteger = 123456789101112L;
 // CHECK-MESSAGES: :[[@LINE-1]]:32: warning: unformatted representation of integer literal '123456789101112L' [modernize-use-digit-separator]
-// CHECK-FIXES: 123'456'789'101'112L
+// CHECK-FIXES: 123'456'789'101'112
 
 long MinusLongNotFormattedInteger = -123456789101112L;
 // CHECK-MESSAGES: :[[@LINE-1]]:38: warning: unformatted representation of integer literal '123456789101112L' [modernize-use-digit-separator]
-// CHECK-FIXES: 123'456'789'101'112L
+// CHECK-FIXES: 123'456'789'101'112
 
 long LongNotFormattedInteger1 = 12345678910111213l;
 // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: unformatted representation of integer literal '12345678910111213l' [modernize-use-digit-separator]
-// CHECK-FIXES: 12'345'678'910'111'213l
+// CHECK-FIXES: 12'345'678'910'111'213
 
 long MinusLongNotFormattedInteger1 = -12345678910111213l;
 // CHECK-MESSAGES: :[[@LINE-1]]:39: warning: unformatted representation of integer literal '12345678910111213l' [modernize-use-digit-separator]
-// CHECK-FIXES: 12'345'678'910'111'213l
+// CHECK-FIXES: 12'345'678'910'111'213
 
 float NotFormattedFloat = 1234.56789;
 // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: unformatted representation of integer literal '1234.56789' [modernize-use-digit-separator]
@@ -70,4 +70,11 @@ float NotFormattedFloat = 1234.56789;
 
 float MinusNotFormattedFloat = -1234.56789;
 // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: unformatted representation of integer literal '1234.56789' [modernize-use-digit-separator]
-// CHECK-FIXES: 1'234.567'89
\ No newline at end of file
+// CHECK-FIXES: 1'234.567'89
+
+// FIXME:
+// error: expected ';' after top level declarator [clang-diagnostic-error]
+//   80 | int FormattedInteger = 1'234'567;
+//      |                         ^
+//      |                         ;
+//int FormattedInteger = 1'234'567;
\ No newline at end of file

>From e175e702b6fc456cd22c4714e2ad28aa9b1c51e4 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Thu, 14 Dec 2023 15:56:52 +0300
Subject: [PATCH 26/76] Return postfixes

---
 .../modernize/UseDigitSeparatorCheck.cpp      | 21 +++++++++++++++++--
 .../modernize/use-digit-separator.cpp         | 16 +++++++-------
 2 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 304973efa60972..4a91975f934d4e 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -57,6 +57,7 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
     unsigned int Radix;
     size_t GroupSize;
     std::string Prefix;
+    std::string Postfix;
     if (OriginalLiteralString.starts_with("0b")) {
       Radix = 2;
       GroupSize = 4;
@@ -75,6 +76,13 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
       GroupSize = 3;
     }
 
+    if (OriginalLiteralString.ends_with("L") ||
+        OriginalLiteralString.ends_with("l") ||
+        OriginalLiteralString.ends_with("U") ||
+        OriginalLiteralString.ends_with("u")) {
+      Postfix = OriginalLiteralString.back();
+    }
+
     // Get formatting literal text
     const llvm::APInt IntegerValue = MatchedInteger->getValue();
     const std::vector<std::string> SplittedIntegerLiteral =
@@ -87,7 +95,7 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
             [](std::basic_string<char> S1, std::basic_string<char> S2) {
               return S1 + "\'" + S2;
             })
-            .erase(0, 1);
+            .erase(0, 1) + Postfix;
 
     // Compare the original and formatted representation of a literal
     if (OriginalLiteralString != FormatedLiteralString) {
@@ -103,6 +111,15 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
         CharSourceRange::getTokenRange(MatchedFloat->getSourceRange()), Source,
         Context.getLangOpts());
 
+    // Configure formatting
+    std::string Postfix;
+    if (OriginalLiteralString.ends_with("L") ||
+        OriginalLiteralString.ends_with("l") ||
+        OriginalLiteralString.ends_with("F") ||
+        OriginalLiteralString.ends_with("f")) {
+      Postfix = OriginalLiteralString.back();
+    }
+
     // Get formatting literal text
 
     // Get string representation of float value
@@ -145,7 +162,7 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
               return S1 + "\'" + S2;
             })
             .erase(0, 1) +
-        '.' + FormatedFractionalSubString;
+        '.' + FormatedFractionalSubString + Postfix;
 
     // Compare the original and formatted representation of a literal
     if (OriginalLiteralString != FormatedLiteralString) {
diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
index fe2102786dc15f..f572e10a1c6189 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
@@ -34,35 +34,35 @@ int MinusHexNotFormattedInteger = -0x4f356;
 
 unsigned int UnsignedNotFormattedInteger = 10004U;
 // CHECK-MESSAGES: :[[@LINE-1]]:44: warning: unformatted representation of integer literal '10004U' [modernize-use-digit-separator]
-// CHECK-FIXES: 10'004
+// CHECK-FIXES: 10'004U
 
 unsigned int MinusUnsignedNotFormattedInteger = -10004U;
 // CHECK-MESSAGES: :[[@LINE-1]]:50: warning: unformatted representation of integer literal '10004U' [modernize-use-digit-separator]
-// CHECK-FIXES: 10'004
+// CHECK-FIXES: 10'004U
 
 unsigned int UnsignedNotFormattedInteger1 = 100045u;
 // CHECK-MESSAGES: :[[@LINE-1]]:45: warning: unformatted representation of integer literal '100045u' [modernize-use-digit-separator]
-// CHECK-FIXES: 100'045
+// CHECK-FIXES: 100'045u
 
 unsigned int MinusUnsignedNotFormattedInteger1 = -100045u;
 // CHECK-MESSAGES: :[[@LINE-1]]:51: warning: unformatted representation of integer literal '100045u' [modernize-use-digit-separator]
-// CHECK-FIXES: 100'045
+// CHECK-FIXES: 100'045u
 
 long LongNotFormattedInteger = 123456789101112L;
 // CHECK-MESSAGES: :[[@LINE-1]]:32: warning: unformatted representation of integer literal '123456789101112L' [modernize-use-digit-separator]
-// CHECK-FIXES: 123'456'789'101'112
+// CHECK-FIXES: 123'456'789'101'112L
 
 long MinusLongNotFormattedInteger = -123456789101112L;
 // CHECK-MESSAGES: :[[@LINE-1]]:38: warning: unformatted representation of integer literal '123456789101112L' [modernize-use-digit-separator]
-// CHECK-FIXES: 123'456'789'101'112
+// CHECK-FIXES: 123'456'789'101'112L
 
 long LongNotFormattedInteger1 = 12345678910111213l;
 // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: unformatted representation of integer literal '12345678910111213l' [modernize-use-digit-separator]
-// CHECK-FIXES: 12'345'678'910'111'213
+// CHECK-FIXES: 12'345'678'910'111'213l
 
 long MinusLongNotFormattedInteger1 = -12345678910111213l;
 // CHECK-MESSAGES: :[[@LINE-1]]:39: warning: unformatted representation of integer literal '12345678910111213l' [modernize-use-digit-separator]
-// CHECK-FIXES: 12'345'678'910'111'213
+// CHECK-FIXES: 12'345'678'910'111'213l
 
 float NotFormattedFloat = 1234.56789;
 // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: unformatted representation of integer literal '1234.56789' [modernize-use-digit-separator]

>From c840c98097c99a9df2365469ad70b473d1b5af8b Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Thu, 14 Dec 2023 16:31:01 +0300
Subject: [PATCH 27/76] Support long postfixes

---
 .../modernize/UseDigitSeparatorCheck.cpp       | 18 ++++++++----------
 .../checkers/modernize/use-digit-separator.cpp |  8 ++++++++
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 4a91975f934d4e..8c01bad65c6927 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -76,11 +76,10 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
       GroupSize = 3;
     }
 
-    if (OriginalLiteralString.ends_with("L") ||
-        OriginalLiteralString.ends_with("l") ||
-        OriginalLiteralString.ends_with("U") ||
-        OriginalLiteralString.ends_with("u")) {
-      Postfix = OriginalLiteralString.back();
+    for (const char& Character : OriginalLiteralString) {
+      if (!std::isdigit(Character)) {
+        Postfix += Character;
+      }
     }
 
     // Get formatting literal text
@@ -113,11 +112,10 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
 
     // Configure formatting
     std::string Postfix;
-    if (OriginalLiteralString.ends_with("L") ||
-        OriginalLiteralString.ends_with("l") ||
-        OriginalLiteralString.ends_with("F") ||
-        OriginalLiteralString.ends_with("f")) {
-      Postfix = OriginalLiteralString.back();
+    for (const char& Character : OriginalLiteralString) {
+      if (!std::isdigit(Character) && Character != '.') {
+        Postfix += Character;
+      }
     }
 
     // Get formatting literal text
diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
index f572e10a1c6189..31aa3f6d5476be 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
@@ -64,6 +64,14 @@ long MinusLongNotFormattedInteger1 = -12345678910111213l;
 // CHECK-MESSAGES: :[[@LINE-1]]:39: warning: unformatted representation of integer literal '12345678910111213l' [modernize-use-digit-separator]
 // CHECK-FIXES: 12'345'678'910'111'213l
 
+unsigned long UnsignedLongNotFormattedInteger1 = 12345678910111213Ul;
+// CHECK-MESSAGES: :[[@LINE-1]]:50: warning: unformatted representation of integer literal '12345678910111213Ul' [modernize-use-digit-separator]
+// CHECK-FIXES: 12'345'678'910'111'213Ul
+
+unsigned long MinusUnsignedLongNotFormattedInteger1 = -12345678910111213Ul;
+// CHECK-MESSAGES: :[[@LINE-1]]:56: warning: unformatted representation of integer literal '12345678910111213Ul' [modernize-use-digit-separator]
+// CHECK-FIXES: 12'345'678'910'111'213Ul
+
 float NotFormattedFloat = 1234.56789;
 // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: unformatted representation of integer literal '1234.56789' [modernize-use-digit-separator]
 // CHECK-FIXES: 1'234.567'89

>From 43f53c54686894b0b0e42a8518f69be3a1da49e5 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Thu, 14 Dec 2023 16:33:36 +0300
Subject: [PATCH 28/76] Format

---
 .../clang-tidy/modernize/UseDigitSeparatorCheck.cpp           | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 8c01bad65c6927..5a0e5958fd2aea 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -76,7 +76,7 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
       GroupSize = 3;
     }
 
-    for (const char& Character : OriginalLiteralString) {
+    for (const char &Character : OriginalLiteralString) {
       if (!std::isdigit(Character)) {
         Postfix += Character;
       }
@@ -112,7 +112,7 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
 
     // Configure formatting
     std::string Postfix;
-    for (const char& Character : OriginalLiteralString) {
+    for (const char &Character : OriginalLiteralString) {
       if (!std::isdigit(Character) && Character != '.') {
         Postfix += Character;
       }

>From 977e689a251b957647d6c8c090f85a8e68d81f06 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Thu, 14 Dec 2023 16:56:35 +0300
Subject: [PATCH 29/76] Using getFormatedLiteralString

---
 .../modernize/UseDigitSeparatorCheck.cpp      | 87 ++++++++++---------
 1 file changed, 47 insertions(+), 40 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 5a0e5958fd2aea..e15359d58d9700 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -32,6 +32,52 @@ splitStringByGroupSize(const std::basic_string<char> &String, size_t GroupSize)
 
   return Result;
 }
+
+std::string getFormatedLiteralString(const llvm::StringRef OriginalLiteralString, const llvm::APInt IntegerValue) {
+  // Configure formatting
+  unsigned int Radix;
+  size_t GroupSize;
+  std::string Prefix;
+  std::string Postfix;
+  if (OriginalLiteralString.starts_with("0b")) {
+    Radix = 2;
+    GroupSize = 4;
+    Prefix = "0b";
+  } else if (OriginalLiteralString.starts_with("0x")) {
+    Radix = 16;
+    GroupSize = 4;
+    Prefix = "0x";
+  } else if (OriginalLiteralString.starts_with("0") &&
+             OriginalLiteralString != "0") {
+    Radix = 8;
+    GroupSize = 3;
+    Prefix = "0";
+  } else {
+    Radix = 10;
+    GroupSize = 3;
+  }
+
+  for (const char &Character : OriginalLiteralString) {
+    if (!std::isdigit(Character)) {
+      Postfix += Character;
+    }
+  }
+
+  // Get formatting literal text
+  const std::vector<std::string> SplittedIntegerLiteral =
+      splitStringByGroupSize(toString(IntegerValue, Radix, true), GroupSize);
+  const std::string FormatedLiteralString =
+      Prefix +
+      std::accumulate(
+          SplittedIntegerLiteral.begin(), SplittedIntegerLiteral.end(),
+          std::string(""),
+          [](std::basic_string<char> S1, std::basic_string<char> S2) {
+            return S1 + "\'" + S2;
+          })
+          .erase(0, 1) + Postfix;
+
+  return FormatedLiteralString;
+}
 } // namespace
 
 namespace clang::tidy::modernize {
@@ -53,48 +99,9 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
         CharSourceRange::getTokenRange(MatchedInteger->getSourceRange()),
         Source, Context.getLangOpts());
 
-    // Configure formatting
-    unsigned int Radix;
-    size_t GroupSize;
-    std::string Prefix;
-    std::string Postfix;
-    if (OriginalLiteralString.starts_with("0b")) {
-      Radix = 2;
-      GroupSize = 4;
-      Prefix = "0b";
-    } else if (OriginalLiteralString.starts_with("0x")) {
-      Radix = 16;
-      GroupSize = 4;
-      Prefix = "0x";
-    } else if (OriginalLiteralString.starts_with("0") &&
-               OriginalLiteralString != "0") {
-      Radix = 8;
-      GroupSize = 3;
-      Prefix = "0";
-    } else {
-      Radix = 10;
-      GroupSize = 3;
-    }
-
-    for (const char &Character : OriginalLiteralString) {
-      if (!std::isdigit(Character)) {
-        Postfix += Character;
-      }
-    }
-
     // Get formatting literal text
     const llvm::APInt IntegerValue = MatchedInteger->getValue();
-    const std::vector<std::string> SplittedIntegerLiteral =
-        splitStringByGroupSize(toString(IntegerValue, Radix, true), GroupSize);
-    const std::string FormatedLiteralString =
-        Prefix +
-        std::accumulate(
-            SplittedIntegerLiteral.begin(), SplittedIntegerLiteral.end(),
-            std::string(""),
-            [](std::basic_string<char> S1, std::basic_string<char> S2) {
-              return S1 + "\'" + S2;
-            })
-            .erase(0, 1) + Postfix;
+    const std::string FormatedLiteralString = getFormatedLiteralString(OriginalLiteralString, IntegerValue);
 
     // Compare the original and formatted representation of a literal
     if (OriginalLiteralString != FormatedLiteralString) {

>From 68d0707cccd8b65d45d215a17be34158e035c076 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Thu, 14 Dec 2023 17:01:39 +0300
Subject: [PATCH 30/76] Renaming

---
 .../clang-tidy/modernize/UseDigitSeparatorCheck.cpp           | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index e15359d58d9700..e3cd4e75f8bc69 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -33,7 +33,7 @@ splitStringByGroupSize(const std::basic_string<char> &String, size_t GroupSize)
   return Result;
 }
 
-std::string getFormatedLiteralString(const llvm::StringRef OriginalLiteralString, const llvm::APInt IntegerValue) {
+std::string getFormatedIntegerString(const llvm::StringRef OriginalLiteralString, const llvm::APInt IntegerValue) {
   // Configure formatting
   unsigned int Radix;
   size_t GroupSize;
@@ -101,7 +101,7 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
 
     // Get formatting literal text
     const llvm::APInt IntegerValue = MatchedInteger->getValue();
-    const std::string FormatedLiteralString = getFormatedLiteralString(OriginalLiteralString, IntegerValue);
+    const std::string FormatedLiteralString = getFormatedIntegerString(OriginalLiteralString, IntegerValue);
 
     // Compare the original and formatted representation of a literal
     if (OriginalLiteralString != FormatedLiteralString) {

>From a7064ec660c55ba915042494050ab7d4fc5a8798 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Fri, 15 Dec 2023 12:53:29 +0300
Subject: [PATCH 31/76] Create getFormatedFloatString

---
 .../modernize/UseDigitSeparatorCheck.cpp      | 106 +++++++++---------
 1 file changed, 56 insertions(+), 50 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index e3cd4e75f8bc69..53c41d61e4a0a0 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -58,7 +58,7 @@ std::string getFormatedIntegerString(const llvm::StringRef OriginalLiteralString
   }
 
   for (const char &Character : OriginalLiteralString) {
-    if (!std::isdigit(Character)) {
+    if (!std::isdigit(Character) && Character != '\'') {
       Postfix += Character;
     }
   }
@@ -78,6 +78,60 @@ std::string getFormatedIntegerString(const llvm::StringRef OriginalLiteralString
 
   return FormatedLiteralString;
 }
+
+std::string getFormatedFloatString(const llvm::StringRef OriginalLiteralString, const llvm::APFloat FloatValue) {
+  // Configure formatting
+  std::string Postfix;
+  for (const char &Character : OriginalLiteralString) {
+    if (!std::isdigit(Character) && Character != '.' && Character != '\'') {
+      Postfix += Character;
+    }
+  }
+
+  // Get formatting literal text
+
+  // Get string representation of float value
+  llvm::SmallString<128> FloatSmallString;
+  FloatValue.toString(FloatSmallString);
+  const std::string FloatString = FloatSmallString.str().str();
+
+  // Get integer and fractional parts of float number
+  const std::string::size_type DotPosition = FloatString.find('.');
+  const std::string IntegerSubString = FloatString.substr(0, DotPosition);
+  std::string FractionalSubString =
+      FloatString.substr(DotPosition + 1, FloatString.size());
+
+  // Split integer and fractional parts of float number
+  std::reverse(FractionalSubString.begin(), FractionalSubString.end());
+  const std::vector<std::string> PartsOfFloat = {IntegerSubString,
+                                                 FractionalSubString};
+  const std::vector<std::string> SplittedIntegerSubString =
+      splitStringByGroupSize(PartsOfFloat[0], 3);
+  const std::vector<std::string> SplittedFractionalSubString =
+      splitStringByGroupSize(PartsOfFloat[1], 3);
+
+  // Get formatting literal text
+  std::string FormatedFractionalSubString =
+      std::accumulate(
+          SplittedFractionalSubString.begin(),
+          SplittedFractionalSubString.end(), std::string(""),
+          [](std::basic_string<char> S1, std::basic_string<char> S2) {
+            return S1 + "\'" + S2;
+          }).erase(0, 1);
+  std::reverse(FormatedFractionalSubString.begin(),
+               FormatedFractionalSubString.end());
+  const std::string FormatedLiteralString =
+      std::accumulate(
+          SplittedIntegerSubString.begin(), SplittedIntegerSubString.end(),
+          std::string(""),
+          [](std::basic_string<char> S1, std::basic_string<char> S2) {
+            return S1 + "\'" + S2;
+          })
+          .erase(0, 1) +
+      '.' + FormatedFractionalSubString + Postfix;
+
+  return FormatedLiteralString;
+}
 } // namespace
 
 namespace clang::tidy::modernize {
@@ -117,57 +171,9 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
         CharSourceRange::getTokenRange(MatchedFloat->getSourceRange()), Source,
         Context.getLangOpts());
 
-    // Configure formatting
-    std::string Postfix;
-    for (const char &Character : OriginalLiteralString) {
-      if (!std::isdigit(Character) && Character != '.') {
-        Postfix += Character;
-      }
-    }
-
     // Get formatting literal text
-
-    // Get string representation of float value
     const llvm::APFloat FloatValue = MatchedFloat->getValue();
-    llvm::SmallString<128> FloatSmallString;
-    FloatValue.toString(FloatSmallString);
-    const std::string FloatString = FloatSmallString.str().str();
-
-    // Get integer and fractional parts of float number
-    const std::string::size_type DotPosition = FloatString.find('.');
-    const std::string IntegerSubString = FloatString.substr(0, DotPosition);
-    std::string FractionalSubString =
-        FloatString.substr(DotPosition + 1, FloatString.size());
-
-    // Split integer and fractional parts of float number
-    std::reverse(FractionalSubString.begin(), FractionalSubString.end());
-    const std::vector<std::string> PartsOfFloat = {IntegerSubString,
-                                                   FractionalSubString};
-    const std::vector<std::string> SplittedIntegerSubString =
-        splitStringByGroupSize(PartsOfFloat[0], 3);
-    const std::vector<std::string> SplittedFractionalSubString =
-        splitStringByGroupSize(PartsOfFloat[1], 3);
-
-    // Get formatting literal text
-    std::string FormatedFractionalSubString =
-        std::accumulate(
-            SplittedFractionalSubString.begin(),
-            SplittedFractionalSubString.end(), std::string(""),
-            [](std::basic_string<char> S1, std::basic_string<char> S2) {
-              return S1 + "\'" + S2;
-            })
-            .erase(0, 1);
-    std::reverse(FormatedFractionalSubString.begin(),
-                 FormatedFractionalSubString.end());
-    const std::string FormatedLiteralString =
-        std::accumulate(
-            SplittedIntegerSubString.begin(), SplittedIntegerSubString.end(),
-            std::string(""),
-            [](std::basic_string<char> S1, std::basic_string<char> S2) {
-              return S1 + "\'" + S2;
-            })
-            .erase(0, 1) +
-        '.' + FormatedFractionalSubString + Postfix;
+    const std::string FormatedLiteralString = getFormatedFloatString(OriginalLiteralString, FloatValue);
 
     // Compare the original and formatted representation of a literal
     if (OriginalLiteralString != FormatedLiteralString) {

>From 9edf9f5aac914d42a9c362ae8ef0b093d725584d Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Fri, 15 Dec 2023 13:13:51 +0300
Subject: [PATCH 32/76] Refactor getFormatedFloatString

---
 .../modernize/UseDigitSeparatorCheck.cpp      | 28 +++----------------
 1 file changed, 4 insertions(+), 24 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 53c41d61e4a0a0..64e58d580aa26e 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -100,35 +100,15 @@ std::string getFormatedFloatString(const llvm::StringRef OriginalLiteralString,
   const std::string IntegerSubString = FloatString.substr(0, DotPosition);
   std::string FractionalSubString =
       FloatString.substr(DotPosition + 1, FloatString.size());
-
-  // Split integer and fractional parts of float number
   std::reverse(FractionalSubString.begin(), FractionalSubString.end());
-  const std::vector<std::string> PartsOfFloat = {IntegerSubString,
-                                                 FractionalSubString};
-  const std::vector<std::string> SplittedIntegerSubString =
-      splitStringByGroupSize(PartsOfFloat[0], 3);
-  const std::vector<std::string> SplittedFractionalSubString =
-      splitStringByGroupSize(PartsOfFloat[1], 3);
 
   // Get formatting literal text
-  std::string FormatedFractionalSubString =
-      std::accumulate(
-          SplittedFractionalSubString.begin(),
-          SplittedFractionalSubString.end(), std::string(""),
-          [](std::basic_string<char> S1, std::basic_string<char> S2) {
-            return S1 + "\'" + S2;
-          }).erase(0, 1);
+  const std::string FormatedIntegerSubString = getFormatedIntegerString(IntegerSubString, llvm::APInt(128, std::stoi(IntegerSubString)));
+  std::string FormatedFractionalSubString = getFormatedIntegerString(FractionalSubString, llvm::APInt(128, std::stoi(FractionalSubString)));
   std::reverse(FormatedFractionalSubString.begin(),
                FormatedFractionalSubString.end());
-  const std::string FormatedLiteralString =
-      std::accumulate(
-          SplittedIntegerSubString.begin(), SplittedIntegerSubString.end(),
-          std::string(""),
-          [](std::basic_string<char> S1, std::basic_string<char> S2) {
-            return S1 + "\'" + S2;
-          })
-          .erase(0, 1) +
-      '.' + FormatedFractionalSubString + Postfix;
+
+  const std::string FormatedLiteralString = FormatedIntegerSubString + '.' + FormatedFractionalSubString + Postfix;
 
   return FormatedLiteralString;
 }

>From 5b4460b0ed15b01bbaa8093ee8eac49fb294b418 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Fri, 15 Dec 2023 13:14:21 +0300
Subject: [PATCH 33/76] Formating

---
 .../clang-tidy/modernize/UseDigitSeparatorCheck.cpp      | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 64e58d580aa26e..f22bbd36d2ed83 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -103,12 +103,15 @@ std::string getFormatedFloatString(const llvm::StringRef OriginalLiteralString,
   std::reverse(FractionalSubString.begin(), FractionalSubString.end());
 
   // Get formatting literal text
-  const std::string FormatedIntegerSubString = getFormatedIntegerString(IntegerSubString, llvm::APInt(128, std::stoi(IntegerSubString)));
-  std::string FormatedFractionalSubString = getFormatedIntegerString(FractionalSubString, llvm::APInt(128, std::stoi(FractionalSubString)));
+  const std::string FormatedIntegerSubString = getFormatedIntegerString(
+      IntegerSubString, llvm::APInt(128, std::stoi(IntegerSubString)));
+  std::string FormatedFractionalSubString = getFormatedIntegerString(
+      FractionalSubString, llvm::APInt(128, std::stoi(FractionalSubString)));
   std::reverse(FormatedFractionalSubString.begin(),
                FormatedFractionalSubString.end());
 
-  const std::string FormatedLiteralString = FormatedIntegerSubString + '.' + FormatedFractionalSubString + Postfix;
+  const std::string FormatedLiteralString =
+      FormatedIntegerSubString + '.' + FormatedFractionalSubString + Postfix;
 
   return FormatedLiteralString;
 }

>From d59adac840319ff2c7667fb25ccabf15af1f650f Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Mon, 18 Dec 2023 17:45:00 +0300
Subject: [PATCH 34/76] Add precision calculating

---
 .../modernize/UseDigitSeparatorCheck.cpp      | 22 ++++++++++++++-----
 .../modernize/use-digit-separator.cpp         |  4 ++++
 2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index f22bbd36d2ed83..61379f630b2c46 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 #include <algorithm>
+#include <iomanip>
 #include <numeric>
 #include <regex>
 
@@ -14,6 +15,7 @@
 #include "clang/AST/ASTContext.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
 #include "clang/Lex/Lexer.h"
+#include "llvm/Support/FormatVariadic.h"
 
 using namespace clang::ast_matchers;
 
@@ -88,12 +90,22 @@ std::string getFormatedFloatString(const llvm::StringRef OriginalLiteralString,
     }
   }
 
+  // Get precision
+  const std::string::size_type OriginalDotPosition = OriginalLiteralString.find('.');
+  const llvm::StringRef OriginalFractionalSubString = OriginalLiteralString.substr(OriginalDotPosition + 1, OriginalLiteralString.size());
+  int Precision = 0;
+  for (const char &Character : OriginalFractionalSubString) {
+    if (std::isdigit(Character)) {
+      Precision++;
+    }
+  }
+
   // Get formatting literal text
 
   // Get string representation of float value
-  llvm::SmallString<128> FloatSmallString;
-  FloatValue.toString(FloatSmallString);
-  const std::string FloatString = FloatSmallString.str().str();
+  std::ostringstream StringStream;
+  StringStream << std::fixed << std::setprecision(Precision) << FloatValue.convertToDouble();
+  const std::string FloatString = StringStream.str();
 
   // Get integer and fractional parts of float number
   const std::string::size_type DotPosition = FloatString.find('.');
@@ -104,9 +116,9 @@ std::string getFormatedFloatString(const llvm::StringRef OriginalLiteralString,
 
   // Get formatting literal text
   const std::string FormatedIntegerSubString = getFormatedIntegerString(
-      IntegerSubString, llvm::APInt(128, std::stoi(IntegerSubString)));
+      IntegerSubString, llvm::APInt(128, std::stoll(IntegerSubString)));
   std::string FormatedFractionalSubString = getFormatedIntegerString(
-      FractionalSubString, llvm::APInt(128, std::stoi(FractionalSubString)));
+      FractionalSubString, llvm::APInt(128, std::stoll(FractionalSubString)));
   std::reverse(FormatedFractionalSubString.begin(),
                FormatedFractionalSubString.end());
 
diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
index 31aa3f6d5476be..c735bd2a4ac9fd 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
@@ -80,6 +80,10 @@ float MinusNotFormattedFloat = -1234.56789;
 // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: unformatted representation of integer literal '1234.56789' [modernize-use-digit-separator]
 // CHECK-FIXES: 1'234.567'89
 
+double PostfixNotFormattedFloat = 1234.569F;
+// CHECK-MESSAGES: :[[@LINE-1]]:35: warning: unformatted representation of integer literal '1234.569F' [modernize-use-digit-separator]
+// CHECK-FIXES: 1'234.569F
+
 // FIXME:
 // error: expected ';' after top level declarator [clang-diagnostic-error]
 //   80 | int FormattedInteger = 1'234'567;

>From 15627d1edc96c3a18d137e9a7f182a191c6089b4 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Mon, 18 Dec 2023 17:45:46 +0300
Subject: [PATCH 35/76] Formating

---
 .../clang-tidy/modernize/UseDigitSeparatorCheck.cpp    | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 61379f630b2c46..438d2634095469 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -91,8 +91,11 @@ std::string getFormatedFloatString(const llvm::StringRef OriginalLiteralString,
   }
 
   // Get precision
-  const std::string::size_type OriginalDotPosition = OriginalLiteralString.find('.');
-  const llvm::StringRef OriginalFractionalSubString = OriginalLiteralString.substr(OriginalDotPosition + 1, OriginalLiteralString.size());
+  const std::string::size_type OriginalDotPosition =
+      OriginalLiteralString.find('.');
+  const llvm::StringRef OriginalFractionalSubString =
+      OriginalLiteralString.substr(OriginalDotPosition + 1,
+                                   OriginalLiteralString.size());
   int Precision = 0;
   for (const char &Character : OriginalFractionalSubString) {
     if (std::isdigit(Character)) {
@@ -104,7 +107,8 @@ std::string getFormatedFloatString(const llvm::StringRef OriginalLiteralString,
 
   // Get string representation of float value
   std::ostringstream StringStream;
-  StringStream << std::fixed << std::setprecision(Precision) << FloatValue.convertToDouble();
+  StringStream << std::fixed << std::setprecision(Precision)
+               << FloatValue.convertToDouble();
   const std::string FloatString = StringStream.str();
 
   // Get integer and fractional parts of float number

>From ba22e57d875afae6d2a0f0beddb71e993ca97624 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Mon, 18 Dec 2023 19:03:06 +0300
Subject: [PATCH 36/76] Scientific form of literal support

---
 .../clang-tidy/modernize/UseDigitSeparatorCheck.cpp | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 438d2634095469..1cb217b112ca34 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -82,6 +82,19 @@ std::string getFormatedIntegerString(const llvm::StringRef OriginalLiteralString
 }
 
 std::string getFormatedFloatString(const llvm::StringRef OriginalLiteralString, const llvm::APFloat FloatValue) {
+  if (OriginalLiteralString.contains('E') || OriginalLiteralString.contains('e')) {
+    // Split string to mantissa and exponent
+    const std::string::size_type EPosition = OriginalLiteralString.str().find('E') != std::string::npos ? OriginalLiteralString.str().find('E') : OriginalLiteralString.str().find('e');
+    const llvm::StringRef MantissaSubString = OriginalLiteralString.substr(0, EPosition);
+    const llvm::StringRef ExponentSubString =
+        OriginalLiteralString.substr(EPosition + 1, OriginalLiteralString.size());
+
+    // Get formatting literal text
+    const std::string FormatedMantissaString = getFormatedFloatString(MantissaSubString, llvm::APFloat(std::stod(MantissaSubString.str())));
+    const std::string FormatedExponentString = getFormatedIntegerString(ExponentSubString, llvm::APInt(128, std::stoll(ExponentSubString.str())));
+    return FormatedMantissaString + (OriginalLiteralString.str().find('E') != std::string::npos ? 'E' : 'e') + FormatedExponentString;
+  }
+
   // Configure formatting
   std::string Postfix;
   for (const char &Character : OriginalLiteralString) {

>From bde206f6683037339676cff84a628e0684b43546 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Mon, 18 Dec 2023 19:17:24 +0300
Subject: [PATCH 37/76] Some refactoring and tests

---
 .../modernize/UseDigitSeparatorCheck.cpp      | 26 ++++++++++++-------
 .../modernize/use-digit-separator.cpp         |  8 ++++++
 2 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 1cb217b112ca34..75dd8e1bf3a05a 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -20,6 +20,8 @@
 using namespace clang::ast_matchers;
 
 namespace {
+std::string getFormatedScientificFloatString(const llvm::StringRef OriginalLiteralString);
+
 std::vector<std::basic_string<char>>
 splitStringByGroupSize(const std::basic_string<char> &String, size_t GroupSize) {
   std::vector<std::basic_string<char>> Result;
@@ -83,16 +85,7 @@ std::string getFormatedIntegerString(const llvm::StringRef OriginalLiteralString
 
 std::string getFormatedFloatString(const llvm::StringRef OriginalLiteralString, const llvm::APFloat FloatValue) {
   if (OriginalLiteralString.contains('E') || OriginalLiteralString.contains('e')) {
-    // Split string to mantissa and exponent
-    const std::string::size_type EPosition = OriginalLiteralString.str().find('E') != std::string::npos ? OriginalLiteralString.str().find('E') : OriginalLiteralString.str().find('e');
-    const llvm::StringRef MantissaSubString = OriginalLiteralString.substr(0, EPosition);
-    const llvm::StringRef ExponentSubString =
-        OriginalLiteralString.substr(EPosition + 1, OriginalLiteralString.size());
-
-    // Get formatting literal text
-    const std::string FormatedMantissaString = getFormatedFloatString(MantissaSubString, llvm::APFloat(std::stod(MantissaSubString.str())));
-    const std::string FormatedExponentString = getFormatedIntegerString(ExponentSubString, llvm::APInt(128, std::stoll(ExponentSubString.str())));
-    return FormatedMantissaString + (OriginalLiteralString.str().find('E') != std::string::npos ? 'E' : 'e') + FormatedExponentString;
+    return getFormatedScientificFloatString(OriginalLiteralString);
   }
 
   // Configure formatting
@@ -144,6 +137,19 @@ std::string getFormatedFloatString(const llvm::StringRef OriginalLiteralString,
 
   return FormatedLiteralString;
 }
+
+std::string getFormatedScientificFloatString(const llvm::StringRef OriginalLiteralString) {
+  // Split string to mantissa and exponent
+  const std::string::size_type EPosition = OriginalLiteralString.str().find('E') != std::string::npos ? OriginalLiteralString.str().find('E') : OriginalLiteralString.str().find('e');
+  const llvm::StringRef MantissaSubString = OriginalLiteralString.substr(0, EPosition);
+  const llvm::StringRef ExponentSubString =
+      OriginalLiteralString.substr(EPosition + 1, OriginalLiteralString.size());
+
+  // Get formatting literal text
+  const std::string FormatedMantissaString = getFormatedFloatString(MantissaSubString, llvm::APFloat(std::stod(MantissaSubString.str())));
+  const std::string FormatedExponentString = getFormatedIntegerString(ExponentSubString, llvm::APInt(128, std::stoll(ExponentSubString.str())));
+  return FormatedMantissaString + (OriginalLiteralString.str().find('E') != std::string::npos ? 'E' : 'e') + FormatedExponentString;
+}
 } // namespace
 
 namespace clang::tidy::modernize {
diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
index c735bd2a4ac9fd..86bde5dd5c752f 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
@@ -84,6 +84,14 @@ double PostfixNotFormattedFloat = 1234.569F;
 // CHECK-MESSAGES: :[[@LINE-1]]:35: warning: unformatted representation of integer literal '1234.569F' [modernize-use-digit-separator]
 // CHECK-FIXES: 1'234.569F
 
+double ScientificNotFormattedFloat = 1.2345678e10;
+// CHECK-MESSAGES: :[[@LINE-1]]:38: warning: unformatted representation of integer literal '1.2345678e10' [modernize-use-digit-separator]
+// CHECK-FIXES: 1.234'567'8e10
+
+double ScientificNotFormattedFloat1 = 1.2345678E10;
+// CHECK-MESSAGES: :[[@LINE-1]]:38: warning: unformatted representation of integer literal '1.2345678E10' [modernize-use-digit-separator]
+// CHECK-FIXES: 1.234'567'8E10
+
 // FIXME:
 // error: expected ';' after top level declarator [clang-diagnostic-error]
 //   80 | int FormattedInteger = 1'234'567;

>From 88974008b895f9c6cd9409242f0269d0a702f3e2 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Mon, 18 Dec 2023 19:17:54 +0300
Subject: [PATCH 38/76] Formating

---
 .../modernize/UseDigitSeparatorCheck.cpp      | 25 +++++++++++++------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 75dd8e1bf3a05a..1927be30f0d867 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -20,7 +20,8 @@
 using namespace clang::ast_matchers;
 
 namespace {
-std::string getFormatedScientificFloatString(const llvm::StringRef OriginalLiteralString);
+std::string
+getFormatedScientificFloatString(const llvm::StringRef OriginalLiteralString);
 
 std::vector<std::basic_string<char>>
 splitStringByGroupSize(const std::basic_string<char> &String, size_t GroupSize) {
@@ -138,17 +139,27 @@ std::string getFormatedFloatString(const llvm::StringRef OriginalLiteralString,
   return FormatedLiteralString;
 }
 
-std::string getFormatedScientificFloatString(const llvm::StringRef OriginalLiteralString) {
+std::string
+getFormatedScientificFloatString(const llvm::StringRef OriginalLiteralString) {
   // Split string to mantissa and exponent
-  const std::string::size_type EPosition = OriginalLiteralString.str().find('E') != std::string::npos ? OriginalLiteralString.str().find('E') : OriginalLiteralString.str().find('e');
-  const llvm::StringRef MantissaSubString = OriginalLiteralString.substr(0, EPosition);
+  const std::string::size_type EPosition =
+      OriginalLiteralString.str().find('E') != std::string::npos
+          ? OriginalLiteralString.str().find('E')
+          : OriginalLiteralString.str().find('e');
+  const llvm::StringRef MantissaSubString =
+      OriginalLiteralString.substr(0, EPosition);
   const llvm::StringRef ExponentSubString =
       OriginalLiteralString.substr(EPosition + 1, OriginalLiteralString.size());
 
   // Get formatting literal text
-  const std::string FormatedMantissaString = getFormatedFloatString(MantissaSubString, llvm::APFloat(std::stod(MantissaSubString.str())));
-  const std::string FormatedExponentString = getFormatedIntegerString(ExponentSubString, llvm::APInt(128, std::stoll(ExponentSubString.str())));
-  return FormatedMantissaString + (OriginalLiteralString.str().find('E') != std::string::npos ? 'E' : 'e') + FormatedExponentString;
+  const std::string FormatedMantissaString = getFormatedFloatString(
+      MantissaSubString, llvm::APFloat(std::stod(MantissaSubString.str())));
+  const std::string FormatedExponentString = getFormatedIntegerString(
+      ExponentSubString, llvm::APInt(128, std::stoll(ExponentSubString.str())));
+  return FormatedMantissaString +
+         (OriginalLiteralString.str().find('E') != std::string::npos ? 'E'
+                                                                     : 'e') +
+         FormatedExponentString;
 }
 } // namespace
 

>From 260e09647dbb7e78dd3e0a96ecae3d54e9047938 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Mon, 18 Dec 2023 19:19:53 +0300
Subject: [PATCH 39/76] Fix warning message for float values

---
 .../clang-tidy/modernize/UseDigitSeparatorCheck.cpp    |  2 +-
 .../checkers/modernize/use-digit-separator.cpp         | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 1927be30f0d867..12907404aa2964 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -207,7 +207,7 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
     // Compare the original and formatted representation of a literal
     if (OriginalLiteralString != FormatedLiteralString) {
       diag(MatchedFloat->getLocation(),
-           "unformatted representation of integer literal '%0'")
+           "unformatted representation of float literal '%0'")
           << OriginalLiteralString
           << FixItHint::CreateInsertion(MatchedFloat->getLocation(),
                                         FormatedLiteralString);
diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
index 86bde5dd5c752f..efa83ed500a1fb 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
@@ -73,23 +73,23 @@ unsigned long MinusUnsignedLongNotFormattedInteger1 = -12345678910111213Ul;
 // CHECK-FIXES: 12'345'678'910'111'213Ul
 
 float NotFormattedFloat = 1234.56789;
-// CHECK-MESSAGES: :[[@LINE-1]]:27: warning: unformatted representation of integer literal '1234.56789' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:27: warning: unformatted representation of float literal '1234.56789' [modernize-use-digit-separator]
 // CHECK-FIXES: 1'234.567'89
 
 float MinusNotFormattedFloat = -1234.56789;
-// CHECK-MESSAGES: :[[@LINE-1]]:33: warning: unformatted representation of integer literal '1234.56789' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:33: warning: unformatted representation of float literal '1234.56789' [modernize-use-digit-separator]
 // CHECK-FIXES: 1'234.567'89
 
 double PostfixNotFormattedFloat = 1234.569F;
-// CHECK-MESSAGES: :[[@LINE-1]]:35: warning: unformatted representation of integer literal '1234.569F' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:35: warning: unformatted representation of float literal '1234.569F' [modernize-use-digit-separator]
 // CHECK-FIXES: 1'234.569F
 
 double ScientificNotFormattedFloat = 1.2345678e10;
-// CHECK-MESSAGES: :[[@LINE-1]]:38: warning: unformatted representation of integer literal '1.2345678e10' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:38: warning: unformatted representation of float literal '1.2345678e10' [modernize-use-digit-separator]
 // CHECK-FIXES: 1.234'567'8e10
 
 double ScientificNotFormattedFloat1 = 1.2345678E10;
-// CHECK-MESSAGES: :[[@LINE-1]]:38: warning: unformatted representation of integer literal '1.2345678E10' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:38: warning: unformatted representation of float literal '1.2345678E10' [modernize-use-digit-separator]
 // CHECK-FIXES: 1.234'567'8E10
 
 // FIXME:

>From 808e95cf5c9ee5c65981422f0a67227a9e0f95c1 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Tue, 19 Dec 2023 11:39:26 +0300
Subject: [PATCH 40/76] Some refactoring

---
 .../clang-tidy/modernize/UseDigitSeparatorCheck.cpp   | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 12907404aa2964..78c29f4e09a539 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -142,10 +142,10 @@ std::string getFormatedFloatString(const llvm::StringRef OriginalLiteralString,
 std::string
 getFormatedScientificFloatString(const llvm::StringRef OriginalLiteralString) {
   // Split string to mantissa and exponent
-  const std::string::size_type EPosition =
-      OriginalLiteralString.str().find('E') != std::string::npos
-          ? OriginalLiteralString.str().find('E')
-          : OriginalLiteralString.str().find('e');
+  const char EChar = OriginalLiteralString.str().find('E') != std::string::npos
+                         ? 'E'
+                         : 'e';
+  const std::string::size_type EPosition = OriginalLiteralString.str().find(EChar);
   const llvm::StringRef MantissaSubString =
       OriginalLiteralString.substr(0, EPosition);
   const llvm::StringRef ExponentSubString =
@@ -157,8 +157,7 @@ getFormatedScientificFloatString(const llvm::StringRef OriginalLiteralString) {
   const std::string FormatedExponentString = getFormatedIntegerString(
       ExponentSubString, llvm::APInt(128, std::stoll(ExponentSubString.str())));
   return FormatedMantissaString +
-         (OriginalLiteralString.str().find('E') != std::string::npos ? 'E'
-                                                                     : 'e') +
+         EChar +
          FormatedExponentString;
 }
 } // namespace

>From c22c94b444be886e1772125d926a059836ba48b4 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Tue, 19 Dec 2023 11:39:58 +0300
Subject: [PATCH 41/76] Formating

---
 .../clang-tidy/modernize/UseDigitSeparatorCheck.cpp  | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 78c29f4e09a539..73ca668569e1ab 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -142,10 +142,10 @@ std::string getFormatedFloatString(const llvm::StringRef OriginalLiteralString,
 std::string
 getFormatedScientificFloatString(const llvm::StringRef OriginalLiteralString) {
   // Split string to mantissa and exponent
-  const char EChar = OriginalLiteralString.str().find('E') != std::string::npos
-                         ? 'E'
-                         : 'e';
-  const std::string::size_type EPosition = OriginalLiteralString.str().find(EChar);
+  const char EChar =
+      OriginalLiteralString.str().find('E') != std::string::npos ? 'E' : 'e';
+  const std::string::size_type EPosition =
+      OriginalLiteralString.str().find(EChar);
   const llvm::StringRef MantissaSubString =
       OriginalLiteralString.substr(0, EPosition);
   const llvm::StringRef ExponentSubString =
@@ -156,9 +156,7 @@ getFormatedScientificFloatString(const llvm::StringRef OriginalLiteralString) {
       MantissaSubString, llvm::APFloat(std::stod(MantissaSubString.str())));
   const std::string FormatedExponentString = getFormatedIntegerString(
       ExponentSubString, llvm::APInt(128, std::stoll(ExponentSubString.str())));
-  return FormatedMantissaString +
-         EChar +
-         FormatedExponentString;
+  return FormatedMantissaString + EChar + FormatedExponentString;
 }
 } // namespace
 

>From b80f6a187824d91857ed2e8df033ae06fe28cc52 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Tue, 19 Dec 2023 12:36:18 +0300
Subject: [PATCH 42/76] Support signs in exponent notation

---
 .../clang-tidy/modernize/UseDigitSeparatorCheck.cpp    |  5 +++--
 .../checkers/modernize/use-digit-separator.cpp         | 10 +++++++++-
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 73ca668569e1ab..71118bfb169bf4 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -146,17 +146,18 @@ getFormatedScientificFloatString(const llvm::StringRef OriginalLiteralString) {
       OriginalLiteralString.str().find('E') != std::string::npos ? 'E' : 'e';
   const std::string::size_type EPosition =
       OriginalLiteralString.str().find(EChar);
+  const std::string SignSymbol = OriginalLiteralString[EPosition + 1] == '-' ? "-" : (OriginalLiteralString[EPosition + 1] == '+' ? "+" : "");
   const llvm::StringRef MantissaSubString =
       OriginalLiteralString.substr(0, EPosition);
   const llvm::StringRef ExponentSubString =
-      OriginalLiteralString.substr(EPosition + 1, OriginalLiteralString.size());
+      OriginalLiteralString.substr(EPosition + SignSymbol.size() + 1, OriginalLiteralString.size());
 
   // Get formatting literal text
   const std::string FormatedMantissaString = getFormatedFloatString(
       MantissaSubString, llvm::APFloat(std::stod(MantissaSubString.str())));
   const std::string FormatedExponentString = getFormatedIntegerString(
       ExponentSubString, llvm::APInt(128, std::stoll(ExponentSubString.str())));
-  return FormatedMantissaString + EChar + FormatedExponentString;
+  return FormatedMantissaString + EChar + SignSymbol + FormatedExponentString;
 }
 } // namespace
 
diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
index efa83ed500a1fb..9d400ea6d69701 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
@@ -89,9 +89,17 @@ double ScientificNotFormattedFloat = 1.2345678e10;
 // CHECK-FIXES: 1.234'567'8e10
 
 double ScientificNotFormattedFloat1 = 1.2345678E10;
-// CHECK-MESSAGES: :[[@LINE-1]]:38: warning: unformatted representation of float literal '1.2345678E10' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:39: warning: unformatted representation of float literal '1.2345678E10' [modernize-use-digit-separator]
 // CHECK-FIXES: 1.234'567'8E10
 
+double ScientificNotFormattedFloat2 = -1.2345678E+10;
+// CHECK-MESSAGES: :[[@LINE-1]]:40: warning: unformatted representation of float literal '1.2345678E+10' [modernize-use-digit-separator]
+// CHECK-FIXES: 1.234'567'8E+10
+
+double ScientificNotFormattedFloat3 = +1.2345678e-10;
+// CHECK-MESSAGES: :[[@LINE-1]]:40: warning: unformatted representation of float literal '1.2345678e-10' [modernize-use-digit-separator]
+// CHECK-FIXES: 1.234'567'8e-10
+
 // FIXME:
 // error: expected ';' after top level declarator [clang-diagnostic-error]
 //   80 | int FormattedInteger = 1'234'567;

>From 9726be55f214a4a85f6e99e164de527b2daeea2a Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Tue, 19 Dec 2023 12:36:48 +0300
Subject: [PATCH 43/76] Formating

---
 .../clang-tidy/modernize/UseDigitSeparatorCheck.cpp      | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 71118bfb169bf4..cfcad53c9f3fff 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -146,11 +146,14 @@ getFormatedScientificFloatString(const llvm::StringRef OriginalLiteralString) {
       OriginalLiteralString.str().find('E') != std::string::npos ? 'E' : 'e';
   const std::string::size_type EPosition =
       OriginalLiteralString.str().find(EChar);
-  const std::string SignSymbol = OriginalLiteralString[EPosition + 1] == '-' ? "-" : (OriginalLiteralString[EPosition + 1] == '+' ? "+" : "");
+  const std::string SignSymbol =
+      OriginalLiteralString[EPosition + 1] == '-'
+          ? "-"
+          : (OriginalLiteralString[EPosition + 1] == '+' ? "+" : "");
   const llvm::StringRef MantissaSubString =
       OriginalLiteralString.substr(0, EPosition);
-  const llvm::StringRef ExponentSubString =
-      OriginalLiteralString.substr(EPosition + SignSymbol.size() + 1, OriginalLiteralString.size());
+  const llvm::StringRef ExponentSubString = OriginalLiteralString.substr(
+      EPosition + SignSymbol.size() + 1, OriginalLiteralString.size());
 
   // Get formatting literal text
   const std::string FormatedMantissaString = getFormatedFloatString(

>From 1e00d391d2c1ccffc3520403f838f944f59c1c8e Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Tue, 19 Dec 2023 13:32:21 +0300
Subject: [PATCH 44/76] Some tests and fixes

---
 .../modernize/UseDigitSeparatorCheck.cpp      |  4 +-
 .../modernize/use-digit-separator.cpp         | 41 +++++++++++++++++++
 2 files changed, 43 insertions(+), 2 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index cfcad53c9f3fff..fad1f4915066a0 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -62,8 +62,8 @@ std::string getFormatedIntegerString(const llvm::StringRef OriginalLiteralString
     GroupSize = 3;
   }
 
-  for (const char &Character : OriginalLiteralString) {
-    if (!std::isdigit(Character) && Character != '\'') {
+  for (const char &Character : OriginalLiteralString.substr(Prefix.size(), OriginalLiteralString.size())) {
+    if (!std::isxdigit(Character) && Character != '\'') {
       Postfix += Character;
     }
   }
diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
index 9d400ea6d69701..672a87fce2aa01 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
@@ -1,5 +1,7 @@
 // RUN: %check_clang_tidy %s modernize-use-digit-separator %t
 
+// Long not formatted literals
+
 int NotFormattedInteger = 1234567;
 // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: unformatted representation of integer literal '1234567' [modernize-use-digit-separator]
 // CHECK-FIXES: 1'234'567
@@ -84,6 +86,18 @@ double PostfixNotFormattedFloat = 1234.569F;
 // CHECK-MESSAGES: :[[@LINE-1]]:35: warning: unformatted representation of float literal '1234.569F' [modernize-use-digit-separator]
 // CHECK-FIXES: 1'234.569F
 
+double MinusPostfixNotFormattedFloat = -1234.569F;
+// CHECK-MESSAGES: :[[@LINE-1]]:41: warning: unformatted representation of float literal '1234.569F' [modernize-use-digit-separator]
+// CHECK-FIXES: 1'234.569F
+
+double PostfixNotFormattedFloat1 = 1234.569f;
+// CHECK-MESSAGES: :[[@LINE-1]]:36: warning: unformatted representation of float literal '1234.569f' [modernize-use-digit-separator]
+// CHECK-FIXES: 1'234.569f
+
+double MinusPostfixNotFormattedFloat1 = -1234.569f;
+// CHECK-MESSAGES: :[[@LINE-1]]:42: warning: unformatted representation of float literal '1234.569f' [modernize-use-digit-separator]
+// CHECK-FIXES: 1'234.569f
+
 double ScientificNotFormattedFloat = 1.2345678e10;
 // CHECK-MESSAGES: :[[@LINE-1]]:38: warning: unformatted representation of float literal '1.2345678e10' [modernize-use-digit-separator]
 // CHECK-FIXES: 1.234'567'8e10
@@ -100,6 +114,33 @@ double ScientificNotFormattedFloat3 = +1.2345678e-10;
 // CHECK-MESSAGES: :[[@LINE-1]]:40: warning: unformatted representation of float literal '1.2345678e-10' [modernize-use-digit-separator]
 // CHECK-FIXES: 1.234'567'8e-10
 
+// Short literals
+
+int ShortInteger = 123;
+int MinusShortInteger = -123;
+int ShortBinaryInteger = 0b10;
+int MinusShortBinaryInteger = 0b10;
+int ShortOctInteger = 037;
+int MinusShortOctInteger = -037;
+int ShortHexInteger = 0x3F0;
+int MinusShortHexInteger = -0x3F0;
+unsigned int UnsignedShortInteger = 123U;
+unsigned int MinusUnsignedShortInteger = -123U;
+unsigned int UnsignedShortInteger1 = 123u;
+unsigned int MinusUnsignedShortInteger1 = -123u;
+long LongShortInteger = 123L;
+long MinusLongShortInteger = -123L;
+long LongShortInteger1 = 123l;
+long MinusLongShortInteger1 = -123l;
+unsigned long UnsignedLongShortInteger = 123uL;
+unsigned long MinusUnsignedLongShortInteger = -123uL;
+float ShortFloat = 1.23;
+float MinusShortFloat = -1.23;
+float PostfixShortFloat = 1.23F;
+float MinusPostfixShortFloat = -1.23F;
+float PostfixShortFloat1 = 1.23f;
+float MinusPostfixShortFloat1 = -1.23f;
+
 // FIXME:
 // error: expected ';' after top level declarator [clang-diagnostic-error]
 //   80 | int FormattedInteger = 1'234'567;

>From 5081470340dceaaf15c8703a091c4c2e33776876 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Tue, 19 Dec 2023 13:32:51 +0300
Subject: [PATCH 45/76] Formatting

---
 .../clang-tidy/modernize/UseDigitSeparatorCheck.cpp            | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index fad1f4915066a0..5e692eaff3dfca 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -62,7 +62,8 @@ std::string getFormatedIntegerString(const llvm::StringRef OriginalLiteralString
     GroupSize = 3;
   }
 
-  for (const char &Character : OriginalLiteralString.substr(Prefix.size(), OriginalLiteralString.size())) {
+  for (const char &Character : OriginalLiteralString.substr(
+           Prefix.size(), OriginalLiteralString.size())) {
     if (!std::isxdigit(Character) && Character != '\'') {
       Postfix += Character;
     }

>From f929f69a4b5112a168481711d61fc2949dadecc5 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Tue, 19 Dec 2023 16:33:44 +0300
Subject: [PATCH 46/76] Add more tests

---
 .../modernize/use-digit-separator.cpp         | 50 +++++++++++++++----
 1 file changed, 40 insertions(+), 10 deletions(-)

diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
index 672a87fce2aa01..110171526bb1a0 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
@@ -1,5 +1,6 @@
 // RUN: %check_clang_tidy %s modernize-use-digit-separator %t
 
+
 // Long not formatted literals
 
 int NotFormattedInteger = 1234567;
@@ -98,21 +99,38 @@ double MinusPostfixNotFormattedFloat1 = -1234.569f;
 // CHECK-MESSAGES: :[[@LINE-1]]:42: warning: unformatted representation of float literal '1234.569f' [modernize-use-digit-separator]
 // CHECK-FIXES: 1'234.569f
 
-double ScientificNotFormattedFloat = 1.2345678e10;
-// CHECK-MESSAGES: :[[@LINE-1]]:38: warning: unformatted representation of float literal '1.2345678e10' [modernize-use-digit-separator]
-// CHECK-FIXES: 1.234'567'8e10
+double ScientificNotFormattedFloat = 1.2345678E10;
+// CHECK-MESSAGES: :[[@LINE-1]]:38: warning: unformatted representation of float literal '1.2345678E10' [modernize-use-digit-separator]
+// CHECK-FIXES: 1.234'567'8E10
 
-double ScientificNotFormattedFloat1 = 1.2345678E10;
-// CHECK-MESSAGES: :[[@LINE-1]]:39: warning: unformatted representation of float literal '1.2345678E10' [modernize-use-digit-separator]
+double MinusScientificNotFormattedFloat = -1.2345678E10;
+// CHECK-MESSAGES: :[[@LINE-1]]:44: warning: unformatted representation of float literal '1.2345678E10' [modernize-use-digit-separator]
 // CHECK-FIXES: 1.234'567'8E10
 
-double ScientificNotFormattedFloat2 = -1.2345678E+10;
-// CHECK-MESSAGES: :[[@LINE-1]]:40: warning: unformatted representation of float literal '1.2345678E+10' [modernize-use-digit-separator]
+double ScientificNotFormattedFloat1 = 1.2345678e10;
+// CHECK-MESSAGES: :[[@LINE-1]]:39: warning: unformatted representation of float literal '1.2345678e10' [modernize-use-digit-separator]
+// CHECK-FIXES: 1.234'567'8e10
+
+double MinusScientificNotFormattedFloat1 = -1.2345678e10;
+// CHECK-MESSAGES: :[[@LINE-1]]:45: warning: unformatted representation of float literal '1.2345678e10' [modernize-use-digit-separator]
+// CHECK-FIXES: 1.234'567'8e10
+
+double ScientificNotFormattedFloat2 = 1.2345678E+10;
+// CHECK-MESSAGES: :[[@LINE-1]]:39: warning: unformatted representation of float literal '1.2345678E+10' [modernize-use-digit-separator]
+// CHECK-FIXES: 1.234'567'8E+10
+
+double MinusScientificNotFormattedFloat2 = -1.2345678E+10;
+// CHECK-MESSAGES: :[[@LINE-1]]:45: warning: unformatted representation of float literal '1.2345678E+10' [modernize-use-digit-separator]
 // CHECK-FIXES: 1.234'567'8E+10
 
-double ScientificNotFormattedFloat3 = +1.2345678e-10;
-// CHECK-MESSAGES: :[[@LINE-1]]:40: warning: unformatted representation of float literal '1.2345678e-10' [modernize-use-digit-separator]
-// CHECK-FIXES: 1.234'567'8e-10
+double ScientificNotFormattedFloat3 = 1.2345678e+10;
+// CHECK-MESSAGES: :[[@LINE-1]]:39: warning: unformatted representation of float literal '1.2345678e+10' [modernize-use-digit-separator]
+// CHECK-FIXES: 1.234'567'8e+10
+
+double MinusScientificNotFormattedFloat3 = -1.2345678e+10;
+// CHECK-MESSAGES: :[[@LINE-1]]:45: warning: unformatted representation of float literal '1.2345678e+10' [modernize-use-digit-separator]
+// CHECK-FIXES: 1.234'567'8e+10
+
 
 // Short literals
 
@@ -140,6 +158,18 @@ float PostfixShortFloat = 1.23F;
 float MinusPostfixShortFloat = -1.23F;
 float PostfixShortFloat1 = 1.23f;
 float MinusPostfixShortFloat1 = -1.23f;
+float ScientificShortFloat = 1.23E10;
+float MinusScientificShortFloat = -1.23E10;
+float ScientificShortFloat1 = 1.23e10;
+float MinusScientificShortFloat1 = -1.23e10;
+float ScientificShortFloat2 = 1.23E+10;
+float MinusScientificShortFloat2 = -1.23E+10;
+float ScientificShortFloat3 = 1.23e+10;
+float MinusScientificShortFloat3 = -1.23e+10;
+float ScientificShortFloat4 = 1.23E-10;
+float MinusScientificShortFloat4 = -1.23E-10;
+float ScientificShortFloat5 = 1.23e+10;
+float MinusScientificShortFloat5 = -1.23e-10;
 
 // FIXME:
 // error: expected ';' after top level declarator [clang-diagnostic-error]

>From 6fd799132eb7cfd7ee9fbcb10510f6ec1ce6a733 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Tue, 19 Dec 2023 17:15:24 +0300
Subject: [PATCH 47/76] Add more tests

---
 .../modernize/UseDigitSeparatorCheck.cpp      |  2 +-
 .../modernize/use-digit-separator.cpp         | 20 +++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 5e692eaff3dfca..3344e458049014 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -64,7 +64,7 @@ std::string getFormatedIntegerString(const llvm::StringRef OriginalLiteralString
 
   for (const char &Character : OriginalLiteralString.substr(
            Prefix.size(), OriginalLiteralString.size())) {
-    if (!std::isxdigit(Character) && Character != '\'') {
+    if (((Prefix == "0x" && !std::isxdigit(Character)) || (Prefix != "0x" && !std::isdigit(Character))) && Character != '\'') {
       Postfix += Character;
     }
   }
diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
index 110171526bb1a0..1d2f54344fcd6c 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
@@ -131,6 +131,22 @@ double MinusScientificNotFormattedFloat3 = -1.2345678e+10;
 // CHECK-MESSAGES: :[[@LINE-1]]:45: warning: unformatted representation of float literal '1.2345678e+10' [modernize-use-digit-separator]
 // CHECK-FIXES: 1.234'567'8e+10
 
+double PostfixScientificNotFormattedFloat = 1.2345678E10F;
+// CHECK-MESSAGES: :[[@LINE-1]]:45: warning: unformatted representation of float literal '1.2345678E10F' [modernize-use-digit-separator]
+// CHECK-FIXES: 1.234'567'8E10F
+
+double PostfixScientificNotFormattedFloat1 = 1.2345678e10f;
+// CHECK-MESSAGES: :[[@LINE-1]]:46: warning: unformatted representation of float literal '1.2345678e10f' [modernize-use-digit-separator]
+// CHECK-FIXES: 1.234'567'8e10f
+
+double PostfixScientificNotFormattedFloat2 = -1.2345678E+10f;
+// CHECK-MESSAGES: :[[@LINE-1]]:47: warning: unformatted representation of float literal '1.2345678E+10f' [modernize-use-digit-separator]
+// CHECK-FIXES: 1.234'567'8E+10f
+
+double PostfixScientificNotFormattedFloat4 = -1.2345678e-10F;
+// CHECK-MESSAGES: :[[@LINE-1]]:47: warning: unformatted representation of float literal '1.2345678e-10F' [modernize-use-digit-separator]
+// CHECK-FIXES: 1.234'567'8e-10F
+
 
 // Short literals
 
@@ -170,6 +186,10 @@ float ScientificShortFloat4 = 1.23E-10;
 float MinusScientificShortFloat4 = -1.23E-10;
 float ScientificShortFloat5 = 1.23e+10;
 float MinusScientificShortFloat5 = -1.23e-10;
+float PostfixScientificShortFloat = 1.23E10F;
+float PostfixScientificShortFloat1 = 1.23e10f;
+float PostfixScientificShortFloat2 = 1.23E+10f;
+float PostfixScientificShortFloat3 = 1.23e-10F;
 
 // FIXME:
 // error: expected ';' after top level declarator [clang-diagnostic-error]

>From 78d541956f3e0c790e7f47b685a1287b864040aa Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Tue, 19 Dec 2023 17:16:37 +0300
Subject: [PATCH 48/76] Formating

---
 .../clang-tidy/modernize/UseDigitSeparatorCheck.cpp           | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 3344e458049014..a5503f57ec7edc 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -64,7 +64,9 @@ std::string getFormatedIntegerString(const llvm::StringRef OriginalLiteralString
 
   for (const char &Character : OriginalLiteralString.substr(
            Prefix.size(), OriginalLiteralString.size())) {
-    if (((Prefix == "0x" && !std::isxdigit(Character)) || (Prefix != "0x" && !std::isdigit(Character))) && Character != '\'') {
+    if (((Prefix == "0x" && !std::isxdigit(Character)) ||
+         (Prefix != "0x" && !std::isdigit(Character))) &&
+        Character != '\'') {
       Postfix += Character;
     }
   }

>From fdea346f002b39096b03e978fc505604be60c3a0 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Thu, 21 Dec 2023 15:41:28 +0300
Subject: [PATCH 49/76] Add tests for Formatted literals

---
 .../modernize/use-digit-separator.cpp         | 49 +++++++++++++++++--
 1 file changed, 44 insertions(+), 5 deletions(-)

diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
index 1d2f54344fcd6c..75f7d4d989f322 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
@@ -191,9 +191,48 @@ float PostfixScientificShortFloat1 = 1.23e10f;
 float PostfixScientificShortFloat2 = 1.23E+10f;
 float PostfixScientificShortFloat3 = 1.23e-10F;
 
-// FIXME:
+
+// Formatted literals
+
+// FIXME: clang-diagnostic-error like this for the following tests
+// clang-18 and clang-tidy don't produce such error
 // error: expected ';' after top level declarator [clang-diagnostic-error]
-//   80 | int FormattedInteger = 1'234'567;
-//      |                         ^
-//      |                         ;
-//int FormattedInteger = 1'234'567;
\ No newline at end of file
+//   203 | int FormattedInteger = 1'234'567;
+//       |                         ^
+//       |                         ;
+//int FormattedInteger = 1'234'567;
+//int MinusFormattedInteger = -1'234'567;
+//int BinaryFormattedInteger = 0b1110'1101;
+//int MinusBinaryFormattedInteger = -0b1110'1101;
+//int OctFormattedInteger = 037'512;
+//int MinusOctFormattedInteger = -037'512;
+//int HexFormattedInteger = 0x4'f356;
+//int MinusHexFormattedInteger = -0x4'f356;
+//unsigned int UnsignedFormattedInteger = 10'004U;
+//unsigned int MinusUnsignedFormattedInteger = -10'004U;
+//unsigned int UnsignedFormattedInteger1 = 100'045u;
+//unsigned int MinusUnsignedFormattedInteger1 = -100'045u;
+//long LongFormattedInteger = 123'456'789'101'112L;
+//long MinusLongFormattedInteger = -123'456'789'101'112L;
+//long LongFormattedInteger1 = 12'345'678'910'111'213l;
+//long MinusLongFormattedInteger1 = -12'345'678'910'111'213l;
+//unsigned long UnsignedLongFormattedInteger1 = 12'345'678'910'111'213Ul;
+//unsigned long MinusUnsignedLongFormattedInteger1 = -12'345'678'910'111'213Ul;
+//float FormattedFloat = 1'234.567'89;
+//float MinusFormattedFloat = -1'234.567'89;
+//double PostfixFormattedFloat = 1'234.569F;
+//double MinusPostfixFormattedFloat = -1'234.569F;
+//double PostfixFormattedFloat1 = 1'234.569f;
+//double MinusPostfixFormattedFloat1 = -1'234.569f;
+//double ScientificFormattedFloat = 1.234'567'8E10;
+//double MinusScientificFormattedFloat = -1.234'567'8E10;
+//double ScientificFormattedFloat1 = 1.234'567'8e10;
+//double MinusScientificFormattedFloat1 = -1.234'567'8e10;
+//double ScientificFormattedFloat2 = 1.234'567'8E+10;
+//double MinusScientificFormattedFloat2 = -1.234'567'8E+10;
+//double ScientificFormattedFloat3 = 1.234'567'8e+10;
+//double MinusScientificFormattedFloat3 = -1.234'567'8e+10;
+//double PostfixScientificFormattedFloat = 1.234'567'8E10F;
+//double PostfixScientificFormattedFloat1 = 1.234'567'8e10f;
+//double PostfixScientificFormattedFloat2 = -1.234'567'8E+10f;
+//double PostfixScientificFormattedFloat4 = -1.234'567'8e-10F;

>From f8446ab3d24ad4555456c4b2db562c570209af79 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Thu, 21 Dec 2023 16:04:31 +0300
Subject: [PATCH 50/76] Add tests for wrong Formatted literals

---
 .../checkers/modernize/use-digit-separator.cpp  | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
index 75f7d4d989f322..55063e6cfbb8d1 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
@@ -197,9 +197,10 @@ float PostfixScientificShortFloat3 = 1.23e-10F;
 // FIXME: clang-diagnostic-error like this for the following tests
 // clang-18 and clang-tidy don't produce such error
 // error: expected ';' after top level declarator [clang-diagnostic-error]
-//   203 | int FormattedInteger = 1'234'567;
+//   204 | int FormattedInteger = 1'234'567;
 //       |                         ^
 //       |                         ;
+
 //int FormattedInteger = 1'234'567;
 //int MinusFormattedInteger = -1'234'567;
 //int BinaryFormattedInteger = 0b1110'1101;
@@ -236,3 +237,17 @@ float PostfixScientificShortFloat3 = 1.23e-10F;
 //double PostfixScientificFormattedFloat1 = 1.234'567'8e10f;
 //double PostfixScientificFormattedFloat2 = -1.234'567'8E+10f;
 //double PostfixScientificFormattedFloat4 = -1.234'567'8e-10F;
+
+
+// Long wrong formatted literals
+
+// FIXME: clang-diagnostic-error like this for the following tests
+// clang-18 and clang-tidy don't produce such error
+//error: expected ';' after top level declarator [clang-diagnostic-error]
+//  249 | int WrongFormattedInteger = 1234'56'7;
+//      |                                 ^
+//      |                                 ;
+
+//int WrongFormattedInteger = 1234'56'7;
+//// CHECK-MESSAGES: :[[@LINE-1]]:29: warning: unformatted representation of integer literal '1234'56'7' [modernize-use-digit-separator]
+//// CHECK-FIXES: 1'234'567

>From 11f80912ccd3a8841cf689ad0293748e512dcca7 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Thu, 21 Dec 2023 16:04:47 +0300
Subject: [PATCH 51/76] Delete tests for wrong Formatted literals

---
 .../checkers/modernize/use-digit-separator.cpp     | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
index 55063e6cfbb8d1..ec4bdaecfa87de 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
@@ -237,17 +237,3 @@ float PostfixScientificShortFloat3 = 1.23e-10F;
 //double PostfixScientificFormattedFloat1 = 1.234'567'8e10f;
 //double PostfixScientificFormattedFloat2 = -1.234'567'8E+10f;
 //double PostfixScientificFormattedFloat4 = -1.234'567'8e-10F;
-
-
-// Long wrong formatted literals
-
-// FIXME: clang-diagnostic-error like this for the following tests
-// clang-18 and clang-tidy don't produce such error
-//error: expected ';' after top level declarator [clang-diagnostic-error]
-//  249 | int WrongFormattedInteger = 1234'56'7;
-//      |                                 ^
-//      |                                 ;
-
-//int WrongFormattedInteger = 1234'56'7;
-//// CHECK-MESSAGES: :[[@LINE-1]]:29: warning: unformatted representation of integer literal '1234'56'7' [modernize-use-digit-separator]
-//// CHECK-FIXES: 1'234'567

>From f754d5448c7edd6265ece34086e4152be7105506 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Thu, 21 Dec 2023 16:13:25 +0300
Subject: [PATCH 52/76] Add docs

---
 .../clang-tidy/modernize/UseDigitSeparatorCheck.h         | 8 +++++++-
 clang-tools-extra/docs/ReleaseNotes.rst                   | 2 +-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.h b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.h
index 8bbd2b3947c931..55083e2817574d 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.h
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.h
@@ -13,7 +13,13 @@
 
 namespace clang::tidy::modernize {
 
-/// FIXME: Write a short description.
+/// The check that looks for long integral constants and inserts the digits separator (') appropriately.
+/// Groupings:
+///     - decimal integral constants, groups of 3 digits, e.g. int x = 1'000;
+///     - binary integral constants, groups of 4 digits, e.g. int x = 0b0010'0011;
+///     - octal integral constants, groups of 3 digits, e.g. int x = 0377'777;
+///     - hexadecimal integral constants, groups of 4 digits, e.g. unsigned long x = 0xffff'0000;
+///     - floating-point constants, group into 3 digits on either side of the decimal point, e.g. float x = 3'456.001'25f;
 ///
 /// For the user-facing documentation see:
 /// http://clang.llvm.org/extra/clang-tidy/checks/modernize/use-digit-separator.html
diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst
index 4b9a0c1525e153..6812a8cefdbcec 100644
--- a/clang-tools-extra/docs/ReleaseNotes.rst
+++ b/clang-tools-extra/docs/ReleaseNotes.rst
@@ -195,7 +195,7 @@ New checks
 - New :doc:`modernize-use-digit-separator
   <clang-tidy/checks/modernize/use-digit-separator>` check.
 
-  FIXME: add release notes.
+  Looks for long integral constants and inserts the digits separator (') appropriately.
 
 - New :doc:`modernize-use-starts-ends-with
   <clang-tidy/checks/modernize/use-starts-ends-with>` check.

>From ab6dedfc0cd168682f9f11215d07e9f709e22ab8 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Thu, 21 Dec 2023 16:14:19 +0300
Subject: [PATCH 53/76] Formatting

---
 .../clang-tidy/modernize/UseDigitSeparatorCheck.h   | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.h b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.h
index 55083e2817574d..7f819420f85797 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.h
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.h
@@ -13,13 +13,16 @@
 
 namespace clang::tidy::modernize {
 
-/// The check that looks for long integral constants and inserts the digits separator (') appropriately.
-/// Groupings:
+/// The check that looks for long integral constants and inserts the digits
+/// separator (') appropriately. Groupings:
 ///     - decimal integral constants, groups of 3 digits, e.g. int x = 1'000;
-///     - binary integral constants, groups of 4 digits, e.g. int x = 0b0010'0011;
+///     - binary integral constants, groups of 4 digits, e.g. int x =
+///     0b0010'0011;
 ///     - octal integral constants, groups of 3 digits, e.g. int x = 0377'777;
-///     - hexadecimal integral constants, groups of 4 digits, e.g. unsigned long x = 0xffff'0000;
-///     - floating-point constants, group into 3 digits on either side of the decimal point, e.g. float x = 3'456.001'25f;
+///     - hexadecimal integral constants, groups of 4 digits, e.g. unsigned long
+///     x = 0xffff'0000;
+///     - floating-point constants, group into 3 digits on either side of the
+///     decimal point, e.g. float x = 3'456.001'25f;
 ///
 /// For the user-facing documentation see:
 /// http://clang.llvm.org/extra/clang-tidy/checks/modernize/use-digit-separator.html

>From e31f05f48dcb8f086c9da0a3f7d3c08d266bcf8b Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Thu, 21 Dec 2023 16:35:42 +0300
Subject: [PATCH 54/76] Formatting

---
 .../modernize/UseDigitSeparatorCheck.cpp      | 41 +++++++++++--------
 1 file changed, 25 insertions(+), 16 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index a5503f57ec7edc..37c3804c43be4f 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -24,7 +24,8 @@ std::string
 getFormatedScientificFloatString(const llvm::StringRef OriginalLiteralString);
 
 std::vector<std::basic_string<char>>
-splitStringByGroupSize(const std::basic_string<char> &String, size_t GroupSize) {
+splitStringByGroupSize(const std::basic_string<char> &String,
+                       size_t GroupSize) {
   std::vector<std::basic_string<char>> Result;
   std::basic_string<char> ReversedString(String.rbegin(), String.rend());
 
@@ -33,12 +34,15 @@ splitStringByGroupSize(const std::basic_string<char> &String, size_t GroupSize)
   }
 
   std::reverse(Result.begin(), Result.end());
-  std::for_each(Result.begin(), Result.end(), [](std::basic_string<char> &Str) {return std::reverse(Str.begin(), Str.end());});
+  std::for_each(Result.begin(), Result.end(), [](std::basic_string<char> &Str) {
+    return std::reverse(Str.begin(), Str.end());
+  });
 
   return Result;
 }
 
-std::string getFormatedIntegerString(const llvm::StringRef OriginalLiteralString, const llvm::APInt IntegerValue) {
+std::string getFormatedIntegerString(const llvm::StringRef OriginalLiteralString,
+                                     const llvm::APInt IntegerValue) {
   // Configure formatting
   unsigned int Radix;
   size_t GroupSize;
@@ -76,19 +80,20 @@ std::string getFormatedIntegerString(const llvm::StringRef OriginalLiteralString
       splitStringByGroupSize(toString(IntegerValue, Radix, true), GroupSize);
   const std::string FormatedLiteralString =
       Prefix +
-      std::accumulate(
-          SplittedIntegerLiteral.begin(), SplittedIntegerLiteral.end(),
-          std::string(""),
-          [](std::basic_string<char> S1, std::basic_string<char> S2) {
-            return S1 + "\'" + S2;
-          })
-          .erase(0, 1) + Postfix;
+      std::accumulate(SplittedIntegerLiteral.begin(),
+                      SplittedIntegerLiteral.end(),std::string(""),
+          [](std::basic_string<char> S1,
+                         std::basic_string<char> S2) { return S1 + "\'" + S2; })
+          .erase(0, 1) +
+      Postfix;
 
   return FormatedLiteralString;
 }
 
-std::string getFormatedFloatString(const llvm::StringRef OriginalLiteralString, const llvm::APFloat FloatValue) {
-  if (OriginalLiteralString.contains('E') || OriginalLiteralString.contains('e')) {
+std::string getFormatedFloatString(const llvm::StringRef OriginalLiteralString,
+                                   const llvm::APFloat FloatValue) {
+  if (OriginalLiteralString.contains('E') ||
+      OriginalLiteralString.contains('e')) {
     return getFormatedScientificFloatString(OriginalLiteralString);
   }
 
@@ -177,8 +182,10 @@ void UseDigitSeparatorCheck::registerMatchers(MatchFinder *Finder) {
 void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
   const ASTContext &Context = *Result.Context;
   const SourceManager &Source = Context.getSourceManager();
-  const IntegerLiteral *MatchedInteger = Result.Nodes.getNodeAs<IntegerLiteral>("integerLiteral");
-  const FloatingLiteral *MatchedFloat = Result.Nodes.getNodeAs<FloatingLiteral>("floatLiteral");
+  const IntegerLiteral *MatchedInteger =
+      Result.Nodes.getNodeAs<IntegerLiteral>("integerLiteral");
+  const FloatingLiteral *MatchedFloat =
+      Result.Nodes.getNodeAs<FloatingLiteral>("floatLiteral");
 
   if (MatchedInteger != nullptr) {
     // Get original literal source text
@@ -188,7 +195,8 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
 
     // Get formatting literal text
     const llvm::APInt IntegerValue = MatchedInteger->getValue();
-    const std::string FormatedLiteralString = getFormatedIntegerString(OriginalLiteralString, IntegerValue);
+    const std::string FormatedLiteralString =
+        getFormatedIntegerString(OriginalLiteralString, IntegerValue);
 
     // Compare the original and formatted representation of a literal
     if (OriginalLiteralString != FormatedLiteralString) {
@@ -206,7 +214,8 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
 
     // Get formatting literal text
     const llvm::APFloat FloatValue = MatchedFloat->getValue();
-    const std::string FormatedLiteralString = getFormatedFloatString(OriginalLiteralString, FloatValue);
+    const std::string FormatedLiteralString =
+        getFormatedFloatString(OriginalLiteralString, FloatValue);
 
     // Compare the original and formatted representation of a literal
     if (OriginalLiteralString != FormatedLiteralString) {

>From b3624ce38f7bd20f52494c405db60540fbf181f6 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Thu, 21 Dec 2023 16:41:47 +0300
Subject: [PATCH 55/76] Formatting

---
 .../clang-tidy/modernize/UseDigitSeparatorCheck.cpp      | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 37c3804c43be4f..34c3cc1822dd2a 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -41,8 +41,9 @@ splitStringByGroupSize(const std::basic_string<char> &String,
   return Result;
 }
 
-std::string getFormatedIntegerString(const llvm::StringRef OriginalLiteralString,
-                                     const llvm::APInt IntegerValue) {
+std::string
+getFormatedIntegerString(const llvm::StringRef OriginalLiteralString,
+                         const llvm::APInt IntegerValue) {
   // Configure formatting
   unsigned int Radix;
   size_t GroupSize;
@@ -81,8 +82,8 @@ std::string getFormatedIntegerString(const llvm::StringRef OriginalLiteralString
   const std::string FormatedLiteralString =
       Prefix +
       std::accumulate(SplittedIntegerLiteral.begin(),
-                      SplittedIntegerLiteral.end(),std::string(""),
-          [](std::basic_string<char> S1,
+                      SplittedIntegerLiteral.end(), std::string(""),
+                      [](std::basic_string<char> S1,
                          std::basic_string<char> S2) { return S1 + "\'" + S2; })
           .erase(0, 1) +
       Postfix;

>From 93f18850b8bfbfc2caf657a0c064e47c9b919910 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Thu, 21 Dec 2023 17:07:16 +0300
Subject: [PATCH 56/76] Documentation

---
 .../checks/modernize/use-digit-separator.rst       | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 clang-tools-extra/docs/clang-tidy/checks/modernize/use-digit-separator.rst

diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-digit-separator.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-digit-separator.rst
new file mode 100644
index 00000000000000..0a895fda4e2e51
--- /dev/null
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-digit-separator.rst
@@ -0,0 +1,14 @@
+.. title:: clang-tidy - modernize-use-digit-separator
+
+modernize-use-digit-separator
+=============================
+
+The check looks for long integral constants and inserts the digits separator
+(') appropriately. Groupings:
+    - decimal integral constants, groups of 3 digits, e.g. int x = 1'000;
+    - binary integral constants, groups of 4 digits, e.g. int x = 0b0010'0011;
+    - octal integral constants, groups of 3 digits, e.g. int x = 0377'777;
+    - hexadecimal integral constants, groups of 4 digits, e.g. unsigned long
+    x = 0xffff'0000;
+    - floating-point constants, group into 3 digits on either side of the
+    decimal point, e.g. float x = 3'456.001'25f;

>From 004f02ea45d465972a9c336df7046a20d1c9eb6a Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Thu, 21 Dec 2023 17:54:59 +0300
Subject: [PATCH 57/76] Add include sstream

---
 .../clang-tidy/modernize/UseDigitSeparatorCheck.cpp              | 1 +
 1 file changed, 1 insertion(+)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 34c3cc1822dd2a..3f1d4b0e7c8ef6 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -10,6 +10,7 @@
 #include <iomanip>
 #include <numeric>
 #include <regex>
+#include <sstream>
 
 #include "UseDigitSeparatorCheck.h"
 #include "clang/AST/ASTContext.h"

>From dd09ad2abf5f5abad5da73bc89c065530d2f7e06 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Tue, 26 Dec 2023 12:58:57 +0300
Subject: [PATCH 58/76] Fix some tests

---
 .../modernize/use-digit-separator.cpp         | 57 ++++++++-----------
 1 file changed, 25 insertions(+), 32 deletions(-)

diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
index ec4bdaecfa87de..bebeac52f4251f 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s modernize-use-digit-separator %t
+// RUN: %check_clang_tidy -std=c++14-or-later %s modernize-use-digit-separator %t
 
 
 // Long not formatted literals
@@ -194,37 +194,30 @@ float PostfixScientificShortFloat3 = 1.23e-10F;
 
 // Formatted literals
 
-// FIXME: clang-diagnostic-error like this for the following tests
-// clang-18 and clang-tidy don't produce such error
-// error: expected ';' after top level declarator [clang-diagnostic-error]
-//   204 | int FormattedInteger = 1'234'567;
-//       |                         ^
-//       |                         ;
-
-//int FormattedInteger = 1'234'567;
-//int MinusFormattedInteger = -1'234'567;
-//int BinaryFormattedInteger = 0b1110'1101;
-//int MinusBinaryFormattedInteger = -0b1110'1101;
-//int OctFormattedInteger = 037'512;
-//int MinusOctFormattedInteger = -037'512;
-//int HexFormattedInteger = 0x4'f356;
-//int MinusHexFormattedInteger = -0x4'f356;
-//unsigned int UnsignedFormattedInteger = 10'004U;
-//unsigned int MinusUnsignedFormattedInteger = -10'004U;
-//unsigned int UnsignedFormattedInteger1 = 100'045u;
-//unsigned int MinusUnsignedFormattedInteger1 = -100'045u;
-//long LongFormattedInteger = 123'456'789'101'112L;
-//long MinusLongFormattedInteger = -123'456'789'101'112L;
-//long LongFormattedInteger1 = 12'345'678'910'111'213l;
-//long MinusLongFormattedInteger1 = -12'345'678'910'111'213l;
-//unsigned long UnsignedLongFormattedInteger1 = 12'345'678'910'111'213Ul;
-//unsigned long MinusUnsignedLongFormattedInteger1 = -12'345'678'910'111'213Ul;
-//float FormattedFloat = 1'234.567'89;
-//float MinusFormattedFloat = -1'234.567'89;
-//double PostfixFormattedFloat = 1'234.569F;
-//double MinusPostfixFormattedFloat = -1'234.569F;
-//double PostfixFormattedFloat1 = 1'234.569f;
-//double MinusPostfixFormattedFloat1 = -1'234.569f;
+int FormattedInteger = 1'234'567;
+int MinusFormattedInteger = -1'234'567;
+int BinaryFormattedInteger = 0b1110'1101;
+int MinusBinaryFormattedInteger = -0b1110'1101;
+int OctFormattedInteger = 037'512;
+int MinusOctFormattedInteger = -037'512;
+int HexFormattedInteger = 0x4'F356;
+int MinusHexFormattedInteger = -0x4'F356;
+unsigned int UnsignedFormattedInteger = 10'004U;
+unsigned int MinusUnsignedFormattedInteger = -10'004U;
+unsigned int UnsignedFormattedInteger1 = 100'045u;
+unsigned int MinusUnsignedFormattedInteger1 = -100'045u;
+long LongFormattedInteger = 123'456'789'101'112L;
+long MinusLongFormattedInteger = -123'456'789'101'112L;
+long LongFormattedInteger1 = 12'345'678'910'111'213l;
+long MinusLongFormattedInteger1 = -12'345'678'910'111'213l;
+unsigned long UnsignedLongFormattedInteger1 = 12'345'678'910'111'213Ul;
+unsigned long MinusUnsignedLongFormattedInteger1 = -12'345'678'910'111'213Ul;
+float FormattedFloat = 1'234.567'89;
+float MinusFormattedFloat = -1'234.567'89;
+double PostfixFormattedFloat = 1'234.569F;
+double MinusPostfixFormattedFloat = -1'234.569F;
+double PostfixFormattedFloat1 = 1'234.569f;
+double MinusPostfixFormattedFloat1 = -1'234.569f;
 //double ScientificFormattedFloat = 1.234'567'8E10;
 //double MinusScientificFormattedFloat = -1.234'567'8E10;
 //double ScientificFormattedFloat1 = 1.234'567'8e10;

>From 91b7ff1f53b63f930cee229a67798a6dc6203a9c Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Tue, 26 Dec 2023 14:53:39 +0300
Subject: [PATCH 59/76] Remove using streams

---
 .../modernize/UseDigitSeparatorCheck.cpp      | 32 ++++++-------------
 1 file changed, 9 insertions(+), 23 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 3f1d4b0e7c8ef6..57681b69733887 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -7,10 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 #include <algorithm>
-#include <iomanip>
 #include <numeric>
 #include <regex>
-#include <sstream>
 
 #include "UseDigitSeparatorCheck.h"
 #include "clang/AST/ASTContext.h"
@@ -99,23 +97,13 @@ std::string getFormatedFloatString(const llvm::StringRef OriginalLiteralString,
     return getFormatedScientificFloatString(OriginalLiteralString);
   }
 
-  // Configure formatting
+  // Configure formatting and get precision
   std::string Postfix;
+  int Precision = 0;
   for (const char &Character : OriginalLiteralString) {
     if (!std::isdigit(Character) && Character != '.' && Character != '\'') {
       Postfix += Character;
-    }
-  }
-
-  // Get precision
-  const std::string::size_type OriginalDotPosition =
-      OriginalLiteralString.find('.');
-  const llvm::StringRef OriginalFractionalSubString =
-      OriginalLiteralString.substr(OriginalDotPosition + 1,
-                                   OriginalLiteralString.size());
-  int Precision = 0;
-  for (const char &Character : OriginalFractionalSubString) {
-    if (std::isdigit(Character)) {
+    } else if (std::isdigit(Character)) {
       Precision++;
     }
   }
@@ -123,23 +111,21 @@ std::string getFormatedFloatString(const llvm::StringRef OriginalLiteralString,
   // Get formatting literal text
 
   // Get string representation of float value
-  std::ostringstream StringStream;
-  StringStream << std::fixed << std::setprecision(Precision)
-               << FloatValue.convertToDouble();
-  const std::string FloatString = StringStream.str();
+  llvm::SmallString<128> FloatString;
+  FloatValue.toString(FloatString, Precision);
 
   // Get integer and fractional parts of float number
   const std::string::size_type DotPosition = FloatString.find('.');
-  const std::string IntegerSubString = FloatString.substr(0, DotPosition);
-  std::string FractionalSubString =
+  const llvm::SmallString<128> IntegerSubString = FloatString.substr(0, DotPosition);
+  llvm::SmallString<128> FractionalSubString =
       FloatString.substr(DotPosition + 1, FloatString.size());
   std::reverse(FractionalSubString.begin(), FractionalSubString.end());
 
   // Get formatting literal text
   const std::string FormatedIntegerSubString = getFormatedIntegerString(
-      IntegerSubString, llvm::APInt(128, std::stoll(IntegerSubString)));
+      IntegerSubString, llvm::APInt(128, std::stoll(IntegerSubString.str().str())));
   std::string FormatedFractionalSubString = getFormatedIntegerString(
-      FractionalSubString, llvm::APInt(128, std::stoll(FractionalSubString)));
+      FractionalSubString, llvm::APInt(128, std::stoll(FractionalSubString.str().str())));
   std::reverse(FormatedFractionalSubString.begin(),
                FormatedFractionalSubString.end());
 

>From aaaac010eb2c4c2608173376f4ef60c0f1892b41 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Tue, 26 Dec 2023 14:54:17 +0300
Subject: [PATCH 60/76] Formatting

---
 .../clang-tidy/modernize/UseDigitSeparatorCheck.cpp      | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 57681b69733887..0f75b420a09d5b 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -116,16 +116,19 @@ std::string getFormatedFloatString(const llvm::StringRef OriginalLiteralString,
 
   // Get integer and fractional parts of float number
   const std::string::size_type DotPosition = FloatString.find('.');
-  const llvm::SmallString<128> IntegerSubString = FloatString.substr(0, DotPosition);
+  const llvm::SmallString<128> IntegerSubString =
+      FloatString.substr(0, DotPosition);
   llvm::SmallString<128> FractionalSubString =
       FloatString.substr(DotPosition + 1, FloatString.size());
   std::reverse(FractionalSubString.begin(), FractionalSubString.end());
 
   // Get formatting literal text
   const std::string FormatedIntegerSubString = getFormatedIntegerString(
-      IntegerSubString, llvm::APInt(128, std::stoll(IntegerSubString.str().str())));
+      IntegerSubString,
+      llvm::APInt(128, std::stoll(IntegerSubString.str().str())));
   std::string FormatedFractionalSubString = getFormatedIntegerString(
-      FractionalSubString, llvm::APInt(128, std::stoll(FractionalSubString.str().str())));
+      FractionalSubString,
+      llvm::APInt(128, std::stoll(FractionalSubString.str().str())));
   std::reverse(FormatedFractionalSubString.begin(),
                FormatedFractionalSubString.end());
 

>From 2ded896e9226ee8a2be624d7f40f426aece46d31 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Tue, 26 Dec 2023 15:31:50 +0300
Subject: [PATCH 61/76] Fix scientific notation bug

---
 .../modernize/UseDigitSeparatorCheck.cpp      | 14 +++++++++--
 .../modernize/use-digit-separator.cpp         | 24 +++++++++----------
 2 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 0f75b420a09d5b..30f1855f39c300 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -153,12 +153,22 @@ getFormatedScientificFloatString(const llvm::StringRef OriginalLiteralString) {
       OriginalLiteralString.substr(0, EPosition);
   const llvm::StringRef ExponentSubString = OriginalLiteralString.substr(
       EPosition + SignSymbol.size() + 1, OriginalLiteralString.size());
+  std::string MantissaSubStringWithoutBraces = MantissaSubString.str();
+  MantissaSubStringWithoutBraces.erase(std::remove_if(MantissaSubStringWithoutBraces.begin(),
+                                                      MantissaSubStringWithoutBraces.end(),
+                            [](unsigned char Char) { return Char == '\''; }),
+                                       MantissaSubStringWithoutBraces.end());
+  std::string ExponentSubStringWithoutBraces = ExponentSubString.str();
+  ExponentSubStringWithoutBraces.erase(std::remove_if(ExponentSubStringWithoutBraces.begin(),
+                                                      ExponentSubStringWithoutBraces.end(),
+                                                      [](unsigned char Char) { return Char == '\''; }),
+                                       ExponentSubStringWithoutBraces.end());
 
   // Get formatting literal text
   const std::string FormatedMantissaString = getFormatedFloatString(
-      MantissaSubString, llvm::APFloat(std::stod(MantissaSubString.str())));
+      MantissaSubString, llvm::APFloat(std::stod(MantissaSubStringWithoutBraces)));
   const std::string FormatedExponentString = getFormatedIntegerString(
-      ExponentSubString, llvm::APInt(128, std::stoll(ExponentSubString.str())));
+      ExponentSubString, llvm::APInt(128, std::stoll(ExponentSubStringWithoutBraces)));
   return FormatedMantissaString + EChar + SignSymbol + FormatedExponentString;
 }
 } // namespace
diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
index bebeac52f4251f..7bde91f9d363e8 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
@@ -218,15 +218,15 @@ double PostfixFormattedFloat = 1'234.569F;
 double MinusPostfixFormattedFloat = -1'234.569F;
 double PostfixFormattedFloat1 = 1'234.569f;
 double MinusPostfixFormattedFloat1 = -1'234.569f;
-//double ScientificFormattedFloat = 1.234'567'8E10;
-//double MinusScientificFormattedFloat = -1.234'567'8E10;
-//double ScientificFormattedFloat1 = 1.234'567'8e10;
-//double MinusScientificFormattedFloat1 = -1.234'567'8e10;
-//double ScientificFormattedFloat2 = 1.234'567'8E+10;
-//double MinusScientificFormattedFloat2 = -1.234'567'8E+10;
-//double ScientificFormattedFloat3 = 1.234'567'8e+10;
-//double MinusScientificFormattedFloat3 = -1.234'567'8e+10;
-//double PostfixScientificFormattedFloat = 1.234'567'8E10F;
-//double PostfixScientificFormattedFloat1 = 1.234'567'8e10f;
-//double PostfixScientificFormattedFloat2 = -1.234'567'8E+10f;
-//double PostfixScientificFormattedFloat4 = -1.234'567'8e-10F;
+double ScientificFormattedFloat = 1.234'567'8E10;
+double MinusScientificFormattedFloat = -1.234'567'8E10;
+double ScientificFormattedFloat1 = 1.234'567'8e10;
+double MinusScientificFormattedFloat1 = -1.234'567'8e10;
+double ScientificFormattedFloat2 = 1.234'567'8E+10;
+double MinusScientificFormattedFloat2 = -1.234'567'8E+10;
+double ScientificFormattedFloat3 = 1.234'567'8e+10;
+double MinusScientificFormattedFloat3 = -1.234'567'8e+10;
+double PostfixScientificFormattedFloat = 1.234'567'8E10F;
+double PostfixScientificFormattedFloat1 = 1.234'567'8e10f;
+double PostfixScientificFormattedFloat2 = -1.234'567'8E+10f;
+double PostfixScientificFormattedFloat4 = -1.234'567'8e-10F;

>From c157fabc95476cd20ef24b3e57fd156e8c7bc8b8 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Tue, 26 Dec 2023 15:32:12 +0300
Subject: [PATCH 62/76] Formatting

---
 .../modernize/UseDigitSeparatorCheck.cpp      | 24 +++++++++++--------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 30f1855f39c300..ed2acb2bbdf931 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -154,21 +154,25 @@ getFormatedScientificFloatString(const llvm::StringRef OriginalLiteralString) {
   const llvm::StringRef ExponentSubString = OriginalLiteralString.substr(
       EPosition + SignSymbol.size() + 1, OriginalLiteralString.size());
   std::string MantissaSubStringWithoutBraces = MantissaSubString.str();
-  MantissaSubStringWithoutBraces.erase(std::remove_if(MantissaSubStringWithoutBraces.begin(),
-                                                      MantissaSubStringWithoutBraces.end(),
-                            [](unsigned char Char) { return Char == '\''; }),
-                                       MantissaSubStringWithoutBraces.end());
+  MantissaSubStringWithoutBraces.erase(
+      std::remove_if(MantissaSubStringWithoutBraces.begin(),
+                     MantissaSubStringWithoutBraces.end(),
+                     [](unsigned char Char) { return Char == '\''; }),
+      MantissaSubStringWithoutBraces.end());
   std::string ExponentSubStringWithoutBraces = ExponentSubString.str();
-  ExponentSubStringWithoutBraces.erase(std::remove_if(ExponentSubStringWithoutBraces.begin(),
-                                                      ExponentSubStringWithoutBraces.end(),
-                                                      [](unsigned char Char) { return Char == '\''; }),
-                                       ExponentSubStringWithoutBraces.end());
+  ExponentSubStringWithoutBraces.erase(
+      std::remove_if(ExponentSubStringWithoutBraces.begin(),
+                     ExponentSubStringWithoutBraces.end(),
+                     [](unsigned char Char) { return Char == '\''; }),
+      ExponentSubStringWithoutBraces.end());
 
   // Get formatting literal text
   const std::string FormatedMantissaString = getFormatedFloatString(
-      MantissaSubString, llvm::APFloat(std::stod(MantissaSubStringWithoutBraces)));
+      MantissaSubString,
+      llvm::APFloat(std::stod(MantissaSubStringWithoutBraces)));
   const std::string FormatedExponentString = getFormatedIntegerString(
-      ExponentSubString, llvm::APInt(128, std::stoll(ExponentSubStringWithoutBraces)));
+      ExponentSubString,
+      llvm::APInt(128, std::stoll(ExponentSubStringWithoutBraces)));
   return FormatedMantissaString + EChar + SignSymbol + FormatedExponentString;
 }
 } // namespace

>From 8bb32be84ed34bb613d5f83cd22a09bdbdccacab Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Tue, 26 Dec 2023 17:53:01 +0300
Subject: [PATCH 63/76] Add tests for long wrong formatted literals

---
 .../modernize/use-digit-separator.cpp         | 147 ++++++++++++++++++
 1 file changed, 147 insertions(+)

diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
index 7bde91f9d363e8..9301a64d00c835 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
@@ -230,3 +230,150 @@ double PostfixScientificFormattedFloat = 1.234'567'8E10F;
 double PostfixScientificFormattedFloat1 = 1.234'567'8e10f;
 double PostfixScientificFormattedFloat2 = -1.234'567'8E+10f;
 double PostfixScientificFormattedFloat4 = -1.234'567'8e-10F;
+
+
+// Long wrong formatted literals
+
+int WrongFormattedInteger = 1'2345'6'7;
+// CHECK-MESSAGES: :[[@LINE-1]]:29: warning: unformatted representation of integer literal '1'2345'6'7' [modernize-use-digit-separator]
+// CHECK-FIXES: 1'234'567
+
+int MinusWrongFormattedInteger = -1'2'3'4'5'6'7;
+// CHECK-MESSAGES: :[[@LINE-1]]:35: warning: unformatted representation of integer literal '1'2'3'4'5'6'7' [modernize-use-digit-separator]
+// CHECK-FIXES: 1'234'567
+
+int BinaryWrongFormattedInteger = 0b111'01101;
+// CHECK-MESSAGES: :[[@LINE-1]]:35: warning: unformatted representation of integer literal '0b111'01101' [modernize-use-digit-separator]
+// CHECK-FIXES: 0b1110'1101
+
+int MinusBinaryWrongFormattedInteger = -0b11'10'11'01;
+// CHECK-MESSAGES: :[[@LINE-1]]:41: warning: unformatted representation of integer literal '0b11'10'11'01' [modernize-use-digit-separator]
+// CHECK-FIXES: 0b1110'1101
+
+int OctWrongFormattedInteger = 0'37512;
+// CHECK-MESSAGES: :[[@LINE-1]]:32: warning: unformatted representation of integer literal '0'37512' [modernize-use-digit-separator]
+// CHECK-FIXES: 037'512
+
+int MinusOctWrongFormattedInteger = -037'5'12;
+// CHECK-MESSAGES: :[[@LINE-1]]:38: warning: unformatted representation of integer literal '037'5'12' [modernize-use-digit-separator]
+// CHECK-FIXES: 037'512
+
+int HexWrongFormattedInteger = 0x4f3'56;
+// CHECK-MESSAGES: :[[@LINE-1]]:32: warning: unformatted representation of integer literal '0x4f3'56' [modernize-use-digit-separator]
+// CHECK-FIXES: 0x4'F356
+
+int MinusHexWrongFormattedInteger = -0x4'f3'5'6;
+// CHECK-MESSAGES: :[[@LINE-1]]:38: warning: unformatted representation of integer literal '0x4'f3'5'6' [modernize-use-digit-separator]
+// CHECK-FIXES: 0x4'F356
+
+unsigned int UnsignedWrongFormattedInteger = 1'0004U;
+// CHECK-MESSAGES: :[[@LINE-1]]:46: warning: unformatted representation of integer literal '1'0004U' [modernize-use-digit-separator]
+// CHECK-FIXES: 10'004U
+
+unsigned int MinusUnsignedWrongFormattedInteger = -100'0'4U;
+// CHECK-MESSAGES: :[[@LINE-1]]:52: warning: unformatted representation of integer literal '100'0'4U' [modernize-use-digit-separator]
+// CHECK-FIXES: 10'004U
+
+unsigned int UnsignedWrongFormattedInteger1 = 10'0045u;
+// CHECK-MESSAGES: :[[@LINE-1]]:47: warning: unformatted representation of integer literal '10'0045u' [modernize-use-digit-separator]
+// CHECK-FIXES: 100'045u
+
+unsigned int MinusUnsignedWrongFormattedInteger1 = -10'00'45u;
+// CHECK-MESSAGES: :[[@LINE-1]]:53: warning: unformatted representation of integer literal '10'00'45u' [modernize-use-digit-separator]
+// CHECK-FIXES: 100'045u
+
+long LongWrongFormattedInteger = 1234'56'789'1011'12L;
+// CHECK-MESSAGES: :[[@LINE-1]]:34: warning: unformatted representation of integer literal '1234'56'789'1011'12L' [modernize-use-digit-separator]
+// CHECK-FIXES: 123'456'789'101'112L
+
+long MinusLongWrongFormattedInteger = -1'234567891'011'1'2L;
+// CHECK-MESSAGES: :[[@LINE-1]]:40: warning: unformatted representation of integer literal '1'234567891'011'1'2L' [modernize-use-digit-separator]
+// CHECK-FIXES: 123'456'789'101'112L
+
+long LongWrongFormattedInteger1 = 12345'67'89101'11213l;
+// CHECK-MESSAGES: :[[@LINE-1]]:35: warning: unformatted representation of integer literal '12345'67'89101'11213l' [modernize-use-digit-separator]
+// CHECK-FIXES: 12'345'678'910'111'213l
+
+long MinusLongWrongFormattedInteger1 = -1234567891'0111213l;
+// CHECK-MESSAGES: :[[@LINE-1]]:41: warning: unformatted representation of integer literal '1234567891'0111213l' [modernize-use-digit-separator]
+// CHECK-FIXES: 12'345'678'910'111'213l
+
+unsigned long UnsignedLongWrongFormattedInteger1 = 1234567'89101112'13Ul;
+// CHECK-MESSAGES: :[[@LINE-1]]:52: warning: unformatted representation of integer literal '1234567'89101112'13Ul' [modernize-use-digit-separator]
+// CHECK-FIXES: 12'345'678'910'111'213Ul
+
+unsigned long MinusUnsignedLongWrongFormattedInteger1 = -1'2'34'567'89'10'11'12'1'3Ul;
+// CHECK-MESSAGES: :[[@LINE-1]]:58: warning: unformatted representation of integer literal '1'2'34'567'89'10'11'12'1'3Ul' [modernize-use-digit-separator]
+// CHECK-FIXES: 12'345'678'910'111'213Ul
+
+float WrongFormattedFloat = 1'234.56789;
+// CHECK-MESSAGES: :[[@LINE-1]]:29: warning: unformatted representation of float literal '1'234.56789' [modernize-use-digit-separator]
+// CHECK-FIXES: 1'234.567'89
+
+float MinusWrongFormattedFloat = -1234.56'789;
+// CHECK-MESSAGES: :[[@LINE-1]]:35: warning: unformatted representation of float literal '1234.56'789' [modernize-use-digit-separator]
+// CHECK-FIXES: 1'234.567'89
+
+double PostfixWrongFormattedFloat = 123'4.5'69F;
+// CHECK-MESSAGES: :[[@LINE-1]]:37: warning: unformatted representation of float literal '123'4.5'69F' [modernize-use-digit-separator]
+// CHECK-FIXES: 1'234.569F
+
+double MinusPostfixWrongFormattedFloat = -12'34.569F;
+// CHECK-MESSAGES: :[[@LINE-1]]:43: warning: unformatted representation of float literal '12'34.569F' [modernize-use-digit-separator]
+// CHECK-FIXES: 1'234.569F
+
+double PostfixWrongFormattedFloat1 = 1'2'34.569f;
+// CHECK-MESSAGES: :[[@LINE-1]]:38: warning: unformatted representation of float literal '1'2'34.569f' [modernize-use-digit-separator]
+// CHECK-FIXES: 1'234.569f
+
+double MinusPostfixWrongFormattedFloat1 = -12'3'4.5'69f;
+// CHECK-MESSAGES: :[[@LINE-1]]:44: warning: unformatted representation of float literal '12'3'4.5'69f' [modernize-use-digit-separator]
+// CHECK-FIXES: 1'234.569f
+
+double ScientificWrongFormattedFloat = 1.23'456'78E1'0;
+// CHECK-MESSAGES: :[[@LINE-1]]:40: warning: unformatted representation of float literal '1.23'456'78E1'0' [modernize-use-digit-separator]
+// CHECK-FIXES: 1.234'567'8E10
+
+double MinusScientificWrongFormattedFloat = -1.234'5678E10;
+// CHECK-MESSAGES: :[[@LINE-1]]:46: warning: unformatted representation of float literal '1.234'5678E10' [modernize-use-digit-separator]
+// CHECK-FIXES: 1.234'567'8E10
+
+double ScientificWrongFormattedFloat1 = 1.234'5'67'8e10;
+// CHECK-MESSAGES: :[[@LINE-1]]:41: warning: unformatted representation of float literal '1.234'5'67'8e10' [modernize-use-digit-separator]
+// CHECK-FIXES: 1.234'567'8e10
+
+double MinusScientificWrongFormattedFloat1 = -1.2345678e1'0;
+// CHECK-MESSAGES: :[[@LINE-1]]:47: warning: unformatted representation of float literal '1.2345678e1'0' [modernize-use-digit-separator]
+// CHECK-FIXES: 1.234'567'8e10
+
+double ScientificWrongFormattedFloat2 = 1.23456'78E+1'0;
+// CHECK-MESSAGES: :[[@LINE-1]]:41: warning: unformatted representation of float literal '1.23456'78E+1'0' [modernize-use-digit-separator]
+// CHECK-FIXES: 1.234'567'8E+10
+
+double MinusScientificWrongFormattedFloat2 = -1.23'456'78E+10;
+// CHECK-MESSAGES: :[[@LINE-1]]:47: warning: unformatted representation of float literal '1.23'456'78E+10' [modernize-use-digit-separator]
+// CHECK-FIXES: 1.234'567'8E+10
+
+double ScientificWrongFormattedFloat3 = 1.234'56'78e+10;
+// CHECK-MESSAGES: :[[@LINE-1]]:41: warning: unformatted representation of float literal '1.234'56'78e+10' [modernize-use-digit-separator]
+// CHECK-FIXES: 1.234'567'8e+10
+
+double MinusScientificWrongFormattedFloat3 = -1.2'3'4'5'678e+1'0;
+// CHECK-MESSAGES: :[[@LINE-1]]:47: warning: unformatted representation of float literal '1.2'3'4'5'678e+1'0' [modernize-use-digit-separator]
+// CHECK-FIXES: 1.234'567'8e+10
+
+double PostfixScientificWrongFormattedFloat = 1.23456'78E1'0F;
+// CHECK-MESSAGES: :[[@LINE-1]]:47: warning: unformatted representation of float literal '1.23456'78E1'0F' [modernize-use-digit-separator]
+// CHECK-FIXES: 1.234'567'8E10F
+
+double PostfixScientificWrongFormattedFloat1 = 1.23'45'6'7'8e10f;
+// CHECK-MESSAGES: :[[@LINE-1]]:48: warning: unformatted representation of float literal '1.23'45'6'7'8e10f' [modernize-use-digit-separator]
+// CHECK-FIXES: 1.234'567'8e10f
+
+double PostfixScientificWrongFormattedFloat2 = -1.2'34'56'7'8E+10f;
+// CHECK-MESSAGES: :[[@LINE-1]]:49: warning: unformatted representation of float literal '1.2'34'56'7'8E+10f' [modernize-use-digit-separator]
+// CHECK-FIXES: 1.234'567'8E+10f
+
+double PostfixScientificWrongFormattedFloat4 = -1.23'456'78e-1'0F;
+// CHECK-MESSAGES: :[[@LINE-1]]:49: warning: unformatted representation of float literal '1.23'456'78e-1'0F' [modernize-use-digit-separator]
+// CHECK-FIXES: 1.234'567'8e-10F

>From 42a180938debde1aecfaf1b6b0e31e62dd02a998 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Tue, 26 Dec 2023 18:18:43 +0300
Subject: [PATCH 64/76] Write required c++ version in docs

---
 clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.h b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.h
index 7f819420f85797..e6e3ccc783ef5b 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.h
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.h
@@ -24,6 +24,8 @@ namespace clang::tidy::modernize {
 ///     - floating-point constants, group into 3 digits on either side of the
 ///     decimal point, e.g. float x = 3'456.001'25f;
 ///
+/// Requires c++ version 14 or later
+///
 /// For the user-facing documentation see:
 /// http://clang.llvm.org/extra/clang-tidy/checks/modernize/use-digit-separator.html
 class UseDigitSeparatorCheck : public ClangTidyCheck {

>From 57d8e576d963d6078ab76bc2ab379c633384c6cc Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Wed, 27 Dec 2023 20:34:26 +0300
Subject: [PATCH 65/76] Fix check fix and add tests with assignment expression.

---
 .../modernize/UseDigitSeparatorCheck.cpp      |   4 +-
 .../modernize/use-digit-separator.cpp         | 147 ++++++++++++++++++
 2 files changed, 149 insertions(+), 2 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index ed2acb2bbdf931..b7da4aa93a5416 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -208,7 +208,7 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
       diag(MatchedInteger->getLocation(),
            "unformatted representation of integer literal '%0'")
           << OriginalLiteralString
-          << FixItHint::CreateInsertion(MatchedInteger->getLocation(),
+          << FixItHint::CreateReplacement(MatchedInteger->getLocation(),
                                         FormatedLiteralString);
     }
   } else if (MatchedFloat != nullptr) {
@@ -227,7 +227,7 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
       diag(MatchedFloat->getLocation(),
            "unformatted representation of float literal '%0'")
           << OriginalLiteralString
-          << FixItHint::CreateInsertion(MatchedFloat->getLocation(),
+          << FixItHint::CreateReplacement(MatchedFloat->getLocation(),
                                         FormatedLiteralString);
     }
   } else {
diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
index 9301a64d00c835..0c84881f493729 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
@@ -377,3 +377,150 @@ double PostfixScientificWrongFormattedFloat2 = -1.2'34'56'7'8E+10f;
 double PostfixScientificWrongFormattedFloat4 = -1.23'456'78e-1'0F;
 // CHECK-MESSAGES: :[[@LINE-1]]:49: warning: unformatted representation of float literal '1.23'456'78e-1'0F' [modernize-use-digit-separator]
 // CHECK-FIXES: 1.234'567'8e-10F
+
+
+// Tests with assignment expression. Check that changes affect only literals.
+
+int AssignmentNotFormattedInteger = 1234567;
+// CHECK-MESSAGES: :[[@LINE-1]]:37: warning: unformatted representation of integer literal '1234567' [modernize-use-digit-separator]
+// CHECK-FIXES: {{^}}int AssignmentNotFormattedInteger = 1'234'567;{{$}}
+
+int AssignmentMinusNotFormattedInteger = -1234567;
+// CHECK-MESSAGES: :[[@LINE-1]]:43: warning: unformatted representation of integer literal '1234567' [modernize-use-digit-separator]
+// CHECK-FIXES: {{^}}int AssignmentMinusNotFormattedInteger = -1'234'567;{{$}}
+
+int AssignmentBinaryNotFormattedInteger = 0b11101101;
+// CHECK-MESSAGES: :[[@LINE-1]]:43: warning: unformatted representation of integer literal '0b11101101' [modernize-use-digit-separator]
+// CHECK-FIXES: {{^}}int AssignmentBinaryNotFormattedInteger = 0b1110'1101;{{$}}
+
+int AssignmentMinusBinaryNotFormattedInteger = -0b11101101;
+// CHECK-MESSAGES: :[[@LINE-1]]:49: warning: unformatted representation of integer literal '0b11101101' [modernize-use-digit-separator]
+// CHECK-FIXES: {{^}}int AssignmentMinusBinaryNotFormattedInteger = -0b1110'1101;{{$}}
+
+int AssignmentOctNotFormattedInteger = 037512;
+// CHECK-MESSAGES: :[[@LINE-1]]:40: warning: unformatted representation of integer literal '037512' [modernize-use-digit-separator]
+// CHECK-FIXES: {{^}}int AssignmentOctNotFormattedInteger = 037'512;{{$}}
+
+int AssignmentMinusOctNotFormattedInteger = -037512;
+// CHECK-MESSAGES: :[[@LINE-1]]:46: warning: unformatted representation of integer literal '037512' [modernize-use-digit-separator]
+// CHECK-FIXES: {{^}}int AssignmentMinusOctNotFormattedInteger = -037'512;{{$}}
+
+int AssignmentHexNotFormattedInteger = 0x4f356;
+// CHECK-MESSAGES: :[[@LINE-1]]:40: warning: unformatted representation of integer literal '0x4f356' [modernize-use-digit-separator]
+// CHECK-FIXES: {{^}}int AssignmentHexNotFormattedInteger = 0x4'F356;{{$}}
+
+int AssignmentMinusHexNotFormattedInteger = -0x4f356;
+// CHECK-MESSAGES: :[[@LINE-1]]:46: warning: unformatted representation of integer literal '0x4f356' [modernize-use-digit-separator]
+// CHECK-FIXES: {{^}}int AssignmentMinusHexNotFormattedInteger = -0x4'F356;{{$}}
+
+unsigned int AssignmentUnsignedNotFormattedInteger = 10004U;
+// CHECK-MESSAGES: :[[@LINE-1]]:54: warning: unformatted representation of integer literal '10004U' [modernize-use-digit-separator]
+// CHECK-FIXES: {{^}}unsigned int AssignmentUnsignedNotFormattedInteger = 10'004U;{{$}}
+
+unsigned int AssignmentMinusUnsignedNotFormattedInteger = -10004U;
+// CHECK-MESSAGES: :[[@LINE-1]]:60: warning: unformatted representation of integer literal '10004U' [modernize-use-digit-separator]
+// CHECK-FIXES: {{^}}unsigned int AssignmentMinusUnsignedNotFormattedInteger = -10'004U;{{$}}
+
+unsigned int AssignmentUnsignedNotFormattedInteger1 = 100045u;
+// CHECK-MESSAGES: :[[@LINE-1]]:55: warning: unformatted representation of integer literal '100045u' [modernize-use-digit-separator]
+// CHECK-FIXES: {{^}}unsigned int AssignmentUnsignedNotFormattedInteger1 = 100'045u;{{$}}
+
+unsigned int AssignmentMinusUnsignedNotFormattedInteger1 = -100045u;
+// CHECK-MESSAGES: :[[@LINE-1]]:61: warning: unformatted representation of integer literal '100045u' [modernize-use-digit-separator]
+// CHECK-FIXES: {{^}}unsigned int AssignmentMinusUnsignedNotFormattedInteger1 = -100'045u;{{$}}
+
+long AssignmentLongNotFormattedInteger = 123456789101112L;
+// CHECK-MESSAGES: :[[@LINE-1]]:42: warning: unformatted representation of integer literal '123456789101112L' [modernize-use-digit-separator]
+// CHECK-FIXES: {{^}}long AssignmentLongNotFormattedInteger = 123'456'789'101'112L;{{$}}
+
+long AssignmentMinusLongNotFormattedInteger = -123456789101112L;
+// CHECK-MESSAGES: :[[@LINE-1]]:48: warning: unformatted representation of integer literal '123456789101112L' [modernize-use-digit-separator]
+// CHECK-FIXES: {{^}}long AssignmentMinusLongNotFormattedInteger = -123'456'789'101'112L;{{$}}
+
+long AssignmentLongNotFormattedInteger1 = 12345678910111213l;
+// CHECK-MESSAGES: :[[@LINE-1]]:43: warning: unformatted representation of integer literal '12345678910111213l' [modernize-use-digit-separator]
+// CHECK-FIXES: {{^}}long AssignmentLongNotFormattedInteger1 = 12'345'678'910'111'213l;{{$}}
+
+long AssignmentMinusLongNotFormattedInteger1 = -12345678910111213l;
+// CHECK-MESSAGES: :[[@LINE-1]]:49: warning: unformatted representation of integer literal '12345678910111213l' [modernize-use-digit-separator]
+// CHECK-FIXES: {{^}}long AssignmentMinusLongNotFormattedInteger1 = -12'345'678'910'111'213l;{{$}}
+
+unsigned long AssignmentUnsignedLongNotFormattedInteger1 = 12345678910111213Ul;
+// CHECK-MESSAGES: :[[@LINE-1]]:60: warning: unformatted representation of integer literal '12345678910111213Ul' [modernize-use-digit-separator]
+// CHECK-FIXES: {{^}}unsigned long AssignmentUnsignedLongNotFormattedInteger1 = 12'345'678'910'111'213Ul;{{$}}
+
+unsigned long AssignmentMinusUnsignedLongNotFormattedInteger1 = -12345678910111213Ul;
+// CHECK-MESSAGES: :[[@LINE-1]]:66: warning: unformatted representation of integer literal '12345678910111213Ul' [modernize-use-digit-separator]
+// CHECK-FIXES: {{^}}unsigned long AssignmentMinusUnsignedLongNotFormattedInteger1 = -12'345'678'910'111'213Ul;{{$}}
+
+float AssignmentNotFormattedFloat = 1234.56789;
+// CHECK-MESSAGES: :[[@LINE-1]]:37: warning: unformatted representation of float literal '1234.56789' [modernize-use-digit-separator]
+// CHECK-FIXES: {{^}}float AssignmentNotFormattedFloat = 1'234.567'89;{{$}}
+
+float AssignmentMinusNotFormattedFloat = -1234.56789;
+// CHECK-MESSAGES: :[[@LINE-1]]:43: warning: unformatted representation of float literal '1234.56789' [modernize-use-digit-separator]
+// CHECK-FIXES: {{^}}float AssignmentMinusNotFormattedFloat = -1'234.567'89;{{$}}
+
+double AssignmentPostfixNotFormattedFloat = 1234.569F;
+// CHECK-MESSAGES: :[[@LINE-1]]:45: warning: unformatted representation of float literal '1234.569F' [modernize-use-digit-separator]
+// CHECK-FIXES: {{^}}double AssignmentPostfixNotFormattedFloat = 1'234.569F;{{$}}
+
+double AssignmentMinusPostfixNotFormattedFloat = -1234.569F;
+// CHECK-MESSAGES: :[[@LINE-1]]:51: warning: unformatted representation of float literal '1234.569F' [modernize-use-digit-separator]
+// CHECK-FIXES: {{^}}double AssignmentMinusPostfixNotFormattedFloat = -1'234.569F;{{$}}
+
+double AssignmentPostfixNotFormattedFloat1 = 1234.569f;
+// CHECK-MESSAGES: :[[@LINE-1]]:46: warning: unformatted representation of float literal '1234.569f' [modernize-use-digit-separator]
+// CHECK-FIXES: {{^}}double AssignmentPostfixNotFormattedFloat1 = 1'234.569f;{{$}}
+
+double AssignmentMinusPostfixNotFormattedFloat1 = -1234.569f;
+// CHECK-MESSAGES: :[[@LINE-1]]:52: warning: unformatted representation of float literal '1234.569f' [modernize-use-digit-separator]
+// CHECK-FIXES: {{^}}double AssignmentMinusPostfixNotFormattedFloat1 = -1'234.569f;{{$}}
+
+double AssignmentScientificNotFormattedFloat = 1.2345678E10;
+// CHECK-MESSAGES: :[[@LINE-1]]:48: warning: unformatted representation of float literal '1.2345678E10' [modernize-use-digit-separator]
+// CHECK-FIXES: {{^}}double AssignmentScientificNotFormattedFloat = 1.234'567'8E10;{{$}}
+
+double AssignmentMinusScientificNotFormattedFloat = -1.2345678E10;
+// CHECK-MESSAGES: :[[@LINE-1]]:54: warning: unformatted representation of float literal '1.2345678E10' [modernize-use-digit-separator]
+// CHECK-FIXES: {{^}}double AssignmentMinusScientificNotFormattedFloat = -1.234'567'8E10;{{$}}
+
+double AssignmentScientificNotFormattedFloat1 = 1.2345678e10;
+// CHECK-MESSAGES: :[[@LINE-1]]:49: warning: unformatted representation of float literal '1.2345678e10' [modernize-use-digit-separator]
+// CHECK-FIXES: {{^}}double AssignmentScientificNotFormattedFloat1 = 1.234'567'8e10;{{$}}
+
+double AssignmentMinusScientificNotFormattedFloat1 = -1.2345678e10;
+// CHECK-MESSAGES: :[[@LINE-1]]:55: warning: unformatted representation of float literal '1.2345678e10' [modernize-use-digit-separator]
+// CHECK-FIXES: {{^}}double AssignmentMinusScientificNotFormattedFloat1 = -1.234'567'8e10;{{$}}
+
+double AssignmentScientificNotFormattedFloat2 = 1.2345678E+10;
+// CHECK-MESSAGES: :[[@LINE-1]]:49: warning: unformatted representation of float literal '1.2345678E+10' [modernize-use-digit-separator]
+// CHECK-FIXES: {{^}}double AssignmentScientificNotFormattedFloat2 = 1.234'567'8E+10;{{$}}
+
+double AssignmentMinusScientificNotFormattedFloat2 = -1.2345678E+10;
+// CHECK-MESSAGES: :[[@LINE-1]]:55: warning: unformatted representation of float literal '1.2345678E+10' [modernize-use-digit-separator]
+// CHECK-FIXES: {{^}}double AssignmentMinusScientificNotFormattedFloat2 = -1.234'567'8E+10;{{$}}
+
+double AssignmentScientificNotFormattedFloat3 = 1.2345678e+10;
+// CHECK-MESSAGES: :[[@LINE-1]]:49: warning: unformatted representation of float literal '1.2345678e+10' [modernize-use-digit-separator]
+// CHECK-FIXES: {{^}}double AssignmentScientificNotFormattedFloat3 = 1.234'567'8e+10;{{$}}
+
+double AssignmentMinusScientificNotFormattedFloat3 = -1.2345678e+10;
+// CHECK-MESSAGES: :[[@LINE-1]]:55: warning: unformatted representation of float literal '1.2345678e+10' [modernize-use-digit-separator]
+// CHECK-FIXES: {{^}}double AssignmentMinusScientificNotFormattedFloat3 = -1.234'567'8e+10;{{$}}
+
+double AssignmentPostfixScientificNotFormattedFloat = 1.2345678E10F;
+// CHECK-MESSAGES: :[[@LINE-1]]:55: warning: unformatted representation of float literal '1.2345678E10F' [modernize-use-digit-separator]
+// CHECK-FIXES: {{^}}double AssignmentPostfixScientificNotFormattedFloat = 1.234'567'8E10F;{{$}}
+
+double AssignmentPostfixScientificNotFormattedFloat1 = 1.2345678e10f;
+// CHECK-MESSAGES: :[[@LINE-1]]:56: warning: unformatted representation of float literal '1.2345678e10f' [modernize-use-digit-separator]
+// CHECK-FIXES: {{^}}double AssignmentPostfixScientificNotFormattedFloat1 = 1.234'567'8e10f;{{$}}
+
+double AssignmentPostfixScientificNotFormattedFloat2 = -1.2345678E+10f;
+// CHECK-MESSAGES: :[[@LINE-1]]:57: warning: unformatted representation of float literal '1.2345678E+10f' [modernize-use-digit-separator]
+// CHECK-FIXES: {{^}}double AssignmentPostfixScientificNotFormattedFloat2 = -1.234'567'8E+10f;{{$}}
+
+double AssignmentPostfixScientificNotFormattedFloat4 = -1.2345678e-10F;
+// CHECK-MESSAGES: :[[@LINE-1]]:57: warning: unformatted representation of float literal '1.2345678e-10F' [modernize-use-digit-separator]
+// CHECK-FIXES: {{^}}double AssignmentPostfixScientificNotFormattedFloat4 = -1.234'567'8e-10F;{{$}}

>From 4675cfa907a27495556e219602c7ec5723dddf35 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Wed, 27 Dec 2023 20:34:55 +0300
Subject: [PATCH 66/76] Formatting

---
 .../clang-tidy/modernize/UseDigitSeparatorCheck.cpp           | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index b7da4aa93a5416..aa99329ee34c04 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -209,7 +209,7 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
            "unformatted representation of integer literal '%0'")
           << OriginalLiteralString
           << FixItHint::CreateReplacement(MatchedInteger->getLocation(),
-                                        FormatedLiteralString);
+                                          FormatedLiteralString);
     }
   } else if (MatchedFloat != nullptr) {
     // Get original literal source text
@@ -228,7 +228,7 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
            "unformatted representation of float literal '%0'")
           << OriginalLiteralString
           << FixItHint::CreateReplacement(MatchedFloat->getLocation(),
-                                        FormatedLiteralString);
+                                          FormatedLiteralString);
     }
   } else {
     assert(0);

>From 7253f4bb858b1ef878074c78c12d7c39c6a3815a Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Wed, 27 Dec 2023 21:05:54 +0300
Subject: [PATCH 67/76] Use llvm_unreachable

---
 .../clang-tidy/modernize/UseDigitSeparatorCheck.cpp  | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index aa99329ee34c04..4d7333de7ed5d9 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -211,7 +211,11 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
           << FixItHint::CreateReplacement(MatchedInteger->getLocation(),
                                           FormatedLiteralString);
     }
-  } else if (MatchedFloat != nullptr) {
+
+    return;
+  }
+
+  if (MatchedFloat != nullptr) {
     // Get original literal source text
     const llvm::StringRef OriginalLiteralString = Lexer::getSourceText(
         CharSourceRange::getTokenRange(MatchedFloat->getSourceRange()), Source,
@@ -230,9 +234,11 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
           << FixItHint::CreateReplacement(MatchedFloat->getLocation(),
                                           FormatedLiteralString);
     }
-  } else {
-    assert(0);
+
+    return;
   }
+
+  llvm_unreachable("Unreachable code in UseDigitSeparatorCheck");
 }
 
 } // namespace clang::tidy::modernize

>From 5c0f52480931ad59b3bbd81f4a452d8adb942081 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Wed, 27 Dec 2023 21:28:58 +0300
Subject: [PATCH 68/76] Change message for floating literals

---
 .../modernize/UseDigitSeparatorCheck.cpp      |   2 +-
 .../modernize/use-digit-separator.cpp         | 108 +++++++++---------
 2 files changed, 55 insertions(+), 55 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 4d7333de7ed5d9..5832d41f8546ab 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -229,7 +229,7 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
     // Compare the original and formatted representation of a literal
     if (OriginalLiteralString != FormatedLiteralString) {
       diag(MatchedFloat->getLocation(),
-           "unformatted representation of float literal '%0'")
+           "unformatted representation of floating literal '%0'")
           << OriginalLiteralString
           << FixItHint::CreateReplacement(MatchedFloat->getLocation(),
                                           FormatedLiteralString);
diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
index 0c84881f493729..e3dc6569a6ff58 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
@@ -76,75 +76,75 @@ unsigned long MinusUnsignedLongNotFormattedInteger1 = -12345678910111213Ul;
 // CHECK-FIXES: 12'345'678'910'111'213Ul
 
 float NotFormattedFloat = 1234.56789;
-// CHECK-MESSAGES: :[[@LINE-1]]:27: warning: unformatted representation of float literal '1234.56789' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:27: warning: unformatted representation of floating literal '1234.56789' [modernize-use-digit-separator]
 // CHECK-FIXES: 1'234.567'89
 
 float MinusNotFormattedFloat = -1234.56789;
-// CHECK-MESSAGES: :[[@LINE-1]]:33: warning: unformatted representation of float literal '1234.56789' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:33: warning: unformatted representation of floating literal '1234.56789' [modernize-use-digit-separator]
 // CHECK-FIXES: 1'234.567'89
 
 double PostfixNotFormattedFloat = 1234.569F;
-// CHECK-MESSAGES: :[[@LINE-1]]:35: warning: unformatted representation of float literal '1234.569F' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:35: warning: unformatted representation of floating literal '1234.569F' [modernize-use-digit-separator]
 // CHECK-FIXES: 1'234.569F
 
 double MinusPostfixNotFormattedFloat = -1234.569F;
-// CHECK-MESSAGES: :[[@LINE-1]]:41: warning: unformatted representation of float literal '1234.569F' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:41: warning: unformatted representation of floating literal '1234.569F' [modernize-use-digit-separator]
 // CHECK-FIXES: 1'234.569F
 
 double PostfixNotFormattedFloat1 = 1234.569f;
-// CHECK-MESSAGES: :[[@LINE-1]]:36: warning: unformatted representation of float literal '1234.569f' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:36: warning: unformatted representation of floating literal '1234.569f' [modernize-use-digit-separator]
 // CHECK-FIXES: 1'234.569f
 
 double MinusPostfixNotFormattedFloat1 = -1234.569f;
-// CHECK-MESSAGES: :[[@LINE-1]]:42: warning: unformatted representation of float literal '1234.569f' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:42: warning: unformatted representation of floating literal '1234.569f' [modernize-use-digit-separator]
 // CHECK-FIXES: 1'234.569f
 
 double ScientificNotFormattedFloat = 1.2345678E10;
-// CHECK-MESSAGES: :[[@LINE-1]]:38: warning: unformatted representation of float literal '1.2345678E10' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:38: warning: unformatted representation of floating literal '1.2345678E10' [modernize-use-digit-separator]
 // CHECK-FIXES: 1.234'567'8E10
 
 double MinusScientificNotFormattedFloat = -1.2345678E10;
-// CHECK-MESSAGES: :[[@LINE-1]]:44: warning: unformatted representation of float literal '1.2345678E10' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:44: warning: unformatted representation of floating literal '1.2345678E10' [modernize-use-digit-separator]
 // CHECK-FIXES: 1.234'567'8E10
 
 double ScientificNotFormattedFloat1 = 1.2345678e10;
-// CHECK-MESSAGES: :[[@LINE-1]]:39: warning: unformatted representation of float literal '1.2345678e10' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:39: warning: unformatted representation of floating literal '1.2345678e10' [modernize-use-digit-separator]
 // CHECK-FIXES: 1.234'567'8e10
 
 double MinusScientificNotFormattedFloat1 = -1.2345678e10;
-// CHECK-MESSAGES: :[[@LINE-1]]:45: warning: unformatted representation of float literal '1.2345678e10' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:45: warning: unformatted representation of floating literal '1.2345678e10' [modernize-use-digit-separator]
 // CHECK-FIXES: 1.234'567'8e10
 
 double ScientificNotFormattedFloat2 = 1.2345678E+10;
-// CHECK-MESSAGES: :[[@LINE-1]]:39: warning: unformatted representation of float literal '1.2345678E+10' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:39: warning: unformatted representation of floating literal '1.2345678E+10' [modernize-use-digit-separator]
 // CHECK-FIXES: 1.234'567'8E+10
 
 double MinusScientificNotFormattedFloat2 = -1.2345678E+10;
-// CHECK-MESSAGES: :[[@LINE-1]]:45: warning: unformatted representation of float literal '1.2345678E+10' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:45: warning: unformatted representation of floating literal '1.2345678E+10' [modernize-use-digit-separator]
 // CHECK-FIXES: 1.234'567'8E+10
 
 double ScientificNotFormattedFloat3 = 1.2345678e+10;
-// CHECK-MESSAGES: :[[@LINE-1]]:39: warning: unformatted representation of float literal '1.2345678e+10' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:39: warning: unformatted representation of floating literal '1.2345678e+10' [modernize-use-digit-separator]
 // CHECK-FIXES: 1.234'567'8e+10
 
 double MinusScientificNotFormattedFloat3 = -1.2345678e+10;
-// CHECK-MESSAGES: :[[@LINE-1]]:45: warning: unformatted representation of float literal '1.2345678e+10' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:45: warning: unformatted representation of floating literal '1.2345678e+10' [modernize-use-digit-separator]
 // CHECK-FIXES: 1.234'567'8e+10
 
 double PostfixScientificNotFormattedFloat = 1.2345678E10F;
-// CHECK-MESSAGES: :[[@LINE-1]]:45: warning: unformatted representation of float literal '1.2345678E10F' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:45: warning: unformatted representation of floating literal '1.2345678E10F' [modernize-use-digit-separator]
 // CHECK-FIXES: 1.234'567'8E10F
 
 double PostfixScientificNotFormattedFloat1 = 1.2345678e10f;
-// CHECK-MESSAGES: :[[@LINE-1]]:46: warning: unformatted representation of float literal '1.2345678e10f' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:46: warning: unformatted representation of floating literal '1.2345678e10f' [modernize-use-digit-separator]
 // CHECK-FIXES: 1.234'567'8e10f
 
 double PostfixScientificNotFormattedFloat2 = -1.2345678E+10f;
-// CHECK-MESSAGES: :[[@LINE-1]]:47: warning: unformatted representation of float literal '1.2345678E+10f' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:47: warning: unformatted representation of floating literal '1.2345678E+10f' [modernize-use-digit-separator]
 // CHECK-FIXES: 1.234'567'8E+10f
 
 double PostfixScientificNotFormattedFloat4 = -1.2345678e-10F;
-// CHECK-MESSAGES: :[[@LINE-1]]:47: warning: unformatted representation of float literal '1.2345678e-10F' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:47: warning: unformatted representation of floating literal '1.2345678e-10F' [modernize-use-digit-separator]
 // CHECK-FIXES: 1.234'567'8e-10F
 
 
@@ -307,75 +307,75 @@ unsigned long MinusUnsignedLongWrongFormattedInteger1 = -1'2'34'567'89'10'11'12'
 // CHECK-FIXES: 12'345'678'910'111'213Ul
 
 float WrongFormattedFloat = 1'234.56789;
-// CHECK-MESSAGES: :[[@LINE-1]]:29: warning: unformatted representation of float literal '1'234.56789' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:29: warning: unformatted representation of floating literal '1'234.56789' [modernize-use-digit-separator]
 // CHECK-FIXES: 1'234.567'89
 
 float MinusWrongFormattedFloat = -1234.56'789;
-// CHECK-MESSAGES: :[[@LINE-1]]:35: warning: unformatted representation of float literal '1234.56'789' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:35: warning: unformatted representation of floating literal '1234.56'789' [modernize-use-digit-separator]
 // CHECK-FIXES: 1'234.567'89
 
 double PostfixWrongFormattedFloat = 123'4.5'69F;
-// CHECK-MESSAGES: :[[@LINE-1]]:37: warning: unformatted representation of float literal '123'4.5'69F' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:37: warning: unformatted representation of floating literal '123'4.5'69F' [modernize-use-digit-separator]
 // CHECK-FIXES: 1'234.569F
 
 double MinusPostfixWrongFormattedFloat = -12'34.569F;
-// CHECK-MESSAGES: :[[@LINE-1]]:43: warning: unformatted representation of float literal '12'34.569F' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:43: warning: unformatted representation of floating literal '12'34.569F' [modernize-use-digit-separator]
 // CHECK-FIXES: 1'234.569F
 
 double PostfixWrongFormattedFloat1 = 1'2'34.569f;
-// CHECK-MESSAGES: :[[@LINE-1]]:38: warning: unformatted representation of float literal '1'2'34.569f' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:38: warning: unformatted representation of floating literal '1'2'34.569f' [modernize-use-digit-separator]
 // CHECK-FIXES: 1'234.569f
 
 double MinusPostfixWrongFormattedFloat1 = -12'3'4.5'69f;
-// CHECK-MESSAGES: :[[@LINE-1]]:44: warning: unformatted representation of float literal '12'3'4.5'69f' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:44: warning: unformatted representation of floating literal '12'3'4.5'69f' [modernize-use-digit-separator]
 // CHECK-FIXES: 1'234.569f
 
 double ScientificWrongFormattedFloat = 1.23'456'78E1'0;
-// CHECK-MESSAGES: :[[@LINE-1]]:40: warning: unformatted representation of float literal '1.23'456'78E1'0' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:40: warning: unformatted representation of floating literal '1.23'456'78E1'0' [modernize-use-digit-separator]
 // CHECK-FIXES: 1.234'567'8E10
 
 double MinusScientificWrongFormattedFloat = -1.234'5678E10;
-// CHECK-MESSAGES: :[[@LINE-1]]:46: warning: unformatted representation of float literal '1.234'5678E10' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:46: warning: unformatted representation of floating literal '1.234'5678E10' [modernize-use-digit-separator]
 // CHECK-FIXES: 1.234'567'8E10
 
 double ScientificWrongFormattedFloat1 = 1.234'5'67'8e10;
-// CHECK-MESSAGES: :[[@LINE-1]]:41: warning: unformatted representation of float literal '1.234'5'67'8e10' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:41: warning: unformatted representation of floating literal '1.234'5'67'8e10' [modernize-use-digit-separator]
 // CHECK-FIXES: 1.234'567'8e10
 
 double MinusScientificWrongFormattedFloat1 = -1.2345678e1'0;
-// CHECK-MESSAGES: :[[@LINE-1]]:47: warning: unformatted representation of float literal '1.2345678e1'0' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:47: warning: unformatted representation of floating literal '1.2345678e1'0' [modernize-use-digit-separator]
 // CHECK-FIXES: 1.234'567'8e10
 
 double ScientificWrongFormattedFloat2 = 1.23456'78E+1'0;
-// CHECK-MESSAGES: :[[@LINE-1]]:41: warning: unformatted representation of float literal '1.23456'78E+1'0' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:41: warning: unformatted representation of floating literal '1.23456'78E+1'0' [modernize-use-digit-separator]
 // CHECK-FIXES: 1.234'567'8E+10
 
 double MinusScientificWrongFormattedFloat2 = -1.23'456'78E+10;
-// CHECK-MESSAGES: :[[@LINE-1]]:47: warning: unformatted representation of float literal '1.23'456'78E+10' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:47: warning: unformatted representation of floating literal '1.23'456'78E+10' [modernize-use-digit-separator]
 // CHECK-FIXES: 1.234'567'8E+10
 
 double ScientificWrongFormattedFloat3 = 1.234'56'78e+10;
-// CHECK-MESSAGES: :[[@LINE-1]]:41: warning: unformatted representation of float literal '1.234'56'78e+10' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:41: warning: unformatted representation of floating literal '1.234'56'78e+10' [modernize-use-digit-separator]
 // CHECK-FIXES: 1.234'567'8e+10
 
 double MinusScientificWrongFormattedFloat3 = -1.2'3'4'5'678e+1'0;
-// CHECK-MESSAGES: :[[@LINE-1]]:47: warning: unformatted representation of float literal '1.2'3'4'5'678e+1'0' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:47: warning: unformatted representation of floating literal '1.2'3'4'5'678e+1'0' [modernize-use-digit-separator]
 // CHECK-FIXES: 1.234'567'8e+10
 
 double PostfixScientificWrongFormattedFloat = 1.23456'78E1'0F;
-// CHECK-MESSAGES: :[[@LINE-1]]:47: warning: unformatted representation of float literal '1.23456'78E1'0F' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:47: warning: unformatted representation of floating literal '1.23456'78E1'0F' [modernize-use-digit-separator]
 // CHECK-FIXES: 1.234'567'8E10F
 
 double PostfixScientificWrongFormattedFloat1 = 1.23'45'6'7'8e10f;
-// CHECK-MESSAGES: :[[@LINE-1]]:48: warning: unformatted representation of float literal '1.23'45'6'7'8e10f' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:48: warning: unformatted representation of floating literal '1.23'45'6'7'8e10f' [modernize-use-digit-separator]
 // CHECK-FIXES: 1.234'567'8e10f
 
 double PostfixScientificWrongFormattedFloat2 = -1.2'34'56'7'8E+10f;
-// CHECK-MESSAGES: :[[@LINE-1]]:49: warning: unformatted representation of float literal '1.2'34'56'7'8E+10f' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:49: warning: unformatted representation of floating literal '1.2'34'56'7'8E+10f' [modernize-use-digit-separator]
 // CHECK-FIXES: 1.234'567'8E+10f
 
 double PostfixScientificWrongFormattedFloat4 = -1.23'456'78e-1'0F;
-// CHECK-MESSAGES: :[[@LINE-1]]:49: warning: unformatted representation of float literal '1.23'456'78e-1'0F' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:49: warning: unformatted representation of floating literal '1.23'456'78e-1'0F' [modernize-use-digit-separator]
 // CHECK-FIXES: 1.234'567'8e-10F
 
 
@@ -454,73 +454,73 @@ unsigned long AssignmentMinusUnsignedLongNotFormattedInteger1 = -123456789101112
 // CHECK-FIXES: {{^}}unsigned long AssignmentMinusUnsignedLongNotFormattedInteger1 = -12'345'678'910'111'213Ul;{{$}}
 
 float AssignmentNotFormattedFloat = 1234.56789;
-// CHECK-MESSAGES: :[[@LINE-1]]:37: warning: unformatted representation of float literal '1234.56789' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:37: warning: unformatted representation of floating literal '1234.56789' [modernize-use-digit-separator]
 // CHECK-FIXES: {{^}}float AssignmentNotFormattedFloat = 1'234.567'89;{{$}}
 
 float AssignmentMinusNotFormattedFloat = -1234.56789;
-// CHECK-MESSAGES: :[[@LINE-1]]:43: warning: unformatted representation of float literal '1234.56789' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:43: warning: unformatted representation of floating literal '1234.56789' [modernize-use-digit-separator]
 // CHECK-FIXES: {{^}}float AssignmentMinusNotFormattedFloat = -1'234.567'89;{{$}}
 
 double AssignmentPostfixNotFormattedFloat = 1234.569F;
-// CHECK-MESSAGES: :[[@LINE-1]]:45: warning: unformatted representation of float literal '1234.569F' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:45: warning: unformatted representation of floating literal '1234.569F' [modernize-use-digit-separator]
 // CHECK-FIXES: {{^}}double AssignmentPostfixNotFormattedFloat = 1'234.569F;{{$}}
 
 double AssignmentMinusPostfixNotFormattedFloat = -1234.569F;
-// CHECK-MESSAGES: :[[@LINE-1]]:51: warning: unformatted representation of float literal '1234.569F' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:51: warning: unformatted representation of floating literal '1234.569F' [modernize-use-digit-separator]
 // CHECK-FIXES: {{^}}double AssignmentMinusPostfixNotFormattedFloat = -1'234.569F;{{$}}
 
 double AssignmentPostfixNotFormattedFloat1 = 1234.569f;
-// CHECK-MESSAGES: :[[@LINE-1]]:46: warning: unformatted representation of float literal '1234.569f' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:46: warning: unformatted representation of floating literal '1234.569f' [modernize-use-digit-separator]
 // CHECK-FIXES: {{^}}double AssignmentPostfixNotFormattedFloat1 = 1'234.569f;{{$}}
 
 double AssignmentMinusPostfixNotFormattedFloat1 = -1234.569f;
-// CHECK-MESSAGES: :[[@LINE-1]]:52: warning: unformatted representation of float literal '1234.569f' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:52: warning: unformatted representation of floating literal '1234.569f' [modernize-use-digit-separator]
 // CHECK-FIXES: {{^}}double AssignmentMinusPostfixNotFormattedFloat1 = -1'234.569f;{{$}}
 
 double AssignmentScientificNotFormattedFloat = 1.2345678E10;
-// CHECK-MESSAGES: :[[@LINE-1]]:48: warning: unformatted representation of float literal '1.2345678E10' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:48: warning: unformatted representation of floating literal '1.2345678E10' [modernize-use-digit-separator]
 // CHECK-FIXES: {{^}}double AssignmentScientificNotFormattedFloat = 1.234'567'8E10;{{$}}
 
 double AssignmentMinusScientificNotFormattedFloat = -1.2345678E10;
-// CHECK-MESSAGES: :[[@LINE-1]]:54: warning: unformatted representation of float literal '1.2345678E10' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:54: warning: unformatted representation of floating literal '1.2345678E10' [modernize-use-digit-separator]
 // CHECK-FIXES: {{^}}double AssignmentMinusScientificNotFormattedFloat = -1.234'567'8E10;{{$}}
 
 double AssignmentScientificNotFormattedFloat1 = 1.2345678e10;
-// CHECK-MESSAGES: :[[@LINE-1]]:49: warning: unformatted representation of float literal '1.2345678e10' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:49: warning: unformatted representation of floating literal '1.2345678e10' [modernize-use-digit-separator]
 // CHECK-FIXES: {{^}}double AssignmentScientificNotFormattedFloat1 = 1.234'567'8e10;{{$}}
 
 double AssignmentMinusScientificNotFormattedFloat1 = -1.2345678e10;
-// CHECK-MESSAGES: :[[@LINE-1]]:55: warning: unformatted representation of float literal '1.2345678e10' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:55: warning: unformatted representation of floating literal '1.2345678e10' [modernize-use-digit-separator]
 // CHECK-FIXES: {{^}}double AssignmentMinusScientificNotFormattedFloat1 = -1.234'567'8e10;{{$}}
 
 double AssignmentScientificNotFormattedFloat2 = 1.2345678E+10;
-// CHECK-MESSAGES: :[[@LINE-1]]:49: warning: unformatted representation of float literal '1.2345678E+10' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:49: warning: unformatted representation of floating literal '1.2345678E+10' [modernize-use-digit-separator]
 // CHECK-FIXES: {{^}}double AssignmentScientificNotFormattedFloat2 = 1.234'567'8E+10;{{$}}
 
 double AssignmentMinusScientificNotFormattedFloat2 = -1.2345678E+10;
-// CHECK-MESSAGES: :[[@LINE-1]]:55: warning: unformatted representation of float literal '1.2345678E+10' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:55: warning: unformatted representation of floating literal '1.2345678E+10' [modernize-use-digit-separator]
 // CHECK-FIXES: {{^}}double AssignmentMinusScientificNotFormattedFloat2 = -1.234'567'8E+10;{{$}}
 
 double AssignmentScientificNotFormattedFloat3 = 1.2345678e+10;
-// CHECK-MESSAGES: :[[@LINE-1]]:49: warning: unformatted representation of float literal '1.2345678e+10' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:49: warning: unformatted representation of floating literal '1.2345678e+10' [modernize-use-digit-separator]
 // CHECK-FIXES: {{^}}double AssignmentScientificNotFormattedFloat3 = 1.234'567'8e+10;{{$}}
 
 double AssignmentMinusScientificNotFormattedFloat3 = -1.2345678e+10;
-// CHECK-MESSAGES: :[[@LINE-1]]:55: warning: unformatted representation of float literal '1.2345678e+10' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:55: warning: unformatted representation of floating literal '1.2345678e+10' [modernize-use-digit-separator]
 // CHECK-FIXES: {{^}}double AssignmentMinusScientificNotFormattedFloat3 = -1.234'567'8e+10;{{$}}
 
 double AssignmentPostfixScientificNotFormattedFloat = 1.2345678E10F;
-// CHECK-MESSAGES: :[[@LINE-1]]:55: warning: unformatted representation of float literal '1.2345678E10F' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:55: warning: unformatted representation of floating literal '1.2345678E10F' [modernize-use-digit-separator]
 // CHECK-FIXES: {{^}}double AssignmentPostfixScientificNotFormattedFloat = 1.234'567'8E10F;{{$}}
 
 double AssignmentPostfixScientificNotFormattedFloat1 = 1.2345678e10f;
-// CHECK-MESSAGES: :[[@LINE-1]]:56: warning: unformatted representation of float literal '1.2345678e10f' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:56: warning: unformatted representation of floating literal '1.2345678e10f' [modernize-use-digit-separator]
 // CHECK-FIXES: {{^}}double AssignmentPostfixScientificNotFormattedFloat1 = 1.234'567'8e10f;{{$}}
 
 double AssignmentPostfixScientificNotFormattedFloat2 = -1.2345678E+10f;
-// CHECK-MESSAGES: :[[@LINE-1]]:57: warning: unformatted representation of float literal '1.2345678E+10f' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:57: warning: unformatted representation of floating literal '1.2345678E+10f' [modernize-use-digit-separator]
 // CHECK-FIXES: {{^}}double AssignmentPostfixScientificNotFormattedFloat2 = -1.234'567'8E+10f;{{$}}
 
 double AssignmentPostfixScientificNotFormattedFloat4 = -1.2345678e-10F;
-// CHECK-MESSAGES: :[[@LINE-1]]:57: warning: unformatted representation of float literal '1.2345678e-10F' [modernize-use-digit-separator]
+// CHECK-MESSAGES: :[[@LINE-1]]:57: warning: unformatted representation of floating literal '1.2345678e-10F' [modernize-use-digit-separator]
 // CHECK-FIXES: {{^}}double AssignmentPostfixScientificNotFormattedFloat4 = -1.234'567'8e-10F;{{$}}

>From e6e2e2c5f8e5e0a2ae6aed748c6094b38371b525 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Wed, 27 Dec 2023 21:33:28 +0300
Subject: [PATCH 69/76] Replace std::basic_string<char> by std::string

---
 .../modernize/UseDigitSeparatorCheck.cpp           | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 5832d41f8546ab..a6994a76539869 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -22,18 +22,18 @@ namespace {
 std::string
 getFormatedScientificFloatString(const llvm::StringRef OriginalLiteralString);
 
-std::vector<std::basic_string<char>>
-splitStringByGroupSize(const std::basic_string<char> &String,
+std::vector<std::string>
+splitStringByGroupSize(const std::string &String,
                        size_t GroupSize) {
-  std::vector<std::basic_string<char>> Result;
-  std::basic_string<char> ReversedString(String.rbegin(), String.rend());
+  std::vector<std::string> Result;
+  std::string ReversedString(String.rbegin(), String.rend());
 
   for (size_t I = 0; I < ReversedString.size(); I += GroupSize) {
     Result.push_back(ReversedString.substr(I, GroupSize));
   }
 
   std::reverse(Result.begin(), Result.end());
-  std::for_each(Result.begin(), Result.end(), [](std::basic_string<char> &Str) {
+  std::for_each(Result.begin(), Result.end(), [](std::string &Str) {
     return std::reverse(Str.begin(), Str.end());
   });
 
@@ -82,8 +82,8 @@ getFormatedIntegerString(const llvm::StringRef OriginalLiteralString,
       Prefix +
       std::accumulate(SplittedIntegerLiteral.begin(),
                       SplittedIntegerLiteral.end(), std::string(""),
-                      [](std::basic_string<char> S1,
-                         std::basic_string<char> S2) { return S1 + "\'" + S2; })
+                      [](std::string S1,
+                         std::string S2) { return S1 + "\'" + S2; })
           .erase(0, 1) +
       Postfix;
 

>From 58a224d2ae1267af0e7d6bb82ff2cbba166c935d Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Wed, 27 Dec 2023 21:33:49 +0300
Subject: [PATCH 70/76] Formatting

---
 .../clang-tidy/modernize/UseDigitSeparatorCheck.cpp | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index a6994a76539869..39dd9bdbf51bd2 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -22,9 +22,8 @@ namespace {
 std::string
 getFormatedScientificFloatString(const llvm::StringRef OriginalLiteralString);
 
-std::vector<std::string>
-splitStringByGroupSize(const std::string &String,
-                       size_t GroupSize) {
+std::vector<std::string> splitStringByGroupSize(const std::string &String,
+                                                size_t GroupSize) {
   std::vector<std::string> Result;
   std::string ReversedString(String.rbegin(), String.rend());
 
@@ -80,10 +79,10 @@ getFormatedIntegerString(const llvm::StringRef OriginalLiteralString,
       splitStringByGroupSize(toString(IntegerValue, Radix, true), GroupSize);
   const std::string FormatedLiteralString =
       Prefix +
-      std::accumulate(SplittedIntegerLiteral.begin(),
-                      SplittedIntegerLiteral.end(), std::string(""),
-                      [](std::string S1,
-                         std::string S2) { return S1 + "\'" + S2; })
+      std::accumulate(
+          SplittedIntegerLiteral.begin(), SplittedIntegerLiteral.end(),
+          std::string(""),
+          [](std::string S1, std::string S2) { return S1 + "\'" + S2; })
           .erase(0, 1) +
       Postfix;
 

>From c54ad2476fd5ccb33a3f6a6e7f55d3668aea0d23 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Tue, 9 Jan 2024 16:10:08 +0300
Subject: [PATCH 71/76] Awful code for macros

---
 .../modernize/UseDigitSeparatorCheck.cpp      | 52 +++++++++++++++++++
 .../modernize/UseDigitSeparatorCheck.h        |  2 +
 2 files changed, 54 insertions(+)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 39dd9bdbf51bd2..2e3c96d4ced622 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -13,7 +13,9 @@
 #include "UseDigitSeparatorCheck.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/Lex/Preprocessor.h"
 #include "clang/Lex/Lexer.h"
+#include "clang/Lex/PPCallbacks.h"
 #include "llvm/Support/FormatVariadic.h"
 
 using namespace clang::ast_matchers;
@@ -240,4 +242,54 @@ void UseDigitSeparatorCheck::check(const MatchFinder::MatchResult &Result) {
   llvm_unreachable("Unreachable code in UseDigitSeparatorCheck");
 }
 
+class UseDigitSeparatorCallbacks : public PPCallbacks {
+public:
+  UseDigitSeparatorCallbacks(UseDigitSeparatorCheck *Check) : Check(Check) {}
+
+  void MacroDefined(const Token &MacroNameTok,
+                    const MacroDirective *MD) override;
+
+private:
+  UseDigitSeparatorCheck *Check;
+};
+void UseDigitSeparatorCallbacks::MacroDefined(const Token &MacroNameTok,
+                                              const MacroDirective *MD) {
+  const MacroInfo *Info = MD->getMacroInfo();
+  ArrayRef<Token> MacroTokens = Info->tokens();
+  if (Info->isBuiltinMacro() || MacroTokens.empty()) {
+    return;
+  }
+    for (const Token &T : MacroTokens) {
+      if (!T.isLiteral()) {
+        return;
+      }
+
+      // Get original literal source text
+      std::string OriginalLiteralString(T.getLiteralData(), T.getLength());
+
+      if (!isDigit(OriginalLiteralString[0])) {
+        return;
+      }
+
+      // Get formatting literal text
+      const llvm::APInt IntegerValue = llvm::APInt(128, std::stoul(OriginalLiteralString));
+      const std::string FormatedLiteralString =
+          getFormatedIntegerString(OriginalLiteralString, IntegerValue);
+
+      if (OriginalLiteralString != FormatedLiteralString) {
+        Check->diag(T.getLocation(),
+                    "unformatted representation of floating literal '%0'")
+            << OriginalLiteralString
+            << FixItHint::CreateReplacement(T.getLocation(),
+                                            FormatedLiteralString);
+      }
+    }
+}
+
+void UseDigitSeparatorCheck::registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
+                         Preprocessor *ModuleExpanderPP) {
+  auto Callback = std::make_unique<UseDigitSeparatorCallbacks>(this);
+  PP->addPPCallbacks(std::move(Callback));
+}
+
 } // namespace clang::tidy::modernize
diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.h b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.h
index e6e3ccc783ef5b..dbdbea7579bc58 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.h
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.h
@@ -34,6 +34,8 @@ class UseDigitSeparatorCheck : public ClangTidyCheck {
       : ClangTidyCheck(Name, Context) {}
   void registerMatchers(ast_matchers::MatchFinder *Finder) override;
   void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
+  void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
+                           Preprocessor *ModuleExpanderPP) override;
 };
 
 } // namespace clang::tidy::modernize

>From 656b46d51391b385cf3cb3960a6ad692e16579a2 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Tue, 9 Jan 2024 16:10:40 +0300
Subject: [PATCH 72/76] Formatting

---
 .../modernize/UseDigitSeparatorCheck.cpp      | 55 ++++++++++---------
 1 file changed, 28 insertions(+), 27 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 2e3c96d4ced622..8652385b96457a 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -13,9 +13,9 @@
 #include "UseDigitSeparatorCheck.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
-#include "clang/Lex/Preprocessor.h"
 #include "clang/Lex/Lexer.h"
 #include "clang/Lex/PPCallbacks.h"
+#include "clang/Lex/Preprocessor.h"
 #include "llvm/Support/FormatVariadic.h"
 
 using namespace clang::ast_matchers;
@@ -259,35 +259,36 @@ void UseDigitSeparatorCallbacks::MacroDefined(const Token &MacroNameTok,
   if (Info->isBuiltinMacro() || MacroTokens.empty()) {
     return;
   }
-    for (const Token &T : MacroTokens) {
-      if (!T.isLiteral()) {
-        return;
-      }
-
-      // Get original literal source text
-      std::string OriginalLiteralString(T.getLiteralData(), T.getLength());
-
-      if (!isDigit(OriginalLiteralString[0])) {
-        return;
-      }
-
-      // Get formatting literal text
-      const llvm::APInt IntegerValue = llvm::APInt(128, std::stoul(OriginalLiteralString));
-      const std::string FormatedLiteralString =
-          getFormatedIntegerString(OriginalLiteralString, IntegerValue);
-
-      if (OriginalLiteralString != FormatedLiteralString) {
-        Check->diag(T.getLocation(),
-                    "unformatted representation of floating literal '%0'")
-            << OriginalLiteralString
-            << FixItHint::CreateReplacement(T.getLocation(),
-                                            FormatedLiteralString);
-      }
+  for (const Token &T : MacroTokens) {
+    if (!T.isLiteral()) {
+      return;
+    }
+
+    // Get original literal source text
+    std::string OriginalLiteralString(T.getLiteralData(), T.getLength());
+
+    if (!isDigit(OriginalLiteralString[0])) {
+      return;
+    }
+
+    // Get formatting literal text
+    const llvm::APInt IntegerValue =
+        llvm::APInt(128, std::stoul(OriginalLiteralString));
+    const std::string FormatedLiteralString =
+        getFormatedIntegerString(OriginalLiteralString, IntegerValue);
+
+    if (OriginalLiteralString != FormatedLiteralString) {
+      Check->diag(T.getLocation(),
+                  "unformatted representation of floating literal '%0'")
+          << OriginalLiteralString
+          << FixItHint::CreateReplacement(T.getLocation(),
+                                          FormatedLiteralString);
     }
+  }
 }
 
-void UseDigitSeparatorCheck::registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
-                         Preprocessor *ModuleExpanderPP) {
+void UseDigitSeparatorCheck::registerPPCallbacks(
+    const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) {
   auto Callback = std::make_unique<UseDigitSeparatorCallbacks>(this);
   PP->addPPCallbacks(std::move(Callback));
 }

>From fa94bb419fa66d9d9541f01d4c550672d91ebd57 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Tue, 9 Jan 2024 17:20:30 +0300
Subject: [PATCH 73/76] Add some tests and fixes

---
 .../clang-tidy/modernize/UseDigitSeparatorCheck.cpp   |  4 ++--
 .../checkers/modernize/use-digit-separator.cpp        | 11 +++++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 8652385b96457a..2cd2fb4502d2ce 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -261,7 +261,7 @@ void UseDigitSeparatorCallbacks::MacroDefined(const Token &MacroNameTok,
   }
   for (const Token &T : MacroTokens) {
     if (!T.isLiteral()) {
-      return;
+      continue;
     }
 
     // Get original literal source text
@@ -279,7 +279,7 @@ void UseDigitSeparatorCallbacks::MacroDefined(const Token &MacroNameTok,
 
     if (OriginalLiteralString != FormatedLiteralString) {
       Check->diag(T.getLocation(),
-                  "unformatted representation of floating literal '%0'")
+                  "unformatted representation of integer literal '%0'")
           << OriginalLiteralString
           << FixItHint::CreateReplacement(T.getLocation(),
                                           FormatedLiteralString);
diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
index e3dc6569a6ff58..80df73c7dd7b72 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
@@ -524,3 +524,14 @@ double AssignmentPostfixScientificNotFormattedFloat2 = -1.2345678E+10f;
 double AssignmentPostfixScientificNotFormattedFloat4 = -1.2345678e-10F;
 // CHECK-MESSAGES: :[[@LINE-1]]:57: warning: unformatted representation of floating literal '1.2345678e-10F' [modernize-use-digit-separator]
 // CHECK-FIXES: {{^}}double AssignmentPostfixScientificNotFormattedFloat4 = -1.234'567'8e-10F;{{$}}
+
+
+// Macros
+
+#define NOT_FORMATTED_INTEGER 1234567
+// CHECK-MESSAGES: :[[@LINE-1]]:31: warning: unformatted representation of integer literal '1234567' [modernize-use-digit-separator]
+// CHECK-FIXES: 1'234'567
+
+#define MINUS_NOT_FORMATTED_INTEGER -1234567
+// CHECK-MESSAGES: :[[@LINE-1]]:38: warning: unformatted representation of integer literal '1234567' [modernize-use-digit-separator]
+// CHECK-FIXES: 1'234'567

>From c5ec616f504cf6986ea89c50a0db02807c0d2ae1 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Tue, 9 Jan 2024 18:18:06 +0300
Subject: [PATCH 74/76] Support binary numbers in macros

---
 .../clang-tidy/modernize/UseDigitSeparatorCheck.cpp    | 10 ++++++++--
 .../checkers/modernize/use-digit-separator.cpp         |  8 ++++++++
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 2cd2fb4502d2ce..61581b827bdd03 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -272,8 +272,14 @@ void UseDigitSeparatorCallbacks::MacroDefined(const Token &MacroNameTok,
     }
 
     // Get formatting literal text
-    const llvm::APInt IntegerValue =
-        llvm::APInt(128, std::stoul(OriginalLiteralString));
+    llvm::APInt IntegerValue;
+    if (llvm::StringRef(OriginalLiteralString).starts_with("0b")) {
+      std::string BinaryNumber = OriginalLiteralString;
+      BinaryNumber.erase(0, 2);
+      IntegerValue = llvm::APInt(128, std::stoul(BinaryNumber, nullptr, 2));
+    } else {
+      IntegerValue = llvm::APInt(128, std::stoul(OriginalLiteralString));
+    }
     const std::string FormatedLiteralString =
         getFormatedIntegerString(OriginalLiteralString, IntegerValue);
 
diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
index 80df73c7dd7b72..4cc64f22345e9a 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
@@ -535,3 +535,11 @@ double AssignmentPostfixScientificNotFormattedFloat4 = -1.2345678e-10F;
 #define MINUS_NOT_FORMATTED_INTEGER -1234567
 // CHECK-MESSAGES: :[[@LINE-1]]:38: warning: unformatted representation of integer literal '1234567' [modernize-use-digit-separator]
 // CHECK-FIXES: 1'234'567
+
+#define BINARY_NOT_FORMATTED_INTEGER 0b11101101
+// CHECK-MESSAGES: :[[@LINE-1]]:38: warning: unformatted representation of integer literal '0b11101101' [modernize-use-digit-separator]
+// CHECK-FIXES: 0b1110'1101
+
+#define MINUS_BINARY_NOT_FORMATTED_INTEGER -0b11101101
+// CHECK-MESSAGES: :[[@LINE-1]]:45: warning: unformatted representation of integer literal '0b11101101' [modernize-use-digit-separator]
+// CHECK-FIXES: 0b1110'1101

>From a4110d8978500b83e554e8ab9038852b282584da Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Tue, 9 Jan 2024 18:46:59 +0300
Subject: [PATCH 75/76] Support oct and hex numbers in macros

---
 .../modernize/UseDigitSeparatorCheck.cpp         |  4 ++++
 .../checkers/modernize/use-digit-separator.cpp   | 16 ++++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index 61581b827bdd03..a2f5f312a7cd64 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -277,6 +277,10 @@ void UseDigitSeparatorCallbacks::MacroDefined(const Token &MacroNameTok,
       std::string BinaryNumber = OriginalLiteralString;
       BinaryNumber.erase(0, 2);
       IntegerValue = llvm::APInt(128, std::stoul(BinaryNumber, nullptr, 2));
+    } else if (llvm::StringRef(OriginalLiteralString).starts_with("0x")) {
+      IntegerValue = llvm::APInt(128, std::stoul(OriginalLiteralString, nullptr, 16));
+    } else if (llvm::StringRef(OriginalLiteralString).starts_with("0")) {
+      IntegerValue = llvm::APInt(128, std::stoul(OriginalLiteralString, nullptr, 8));
     } else {
       IntegerValue = llvm::APInt(128, std::stoul(OriginalLiteralString));
     }
diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
index 4cc64f22345e9a..b769b628942fe8 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-digit-separator.cpp
@@ -543,3 +543,19 @@ double AssignmentPostfixScientificNotFormattedFloat4 = -1.2345678e-10F;
 #define MINUS_BINARY_NOT_FORMATTED_INTEGER -0b11101101
 // CHECK-MESSAGES: :[[@LINE-1]]:45: warning: unformatted representation of integer literal '0b11101101' [modernize-use-digit-separator]
 // CHECK-FIXES: 0b1110'1101
+
+#define OCT_NOT_FORMATTED_INTEGER 037512
+// CHECK-MESSAGES: :[[@LINE-1]]:35: warning: unformatted representation of integer literal '037512' [modernize-use-digit-separator]
+// CHECK-FIXES: 037'512
+
+#define MINUS_OCT_NOT_FORMATTED_INTEGER -037512
+// CHECK-MESSAGES: :[[@LINE-1]]:42: warning: unformatted representation of integer literal '037512' [modernize-use-digit-separator]
+// CHECK-FIXES: 037'512
+
+#define HEX_NOT_FORMATTED_INTEGER 0x4f356
+// CHECK-MESSAGES: :[[@LINE-1]]:35: warning: unformatted representation of integer literal '0x4f356' [modernize-use-digit-separator]
+// CHECK-FIXES: 0x4'F356
+
+#define MINUS_HEX_NOT_FORMATTED_INTEGER -0x4f356
+// CHECK-MESSAGES: :[[@LINE-1]]:42: warning: unformatted representation of integer literal '0x4f356' [modernize-use-digit-separator]
+// CHECK-FIXES: 0x4'F356

>From dcff84fa9c614a2969f2ec65bcbc76168cf92ef4 Mon Sep 17 00:00:00 2001
From: Ivan Arkhipov <arkhipov.iv99 at mail.ru>
Date: Tue, 9 Jan 2024 18:47:42 +0300
Subject: [PATCH 76/76] Formatting

---
 .../clang-tidy/modernize/UseDigitSeparatorCheck.cpp         | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
index a2f5f312a7cd64..6c6320d25dd4b9 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDigitSeparatorCheck.cpp
@@ -278,9 +278,11 @@ void UseDigitSeparatorCallbacks::MacroDefined(const Token &MacroNameTok,
       BinaryNumber.erase(0, 2);
       IntegerValue = llvm::APInt(128, std::stoul(BinaryNumber, nullptr, 2));
     } else if (llvm::StringRef(OriginalLiteralString).starts_with("0x")) {
-      IntegerValue = llvm::APInt(128, std::stoul(OriginalLiteralString, nullptr, 16));
+      IntegerValue =
+          llvm::APInt(128, std::stoul(OriginalLiteralString, nullptr, 16));
     } else if (llvm::StringRef(OriginalLiteralString).starts_with("0")) {
-      IntegerValue = llvm::APInt(128, std::stoul(OriginalLiteralString, nullptr, 8));
+      IntegerValue =
+          llvm::APInt(128, std::stoul(OriginalLiteralString, nullptr, 8));
     } else {
       IntegerValue = llvm::APInt(128, std::stoul(OriginalLiteralString));
     }



More information about the cfe-commits mailing list