[PATCH] D54881: [clang-format] Prevent Clang-Format from editing leading whitespace on lines outside of the format range

Jonas Toth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 3 10:21:55 PST 2018


JonasToth added a comment.

Hi russell

thank you for the patch! As I am not a clang-format reviewers these are only general things, and Nits anyway ;)
Hope the reviewers I added will evaluate better.



================
Comment at: lib/Format/WhitespaceManager.cpp:54
   Tok.Decision = (Newlines > 0) ? FD_Break : FD_Continue;
-  Changes.push_back(Change(Tok, /*CreateReplacement=*/true, Tok.WhitespaceRange,
-                           Spaces, StartOfTokenColumn, Newlines, "", "",
-                           InPPDirective && !Tok.IsFirst,
+  auto OriginalWhitespaceRange = Tok.WhitespaceRange;
+
----------------
is this a SourceRange? Please spell out the type, as there are different kind of ranges.


================
Comment at: unittests/Format/FormatTest.cpp:9159
                    "}"));
+
   Tab.AlignConsecutiveAssignments = true;
----------------
Spurious change.


Repository:
  rC Clang

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

https://reviews.llvm.org/D54881





More information about the cfe-commits mailing list