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

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 14 04:54:32 PST 2018


MyDeveloperDay marked 7 inline comments as done.
MyDeveloperDay added inline comments.


================
Comment at: clang-tidy/modernize/UseNodiscardCheck.cpp:25
+static bool isAliasedTemplateParamType(const QualType &ParamType) {
+  return (ParamType.getCanonicalType().getAsString().find("type-parameter-") !=
+          std::string::npos);
----------------
curdeius wrote:
> This indeed looks a bit ugly. Is there no check that skips const-ref template params and handles `using`s / `typedef`s?
I'm half hoping @JonasToth might guide me to something better ;-) 


================
Comment at: clang-tidy/modernize/UseNodiscardCheck.cpp:31
+static bool isFunctionTemplate(const QualType &ParamType) {
+  return (ParamType.getAsString().find("std::function") != std::string::npos);
+}
----------------
curdeius wrote:
> I'm not sure if you can find a better way to find parameters of type `std::function` than this... Unless we find the rules that distinguish function types from others.
> Why is `std::function` so different? How could we match `boost::function` and alike types?
> 
> Just setting the questions, I have no answers.
> 
> Anyway, I think that this might be left for later to be improved.
I know, I didn't like it either... I was trying to exclude a lambda being passed in, just to limit the heuristic and thus reduce the SNR


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

https://reviews.llvm.org/D55433





More information about the cfe-commits mailing list