[all-commits] [llvm/llvm-project] 5dc94b: [clang-format] Don't modify template arguments on ...

Emilia Dreamer via All-commits all-commits at lists.llvm.org
Tue Apr 11 14:36:31 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5dc94b3356bd861d304e1ab61f7bb9ef33bf46b3
      https://github.com/llvm/llvm-project/commit/5dc94b3356bd861d304e1ab61f7bb9ef33bf46b3
  Author: Emilia Dreamer <emilia at rymiel.space>
  Date:   2023-04-12 (Wed, 12 Apr 2023)

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

  Log Message:
  -----------
  [clang-format] Don't modify template arguments on the LHS of assignment

After clang-format has determined that an equals sign starts an
expression, it will also go backwards and modify any star/amp/ampamp
binary operators on the left side of the assignment to be
pointers/references instead.

There already exists logic to skip over contents of parentheses and
square brackets, but this patch also expands that logic to apply to
angle brackets. This is so that binary operators inside of template
arguments would not be touched, primary arguments to non-type template
parameters.

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

Reviewed By: owenpan, MyDeveloperDay, HazardyKnusperkeks

Differential Revision: https://reviews.llvm.org/D148024




More information about the All-commits mailing list