[all-commits] [llvm/llvm-project] 1d8dc0: [clang-format] Fix crash on assert !Scopes.empty()...

Aayush Shrivastava via All-commits all-commits at lists.llvm.org
Thu Jun 11 14:01:20 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1d8dc059d8e183e95ab71e162f1b47aca659971b
      https://github.com/llvm/llvm-project/commit/1d8dc059d8e183e95ab71e162f1b47aca659971b
  Author: Aayush Shrivastava <iamaayushrivastava at gmail.com>
  Date:   2026-06-11 (Thu, 11 Jun 2026)

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

  Log Message:
  -----------
  [clang-format] Fix crash on assert !Scopes.empty() in parseBrace() (#199100)

Fixes #199017

When angle-bracket parsing fails and resets the token stream, a closing
brace can be consumed twice through `parseConditional()`, each time
popping one entry from Scopes. This leaves Scopes empty when
`parseBrace()` encounters the legitimate closing brace, triggering the
assertion.

Replace the assert with a graceful return false, consistent with the
existing unbalanced-brace handling in `consumeToken()`.



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