[all-commits] [llvm/llvm-project] 028ea7: [clang-tidy] fix insertion location for function p...

Julian Schmidt via All-commits all-commits at lists.llvm.org
Sun Nov 10 09:27:03 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 028ea71fdda0c02cd11421cd1d26bec6f378666e
      https://github.com/llvm/llvm-project/commit/028ea71fdda0c02cd11421cd1d26bec6f378666e
  Author: Julian Schmidt <git.julian.schmidt at gmail.com>
  Date:   2024-11-10 (Sun, 10 Nov 2024)

  Changed paths:
    M clang-tools-extra/clang-tidy/cppcoreguidelines/InitVariablesCheck.cpp
    M clang-tools-extra/docs/ReleaseNotes.rst
    M clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/init-variables.cpp

  Log Message:
  -----------
  [clang-tidy] fix insertion location for function pointers in cppcoreguidelines-init-variables (#112091)

Previously, the insertion location for the `= nullptr` fix would be
after the variable name. However, if the variable is of type function
pointer that is not an alias, then the insertion would happen inside the
type specification: `void (*a1)(void*);` -> `void (*a1 =
nullptr)(void*);`.
With this change, the insertion location will be at the next
'terminator'. That is, at the next `,` or `;`, as that will finish the
current declaration: `void (a1)(void*) = nullptr;`.

Fixes #112089



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