forked from OSchip/llvm-project
[clang-tidy] google-readability-function: skip std::nullptr_t
Parameters of type std::nullptr_t can only have one value, so it doesn't make sense to name them. llvm-svn: 221340
This commit is contained in:
parent
502fac38e9
commit
e20ce07a2f
|
@ -65,6 +65,10 @@ void NamedParameterCheck::check(const MatchFinder::MatchResult &Result) {
|
|||
if (Typedef->getDecl()->getQualifiedNameAsString() == "testing::Unused")
|
||||
continue;
|
||||
|
||||
// Skip std::nullptr_t.
|
||||
if (Parm->getType().getCanonicalType()->isNullPtrType())
|
||||
continue;
|
||||
|
||||
// Look for comments. We explicitly want to allow idioms like
|
||||
// void foo(int /*unused*/)
|
||||
const char *Begin = SM.getCharacterData(Parm->getLocStart());
|
||||
|
|
|
@ -122,3 +122,9 @@ void MockFunction(Unused, int q, Unused) {
|
|||
++q;
|
||||
++q;
|
||||
}
|
||||
|
||||
namespace std {
|
||||
typedef decltype(nullptr) nullptr_t;
|
||||
}
|
||||
|
||||
void f(std::nullptr_t) {}
|
||||
|
|
Loading…
Reference in New Issue