[all-commits] [llvm/llvm-project] 3e8782: [clang-format] Fix requires misannotation with com...

Emilia Kond via All-commits all-commits at lists.llvm.org
Wed Sep 27 15:34:43 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3e87829a8a9ab6a5f62078c590eec09f5024f95f
      https://github.com/llvm/llvm-project/commit/3e87829a8a9ab6a5f62078c590eec09f5024f95f
  Author: Emilia Kond <emilia at rymiel.space>
  Date:   2023-09-28 (Thu, 28 Sep 2023)

  Changed paths:
    M clang/lib/Format/UnwrappedLineParser.cpp
    M clang/unittests/Format/TokenAnnotatorTest.cpp

  Log Message:
  -----------
  [clang-format] Fix requires misannotation with comma (#65908)

clang-format uses a heuristic to determine if a requires() is either a
requires clause or requires expression, based on what is in the
parentheses. Part of this heuristic assumed that a requires clause can
never contain a comma, however this is not the case if said comma is in
the template argument of a type.

This patch allows commas to appear in a requires clause if an angle
bracket `<` has been opened.

Fixes https://github.com/llvm/llvm-project/issues/65904




More information about the All-commits mailing list