llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.34k stars 11.7k forks source link

clang-tidy readability-identifier-naming fails for template template parameters #57426

Open marcin-szmagara opened 2 years ago

marcin-szmagara commented 2 years ago

Consider following c++20 code:

template <template <typename> typename T>
constexpr bool always_true = true;

template <typename T>
using change_to_camel_case = void;

int main()
{
  always_true<change_to_camel_case>;
}

and following .clang-tidy config file:

---
Checks: '-*, readability-identifier-naming'

FormatStyle:     file
CheckOptions:
  - { key: readability-identifier-naming.TypeAliasCase, value: CamelCase  }
...

Both clang-tidy with --fix option and clangd using code-actions, rename the type alias at it's definition, but not at it's usage. In other words, the output file is:

template <template <typename> typename T>
constexpr bool always_true = true;

template <typename T>
using ChangeToCamelCase = void;

int main()
{
  always_true<change_to_camel_case>;
}
llvmbot commented 2 years ago

@llvm/issue-subscribers-clang-tidy