[PATCH] D48259: [clang-format] Fix bug with UT_Always when there is less than one full tab

Manuel Klimek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jun 17 23:11:06 PDT 2018


klimek added inline comments.


================
Comment at: lib/Format/WhitespaceManager.cpp:678
     // Indent with tabs only when there's at least one full tab.
-    if (FirstTabWidth + Style.TabWidth <= Spaces) {
+    if (Style.TabWidth <= Spaces) {
       Spaces -= FirstTabWidth;
----------------
Why is this not just if (FirstTabWidth <= Spaces) then?


================
Comment at: unittests/Format/FormatTest.cpp:9372
+  FormatStyle::UseTabStyle OldTabStyle = Alignment.UseTab;
+  unsigned OldTabWidth = Alignment.TabWidth;
+  Alignment.UseTab = FormatStyle::UT_Always;
----------------
Instead of doing the save/restore dance, just put it at the end of a test or create a new test (or alternatively create a new style as copy and then change the settings on that).


Repository:
  rC Clang

https://reviews.llvm.org/D48259





More information about the cfe-commits mailing list