[Clang-Tidy: modernize] Fix for modernize-redundant-void-arg: complains about variabl...
authorIdriss Riouak <riouakidriss@hotmail.it>
Mon, 17 Sep 2018 12:29:29 +0000 (12:29 +0000)
committerIdriss Riouak <riouakidriss@hotmail.it>
Mon, 17 Sep 2018 12:29:29 +0000 (12:29 +0000)
commit09767acae1632bdce2604b11705149a9ea4c2825
tree767206978cf2b2726dc436f08bb4175c6f109ca5
parent8a1c374b2e5250f90f0e534eac3afb7cbee7acc7
[Clang-Tidy: modernize] Fix for modernize-redundant-void-arg: complains about variable cast to void

Summary:
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.

For example:
```
template <typename T0>
struct S {
  template <typename T>
  void g() const {
    int a;
    (void)a;
  }
};

void f() {
  S<int>().g<int>();
}
```

this piece of code should not trigger any warning by the check modernize-redundant-void-arg but when we execute the following command

```
clang_tidy -checks=-*,modernize-redundant-void-arg test.cpp -- -std=c++11
```

we obtain the following warning:

/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]
    (void)a;
     ^~~~

Reviewers: aaron.ballman, hokein, alexfh, JonasToth

Reviewed By: aaron.ballman, JonasToth

Subscribers: JonasToth, lebedev.ri, cfe-commits

Tags: #clang-tools-extra

Differential Revision: https://reviews.llvm.org/D52135

llvm-svn: 342388
clang-tools-extra/clang-tidy/modernize/RedundantVoidArgCheck.cpp
clang-tools-extra/test/clang-tidy/modernize-redundant-void-arg.cpp