llvm / llvm-project

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

modernize-loop-convert has a tendency to name iterated value m_xxx #35043

Open LegalizeAdulthood opened 6 years ago

LegalizeAdulthood commented 6 years ago
Bugzilla Link 35695
Version unspecified
OS All

Extended Description

There might be a need for a facility concerning identifier conventions beyond the scope of modernize-loop-convert. However, a case came up while applying modernize-loop-convert where the loop was over a container held in a member variable named m_widgets. modernize-loop-convert wrote a loop like this:

for (auto m_widget : m_widgets)

This makes the local variable m_widget appear to be named as if it were following the identifier convention for a member variable. The desired code is

for (auto widget : m_widgets)

readability-identifier-naming understands identifier naming conventions, including particular prefixes and suffixes for things like globals, statics, and members.

Pull out that configuration into a generic facility that is global to clang-tidy and have any checks that introduce identifiers consult those configurations to product identifiers that follow the proper naming.

llvmbot commented 6 years ago

It should be easy to handle in the check. However, there's no active maintainer of this check. Send a patch, if you're interested in supporting this naming convention.