Author: alexfh
Date: Fri Jul 28 05:46:08 2017
New Revision: 309380

URL: http://llvm.org/viewvc/llvm-project?rev=309380&view=rev
Log:
[clang-tidy] Expand readability-redundant-function-ptr-dereference test

Modified:
    
clang-tools-extra/trunk/test/clang-tidy/readability-redundant-function-ptr-dereference.cpp

Modified: 
clang-tools-extra/trunk/test/clang-tidy/readability-redundant-function-ptr-dereference.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-redundant-function-ptr-dereference.cpp?rev=309380&r1=309379&r2=309380&view=diff
==============================================================================
--- 
clang-tools-extra/trunk/test/clang-tidy/readability-redundant-function-ptr-dereference.cpp
 (original)
+++ 
clang-tools-extra/trunk/test/clang-tidy/readability-redundant-function-ptr-dereference.cpp
 Fri Jul 28 05:46:08 2017
@@ -16,6 +16,27 @@ void positive() {
   // CHECK-FIXES: (*p)(2);
 }
 
+template<typename T>
+void invoke(const T& fn) {
+  fn(0); // 1
+  (*fn)(0); // 2
+  // CHECK-MESSAGES: :[[@LINE-1]]:4: warning: redundant repeated
+  // CHECK-FIXES: fn(0); // 1
+  // CHECK-FIXES: (fn)(0); // 2
+  // FIXME: Remove unnecessary parentheses.
+}
+
+void f1(int);
+void f2(double);
+void f3(char);
+
+void instantiate() {
+  invoke(f1);
+  invoke(f2);
+  invoke(f3);
+  invoke([](unsigned) {});
+}
+
 void negative() {
   void (*q)(int) = &f;
 


_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to