[clang] 9e00909 - [clang-format][NFC] Don't add a load of 0es

Björn Schäpers via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 21 04:24:40 PST 2022


Author: Björn Schäpers
Date: 2022-11-21T13:24:18+01:00
New Revision: 9e00909b00f9e75b4f710bc60f13ceea1215746c

URL: https://github.com/llvm/llvm-project/commit/9e00909b00f9e75b4f710bc60f13ceea1215746c
DIFF: https://github.com/llvm/llvm-project/commit/9e00909b00f9e75b4f710bc60f13ceea1215746c.diff

LOG: [clang-format][NFC] Don't add a load of 0es

Shift is 0 for all non comments, maybe even for comments. Don't add the
0 up to three times.

Differential Revision: https://reviews.llvm.org/D138357

Added: 
    

Modified: 
    clang/lib/Format/WhitespaceManager.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Format/WhitespaceManager.cpp b/clang/lib/Format/WhitespaceManager.cpp
index cd9773921dae..ff7ef7edc984 100644
--- a/clang/lib/Format/WhitespaceManager.cpp
+++ b/clang/lib/Format/WhitespaceManager.cpp
@@ -1049,7 +1049,7 @@ void WhitespaceManager::alignTrailingComments(unsigned Start, unsigned End,
               Changes[i].StartOfBlockComment->StartOfTokenColumn -
               Changes[i].StartOfTokenColumn;
     }
-    if (Shift < 0)
+    if (Shift <= 0)
       continue;
     Changes[i].Spaces += Shift;
     if (i + 1 != Changes.size())


        


More information about the cfe-commits mailing list