This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb4243bb611a3: [clang-format] Don't rewrite the input 
file if already formatted (authored by owenpan).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143831/new/

https://reviews.llvm.org/D143831

Files:
  clang/lib/Format/IntegerLiteralSeparatorFixer.cpp


Index: clang/lib/Format/IntegerLiteralSeparatorFixer.cpp
===================================================================
--- clang/lib/Format/IntegerLiteralSeparatorFixer.cpp
+++ clang/lib/Format/IntegerLiteralSeparatorFixer.cpp
@@ -132,8 +132,11 @@
       continue;
     if (Start > 0)
       Location = Location.getLocWithOffset(Start);
-    cantFail(Result.add(tooling::Replacement(SourceMgr, Location, Length,
-                                             format(Text, DigitsPerGroup))));
+    if (const auto &Formatted = format(Text, DigitsPerGroup);
+        Formatted != Text) {
+      cantFail(Result.add(
+          tooling::Replacement(SourceMgr, Location, Length, Formatted)));
+    }
   }
 
   return {Result, 0};


Index: clang/lib/Format/IntegerLiteralSeparatorFixer.cpp
===================================================================
--- clang/lib/Format/IntegerLiteralSeparatorFixer.cpp
+++ clang/lib/Format/IntegerLiteralSeparatorFixer.cpp
@@ -132,8 +132,11 @@
       continue;
     if (Start > 0)
       Location = Location.getLocWithOffset(Start);
-    cantFail(Result.add(tooling::Replacement(SourceMgr, Location, Length,
-                                             format(Text, DigitsPerGroup))));
+    if (const auto &Formatted = format(Text, DigitsPerGroup);
+        Formatted != Text) {
+      cantFail(Result.add(
+          tooling::Replacement(SourceMgr, Location, Length, Formatted)));
+    }
   }
 
   return {Result, 0};
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to