[clang-tidy] readability-inconsistent-declaration-parameter-name: accept approximate...
authorSam McCall <sam.mccall@gmail.com>
Fri, 13 Jul 2018 11:41:56 +0000 (11:41 +0000)
committerSam McCall <sam.mccall@gmail.com>
Fri, 13 Jul 2018 11:41:56 +0000 (11:41 +0000)
commit57b66c8ba324787bec1edc6fce0e6c1dc7aad239
tree9f9a6d4b26a12fab795b237b36109724102c5c10
parent1a728f66efbf02f703a1e782efd4172842fd1bb8
[clang-tidy] readability-inconsistent-declaration-parameter-name: accept approximate name matches.

Summary:
The goal is to reduce false positives when the difference is intentional, like:

foo(StringRef name);
foo(StringRef name_ref) {
  string name = cleanup(name_ref);
  ...
}

Or semantically unimportant, like:
foo(StringRef full_name);
foo(StringRef name) { ... }

There are other matching names we won't recognise (e.g. syns vs synonyms) but
this catches many that we see in practice, and gives people a systematic
workaround.

The old behavior is available as a 'Strict' option.

Subscribers: xazax.hun, cfe-commits

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

llvm-svn: 336992
clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp
clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.h
clang-tools-extra/docs/clang-tidy/checks/readability-inconsistent-declaration-parameter-name.rst
clang-tools-extra/test/clang-tidy/readability-inconsistent-declaration-parameter-name-strict.cpp [new file with mode: 0644]
clang-tools-extra/test/clang-tidy/readability-inconsistent-declaration-parameter-name.cpp