[PATCH] D151383: [clang-tidy] Check for specific return types on all functions

Piotr Zegar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 26 07:33:01 PDT 2023


PiotrZSL added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/bugprone/UnusedReturnValueCheck.cpp:159
+                   anyOf(isInstantiatedFrom(hasAnyName(FunVec)),
+                         hasAnyReturnType(RetTypeVec)))))
           .bind("match"))));
----------------
Consider:

hasAnyReturnType -> `returns(hasCanonicalType(hasDeclaration(namedDecl(matchers::matchesAnyListedName(RetTypeVec))))`
Note that to use matchesAnyListedName, you should save RetTypeVec  as class member, just to be safe.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151383



More information about the cfe-commits mailing list