[clang-tools-extra] r221340 - [clang-tidy] google-readability-function: skip std::nullptr_t
Alexander Kornienko
alexfh at google.com
Wed Nov 5 03:08:39 PST 2014
Author: alexfh
Date: Wed Nov 5 05:08:39 2014
New Revision: 221340
URL: http://llvm.org/viewvc/llvm-project?rev=221340&view=rev
Log:
[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.
Modified:
clang-tools-extra/trunk/clang-tidy/google/NamedParameterCheck.cpp
clang-tools-extra/trunk/test/clang-tidy/google-readability-function.cpp
Modified: clang-tools-extra/trunk/clang-tidy/google/NamedParameterCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/google/NamedParameterCheck.cpp?rev=221340&r1=221339&r2=221340&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/google/NamedParameterCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/google/NamedParameterCheck.cpp Wed Nov 5 05:08:39 2014
@@ -65,6 +65,10 @@ void NamedParameterCheck::check(const Ma
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());
Modified: clang-tools-extra/trunk/test/clang-tidy/google-readability-function.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/google-readability-function.cpp?rev=221340&r1=221339&r2=221340&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/google-readability-function.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/google-readability-function.cpp Wed Nov 5 05:08:39 2014
@@ -122,3 +122,9 @@ void MockFunction(Unused, int q, Unused)
++q;
++q;
}
+
+namespace std {
+typedef decltype(nullptr) nullptr_t;
+}
+
+void f(std::nullptr_t) {}
More information about the cfe-commits
mailing list