[all-commits] [llvm/llvm-project] 9c7b7e: [clang-format] Fix crashes on directives in discar...

Andre Sun via All-commits all-commits at lists.llvm.org
Tue Sep 29 12:48:25 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9c7b7eef6af2d93ab3317e0689715188ae981cc5
      https://github.com/llvm/llvm-project/commit/9c7b7eef6af2d93ab3317e0689715188ae981cc5
  Author: Andre Sun <andsun9999 at gmail.com>
  Date:   2026-09-29 (Tue, 29 Sep 2026)

  Changed paths:
    M clang/lib/Format/AffectedRangeManager.cpp
    M clang/lib/Format/UnwrappedLineParser.cpp
    M clang/lib/Format/UnwrappedLineParser.h
    M clang/unittests/Format/FormatTestMacroExpansion.cpp

  Log Message:
  -----------
  [clang-format] Fix crashes on directives in discarded macro call args (#221501)

Rewinding discarded macro arguments processes their preprocessor
directives twice, duplicating lines and causing crashes. Restore the
preprocessor bookkeeping on rewind, but retain the first set of
directive lines and discard duplicates during replay.

Exclude expansion EOF tokens from directive ranges so directives before
empty expansions are still formatted.

Fixes #131157

Assisted-by: Claude Code



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