[clang] [clang][analyzer] Fix alignment of entries in -analyzer-help (PR #190570)

via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 7 18:03:44 PDT 2026


================
@@ -37,9 +37,14 @@ void AnalyzerOptions::printFormattedEntry(
 
   const size_t PadForDesc = InitialPad + EntryWidth;
 
-  FOut.PadToColumn(InitialPad) << EntryDescPair.first;
-  // If the buffer's length is greater than PadForDesc, print a newline.
-  if (FOut.getColumn() > PadForDesc)
+  if (InitialPad != 0)
+    FOut.PadToColumn(InitialPad);
----------------
filaka771 wrote:

Actually, PadToColumn inserts, at least, 1 space, as you can see here: https://github.com/llvm/llvm-project/blob/dea9b6e1493e663fd7f07f486d96a14d7fbf1cad/llvm/lib/Support/FormattedStream.cpp#L130

This led to the second bug I explained in the description of this PR and motivated me to add this guard.

https://github.com/llvm/llvm-project/pull/190570


More information about the cfe-commits mailing list