[PATCH] D32346: [clang-tidy] New readability check for strlen argument
Daniel Marjamäki via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 24 06:51:00 PDT 2017
danielmarjamaki added a comment.
Thanks for all comments. I am working on fixing them. Updated patch will be uploaded soon.
> Have you run it over a big codebase? What is the turnout?
I did not see this warning yet. Maybe after fixing the comments (::strlen) there will be a difference.
In https://reviews.llvm.org/D32346#733906, @Eugene.Zelenko wrote:
> It may be good idea to add check for arguments which taken from C++ containers like std::string, std::string_view, etc.
Not sure how you want. Do you envision something like:
std::string Par;
strlen(Par.c_str() + 1);
================
Comment at: test/clang-tidy/readability-strlen-argument.cpp:1
+// RUN: %check_clang_tidy %s readability-strlen-argument %t
+
----------------
JonasToth wrote:
> Same as documentation, maybe a little more telling examples to test on.
> What happens with `char**`, an array of strings? Accessing those one by one would be possible with an addition or subscriptoperation.
how do you mean with char**. If you access those one by one it will look something like this right?
char **A;
strlen(*(A+N));
such code is not matched as far as I see.
Repository:
rL LLVM
https://reviews.llvm.org/D32346
More information about the cfe-commits
mailing list