[all-commits] [llvm/llvm-project] 5f4ed7: [clang-format] Allow default values for template p...

Emilia Kond via All-commits all-commits at lists.llvm.org
Mon Oct 16 14:38:47 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5f4ed780d348c810a7d4c1dd9354abf79094364b
      https://github.com/llvm/llvm-project/commit/5f4ed780d348c810a7d4c1dd9354abf79094364b
  Author: Emilia Kond <emilia at rymiel.space>
  Date:   2023-10-17 (Tue, 17 Oct 2023)

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

  Log Message:
  -----------
  [clang-format] Allow default values for template parameters in lambda (#69052)

Previously, upon encountering an equals sign while parsing a lambda in
the UnwrappedLineParser, it would fall through and fail. This caused any
lambda template with a default argument for a template parameter to be
annotated as an ArraySubscriptLSquare.

This patch allows equals signs in the UnwrappedLineParser if we're
currently in a template parameter list. This resolved a FIXME that was
in the lambda parsing function.

This patch seems deceptively easy, it's likely it doesn't solve the
FIXME entirely, or causes other issues (the FIXME itself mentions
something about Objective-C, which I cannot comment about). However this
patch is sufficient to fix the below issue.

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

---------

Co-authored-by: Owen Pan <owenpiano at gmail.com>




More information about the All-commits mailing list