[all-commits] [llvm/llvm-project] d7063b: [clang-format] Fix a crash on triple-bracket input...

lianjinfeng2003 via All-commits all-commits at lists.llvm.org
Mon Jul 13 12:08:53 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d7063b00431358c0202a04e67f4824e20244b26f
      https://github.com/llvm/llvm-project/commit/d7063b00431358c0202a04e67f4824e20244b26f
  Author: lianjinfeng2003 <101249452+mygitljf at users.noreply.github.com>
  Date:   2026-07-13 (Mon, 13 Jul 2026)

  Changed paths:
    M clang/lib/Format/TokenAnnotator.cpp
    M clang/unittests/Format/FormatTest.cpp

  Log Message:
  -----------
  [clang-format] Fix a crash on triple-bracket input like `[[[a]]` (#199103)

## Summary
`clang-format` aborts on triple-bracket input like `[[[a]]` with
`Assertion 'Left.isNot(tok::l_square)' failed.` This patch fixes the
crash by rejecting the C++ attribute classification when the candidate
`[[` is itself preceded by another `[`.
## Solution
Add one defensive check to `isCppAttribute` that mirrors the existing
ObjC-array-literal exclusion: bail out when `Tok.Previous` is another
`[`.
Fixes #199010



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