diff options
| author | Alexander Kornienko <alexfh@google.com> | 2014-11-05 11:08:39 +0000 |
|---|---|---|
| committer | Alexander Kornienko <alexfh@google.com> | 2014-11-05 11:08:39 +0000 |
| commit | e20ce07a2fa6c447872da3f8230c08e46166d9e3 (patch) | |
| tree | 159799b589e63d715d935eb7f458a9c87247ed64 | |
| parent | 502fac38e9611a77ab8c1cdd13df9341ede7b8b7 (diff) | |
| download | bcm5719-llvm-e20ce07a2fa6c447872da3f8230c08e46166d9e3.tar.gz bcm5719-llvm-e20ce07a2fa6c447872da3f8230c08e46166d9e3.zip | |
[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
| -rw-r--r-- | clang-tools-extra/clang-tidy/google/NamedParameterCheck.cpp | 4 | ||||
| -rw-r--r-- | clang-tools-extra/test/clang-tidy/google-readability-function.cpp | 6 |
2 files changed, 10 insertions, 0 deletions
diff --git a/clang-tools-extra/clang-tidy/google/NamedParameterCheck.cpp b/clang-tools-extra/clang-tidy/google/NamedParameterCheck.cpp index 4111b906218..58f643c1a5a 100644 --- a/clang-tools-extra/clang-tidy/google/NamedParameterCheck.cpp +++ b/clang-tools-extra/clang-tidy/google/NamedParameterCheck.cpp @@ -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()); diff --git a/clang-tools-extra/test/clang-tidy/google-readability-function.cpp b/clang-tools-extra/test/clang-tidy/google-readability-function.cpp index 1c890196f25..9876f97a1a5 100644 --- a/clang-tools-extra/test/clang-tidy/google-readability-function.cpp +++ b/clang-tools-extra/test/clang-tidy/google-readability-function.cpp @@ -122,3 +122,9 @@ void MockFunction(Unused, int q, Unused) { ++q; ++q; } + +namespace std { +typedef decltype(nullptr) nullptr_t; +} + +void f(std::nullptr_t) {} |

