[all-commits] [llvm/llvm-project] 94215d: [clang-format] Correctly annotate star/amp in func...

Emilia Dreamer via All-commits all-commits at lists.llvm.org
Mon Oct 17 22:17:56 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 94215d2b2103c5ad74596dd51704836f92afec89
      https://github.com/llvm/llvm-project/commit/94215d2b2103c5ad74596dd51704836f92afec89
  Author: Emilia Dreamer <emilia at rymiel.space>
  Date:   2022-10-18 (Tue, 18 Oct 2022)

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

  Log Message:
  -----------
  [clang-format] Correctly annotate star/amp in function pointer params

Inside the arguments part of a function pointer declaration,
`determineStarAmpUsage` results in a binary operator rather than
pointers, because said parens are assumed to be an expression.

This patch correctly marks the argument parens of a function
pointer type as not an expression. Note that this fix already
existed for Objective-C blocks as part of f1f267b447f60528440d2c066b29ab014ae7f90f.
As Objective-C blocks and C/C++ function pointers share a lot
of the same logic, that fix also makes sense here.

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

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




More information about the All-commits mailing list