[all-commits] [llvm/llvm-project] 5d7a14: [analyzer] Fix alignment of entries in -analyzer-h...

Alex via All-commits all-commits at lists.llvm.org
Tue Apr 14 15:22:46 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5d7a143ec677353ba45e1233494a67fbd9e0bf90
      https://github.com/llvm/llvm-project/commit/5d7a143ec677353ba45e1233494a67fbd9e0bf90
  Author: Alex <filaka771 at gmail.com>
  Date:   2026-04-15 (Wed, 15 Apr 2026)

  Changed paths:
    M clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
    A clang/unittests/StaticAnalyzer/AnalyzerFormattingTest.cpp
    M clang/unittests/StaticAnalyzer/CMakeLists.txt

  Log Message:
  -----------
  [analyzer] Fix alignment of entries in -analyzer-help (#190570)

Fix a formatting bug in `AnalyzerOptions::printFormattedEntry` (used by
`clang -cc1 -print-analyzer-options`), which led to misalignment of a
checker description.

This commit ensures that `printFormattedEntry` inserts a newline in the
corner case when the length of the name of a checker is exactly equal to
`EntryWidth`. (In this situation the old code inserted a space between
the name and the description, so this description was not aligned with
the other descriptions.)

Additionally this commit also fixes the corner case where the pad before
the checker name (specified by `InitialPad`) is 0. Before the fix, due
to `llvm::raw_formatted_ostream::PadToColumn` logic, `InitialPad = 0`
still added one space character as padding before the checker name.
Fortunately `InitialPad = 0` was never used in the program, so this bug
was not visible to the user.

These changes are both tested by the freshly added unit tests.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list