[PATCH] D55433: [clang-tidy] Adding a new modernize use nodiscard checker

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 3 07:25:30 PST 2019


MyDeveloperDay added inline comments.


================
Comment at: clang-tidy/modernize/UseNodiscardCheck.cpp:30
+// TODO: Find a better way of detecting a function template.
+static bool isFunctionTemplate(const QualType &ParamType) {
+  // Try to catch both std::function and boost::function
----------------
JonasToth wrote:
> Do you want a function-template (`template <class T> void foo(T argument);`) or the template-function `{std,boost}::function`?
> For the first the approach should be the same as above, for the second your implementation might work.
> 
> But a matcher with `hasAnyName("::std::function", "::boost::function")` would be cleaner if you can use that instead.
I can't seem to get the hasName or hasAnyName matcher pick up std::function<> as an argument

Using clang-query, I can't get this to work, did I miss something?

```
match functionDecl(hasAnyParameter(hasType(namedDecl(hasName("::std::function"))))).bind("x")
```



CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55433/new/

https://reviews.llvm.org/D55433





More information about the cfe-commits mailing list