<div dir="ltr"><div dir="ltr">It looks like this commit breaks buildbots (e.g. <a href="http://lab.llvm.org:8011/builders/clang-cmake-armv8-quick/builds/6711">http://lab.llvm.org:8011/builders/clang-cmake-armv8-quick/builds/6711</a>). Could you take a look?</div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Sep 17, 2018 at 2:33 PM Idriss Riouak via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: idrissrio<br>
Date: Mon Sep 17 05:29:29 2018<br>
New Revision: 342388<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=342388&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=342388&view=rev</a><br>
Log:<br>
[Clang-Tidy: modernize] Fix for modernize-redundant-void-arg: complains about variable cast to void<br>
<br>
Summary:<br>
Hello, i would like to suggest a fix for one of the checks in clang-tidy.The bug was reported in <a href="https://bugs.llvm.org/show_bug.cgi?id=32575" rel="noreferrer" target="_blank">https://bugs.llvm.org/show_bug.cgi?id=32575</a> where you can find more information.<br>
<br>
For example:<br>
```<br>
template <typename T0><br>
struct S {<br>
  template <typename T><br>
  void g() const {<br>
    int a;<br>
    (void)a;<br>
  }<br>
};<br>
<br>
void f() {<br>
  S<int>().g<int>();<br>
}<br>
```<br>
<br>
<br>
this piece of code should not trigger any warning by the check modernize-redundant-void-arg but when we execute the following command<br>
<br>
<br>
```<br>
clang_tidy -checks=-*,modernize-redundant-void-arg test.cpp -- -std=c++11<br>
```<br>
<br>
we obtain the following warning:<br>
<br>
/Users/eco419/Desktop/clang-tidy.project/void-redundand_2/test.cpp:6:6: warning: redundant void argument list in function declaration [modernize-redundant-void-arg]<br>
    (void)a;<br>
     ^~~~<br>
<br>
Reviewers: aaron.ballman, hokein, alexfh, JonasToth<br>
<br>
Reviewed By: aaron.ballman, JonasToth<br>
<br>
Subscribers: JonasToth, lebedev.ri, cfe-commits<br>
<br>
Tags: #clang-tools-extra<br>
<br>
Differential Revision: <a href="https://reviews.llvm.org/D52135" rel="noreferrer" target="_blank">https://reviews.llvm.org/D52135</a><br>
<br>
Modified:<br>
    clang-tools-extra/trunk/clang-tidy/modernize/RedundantVoidArgCheck.cpp<br>
    clang-tools-extra/trunk/test/clang-tidy/modernize-redundant-void-arg.cpp<br>
<br>
Modified: clang-tools-extra/trunk/clang-tidy/modernize/RedundantVoidArgCheck.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/RedundantVoidArgCheck.cpp?rev=342388&r1=342387&r2=342388&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/RedundantVoidArgCheck.cpp?rev=342388&r1=342387&r2=342388&view=diff</a><br>
==============================================================================<br>
--- clang-tools-extra/trunk/clang-tidy/modernize/RedundantVoidArgCheck.cpp (original)<br>
+++ clang-tools-extra/trunk/clang-tidy/modernize/RedundantVoidArgCheck.cpp Mon Sep 17 05:29:29 2018<br>
@@ -49,7 +49,7 @@ void RedundantVoidArgCheck::registerMatc<br>
     return;<br>
<br>
   Finder->addMatcher(functionDecl(parameterCountIs(0), unless(isImplicit()),<br>
-                                  unless(isExternC()))<br>
+                                  unless(isInstantiated()), unless(isExternC()))<br>
                          .bind(FunctionId),<br>
                      this);<br>
   Finder->addMatcher(typedefNameDecl().bind(TypedefId), this);<br>
<br>
Modified: clang-tools-extra/trunk/test/clang-tidy/modernize-redundant-void-arg.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/modernize-redundant-void-arg.cpp?rev=342388&r1=342387&r2=342388&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/modernize-redundant-void-arg.cpp?rev=342388&r1=342387&r2=342388&view=diff</a><br>
==============================================================================<br>
--- clang-tools-extra/trunk/test/clang-tidy/modernize-redundant-void-arg.cpp (original)<br>
+++ clang-tools-extra/trunk/test/clang-tidy/modernize-redundant-void-arg.cpp Mon Sep 17 05:29:29 2018<br>
@@ -488,3 +488,64 @@ void lambda_expression_with_macro_test()<br>
   // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: redundant void argument list in lambda expression [modernize-redundant-void-arg]<br>
   // CHECK-FIXES: []() BODY;<br>
 }<br>
+<br>
+struct S_1 {<br>
+  void g_1(void) const {<br>
+    // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: redundant void argument list in function definition [modernize-redundant-void-arg]<br>
+    // CHECK-FIXES: void g_1() const {<br>
+    int a;<br>
+    (void)a;<br>
+  }<br>
+<br>
+  void g_2() const {<br>
+    int a;<br>
+    (void)a;<br>
+  }<br>
+};<br>
+<br>
+template <typename T0><br>
+struct S_2 {<br>
+  void g_1(void) const {<br>
+    // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: redundant void argument list in function definition [modernize-redundant-void-arg]<br>
+    // CHECK-FIXES: void g_1() const {<br>
+    int a;<br>
+    (void)a;<br>
+  }<br>
+<br>
+  void g_2() const {<br>
+    int a;<br>
+    (void)a;<br>
+  }<br>
+};<br>
+<br>
+template <typename T0><br>
+struct S_3 {<br>
+  template <typename T1><br>
+  void g_1(void) const {<br>
+    // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: redundant void argument list in function definition [modernize-redundant-void-arg]<br>
+    // CHECK-FIXES: void g_1() const {<br>
+    int a;<br>
+    (void)a;<br>
+  }<br>
+  template <typename T2><br>
+  void g_2() const {<br>
+    int a;<br>
+    (void)a;<br>
+  }<br>
+};<br>
+<br>
+template <typename T1><br>
+void g_3(void) {<br>
+  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: redundant void argument list in function definition [modernize-redundant-void-arg]<br>
+  // CHECK-FIXES: void g_3(){<br>
+  int a;<br>
+  (void)a;<br>
+}<br>
+<br>
+//Template instantiation<br>
+void f_testTemplate() {<br>
+  S_1();<br>
+  S_2<int>();<br>
+  S_3<int>();<br>
+  g_3<int>();<br>
+}<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div>