Hi klimek, bkramer,

http://reviews.llvm.org/D5479

Files:
  clang-tidy/google/NamedParameterCheck.cpp
  test/clang-tidy/google-readability-function.cpp
Index: test/clang-tidy/google-readability-function.cpp
===================================================================
--- test/clang-tidy/google-readability-function.cpp
+++ test/clang-tidy/google-readability-function.cpp
@@ -103,3 +103,22 @@
 Z &operator--(Z&, int) {}
 // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: all parameters should be named in a function
 // CHECK-FIXES: Z &operator--(Z& /*unused*/, int) {}
+
+namespace testing {
+namespace internal {
+class IgnoredValue {
+ public:
+  template <typename T>
+  IgnoredValue(const T& /* ignored */) {}
+};
+}
+typedef internal::IgnoredValue Unused;
+}
+
+using ::testing::Unused;
+
+void MockFunction(Unused, int q, Unused) {
+  ++q;
+  ++q;
+  ++q;
+}
Index: clang-tidy/google/NamedParameterCheck.cpp
===================================================================
--- clang-tidy/google/NamedParameterCheck.cpp
+++ clang-tidy/google/NamedParameterCheck.cpp
@@ -60,6 +60,11 @@
         !SM.isWrittenInSameFile(Parm->getLocStart(), Parm->getLocation()))
       continue;
 
+    // Skip gmock testing::Unused parameters.
+    if (auto Typedef = Parm->getType()->getAs<clang::TypedefType>())
+      if (Typedef->getDecl()->getQualifiedNameAsString() == "testing::Unused")
+        continue;
+
     // Look for comments. We explicitly want to allow idioms like
     // void foo(int /*unused*/)
     const char *Begin = SM.getCharacterData(Parm->getLocStart());
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to