mirror of
https://github.com/intel/llvm.git
synced 2026-01-25 09:33:43 +08:00
[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:
@@ -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) {}
|
||||
|
||||
Reference in New Issue
Block a user