[PATCH] D143831: [clang-format] Don't rewrite the input file if already formatted
Owen Pan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 14 14:28:07 PST 2023
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};
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143831.497446.patch
Type: text/x-patch
Size: 730 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230214/5aec8720/attachment.bin>
More information about the cfe-commits
mailing list