[PATCH] D17926: [clang-tidy] Don't delete unused parameter in class override method in anonymous namespace.

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 7 08:33:52 PST 2016


hokein added inline comments.

================
Comment at: clang-tidy/misc/UnusedParametersCheck.cpp:80
@@ +79,3 @@
+      UsedByRef() ||
+      !ast_matchers::match(cxxMethodDecl(isOverride()), *Function,
+                           *Result.Context)
----------------
alexfh wrote:
> I meant, you can use it inside `UsedByRef`.
Looks like we can't make it in `UsedByRef`.

The `ast_matchers::match` argument passed in `UsedByRef` is a `TranslationUnitDecl` type, which isn't used to match `CXXMethodDecl`. the code below is always true:

```
ast_matchers::match(
      cxxMethodDecl(isOverride()),
      *Result.Context->getTranslationUnitDecl(), *Result.Context).empty() 
```


http://reviews.llvm.org/D17926





More information about the cfe-commits mailing list