[PATCH] D52135: Hello, i would like to suggest a fix for one of the checks in clang-tidy.The bug was reported in https://bugs.llvm.org/show_bug.cgi?id=32575 where you can find more information.

Idriss via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Sep 15 07:21:12 PDT 2018


IdrissRio created this revision.
IdrissRio added reviewers: aaron.ballman, hokein, alexfh.
Herald added a subscriber: cfe-commits.

[Clang-Tidy: modernize] Fix for modernize-redundant-void-arg: complains about variable cast to void


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D52135

Files:
  clang-tidy/modernize/RedundantVoidArgCheck.cpp
  test/clang-tidy/modernize-redundant-void-arg.cpp


Index: test/clang-tidy/modernize-redundant-void-arg.cpp
===================================================================
--- test/clang-tidy/modernize-redundant-void-arg.cpp
+++ test/clang-tidy/modernize-redundant-void-arg.cpp
@@ -488,3 +488,17 @@
   // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: redundant void argument list in lambda expression [modernize-redundant-void-arg]
   // CHECK-FIXES: []() BODY;
 }
+
+template <typename T0>
+struct S_template {
+	template <typename T>
+	void g_template() const {
+		int a_template;
+		(void)a_template;
+	}
+};
+
+void test_template() {
+	S_template<int>().g_template<int>();
+}
+
Index: clang-tidy/modernize/RedundantVoidArgCheck.cpp
===================================================================
--- clang-tidy/modernize/RedundantVoidArgCheck.cpp
+++ clang-tidy/modernize/RedundantVoidArgCheck.cpp
@@ -49,7 +49,7 @@
     return;
 
   Finder->addMatcher(functionDecl(parameterCountIs(0), unless(isImplicit()),
-                                  unless(isExternC()))
+                                  unless(isInstantiated()), unless(isExternC()))
                          .bind(FunctionId),
                      this);
   Finder->addMatcher(typedefNameDecl().bind(TypedefId), this);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52135.165641.patch
Type: text/x-patch
Size: 1240 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180915/2f7b0d37/attachment.bin>


More information about the cfe-commits mailing list