[all-commits] [llvm/llvm-project] bf3652: [llvm-cov] Init `ViewOpts.Colors` before `error()`...

Iñaki Amatria Barral via All-commits all-commits at lists.llvm.org
Mon Jun 22 11:50:34 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bf3652b1e7eb0633c13afcc23bbc238f5e7f9ec8
      https://github.com/llvm/llvm-project/commit/bf3652b1e7eb0633c13afcc23bbc238f5e7f9ec8
  Author: Iñaki Amatria Barral <140811900+inaki-amatria at users.noreply.github.com>
  Date:   2026-06-22 (Mon, 22 Jun 2026)

  Changed paths:
    A llvm/test/tools/llvm-cov/show-colors-uninit.test
    M llvm/tools/llvm-cov/CodeCoverage.cpp

  Log Message:
  -----------
  [llvm-cov] Init `ViewOpts.Colors` before `error()` (#205001)

The `commandLineParser` lambda calls `error()` at several points before
`ViewOpts.Colors` is set. `error()` uses `ViewOpts.colored_ostream()`
which reads `Colors`, triggering undefined behavior (load of
uninitialized `bool`).

Fix by moving the `Colors` initialization block to just after
`ParseCommandLineOptions`, before any `error()` call in the lambda. This
ensures error messages are always rendered with properly initialized
color settings.



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