Re: [PATCH] D19146: [clang-tidy] New checker to detect suspicious string constructor.

2016-04-21 Thread Etienne Bergeron via cfe-commits
etienneb updated this revision to Diff 54532. etienneb added a comment. rebased http://reviews.llvm.org/D19146 Files: clang-tidy/misc/CMakeLists.txt clang-tidy/misc/MiscTidyModule.cpp clang-tidy/misc/StringConstructorCheck.cpp clang-tidy/misc/StringConstructorCheck.h docs/clang-tidy/c

Re: [PATCH] D19146: [clang-tidy] New checker to detect suspicious string constructor.

2016-04-19 Thread Alexander Kornienko via cfe-commits
alexfh accepted this revision. alexfh added a comment. This revision is now accepted and ready to land. Looks good with a nit. In http://reviews.llvm.org/D19146#403234, @alexfh wrote: > In http://reviews.llvm.org/D19146#402414, @alexfh wrote: > > > In http://reviews.llvm.org/D19146#402410, @alex

Re: [PATCH] D19146: [clang-tidy] New checker to detect suspicious string constructor.

2016-04-15 Thread Etienne Bergeron via cfe-commits
etienneb updated this revision to Diff 53979. etienneb marked an inline comment as done. etienneb added a comment. alexfh nits. http://reviews.llvm.org/D19146 Files: clang-tidy/misc/CMakeLists.txt clang-tidy/misc/MiscTidyModule.cpp clang-tidy/misc/StringConstructorCheck.cpp clang-tidy/m

Re: [PATCH] D19146: [clang-tidy] New checker to detect suspicious string constructor.

2016-04-15 Thread Alexander Kornienko via cfe-commits
alexfh added inline comments. Comment at: clang-tidy/misc/StringConstructorCheck.cpp:104 @@ +103,3 @@ + const auto *E = Result.Nodes.getNodeAs("constructor"); + assert(E); + We usually add some description to asserts (`assert(X && "X should not be nullptr");`).

Re: [PATCH] D19146: [clang-tidy] New checker to detect suspicious string constructor.

2016-04-15 Thread Alexander Kornienko via cfe-commits
alexfh added a comment. In http://reviews.llvm.org/D19146#402414, @alexfh wrote: > In http://reviews.llvm.org/D19146#402410, @alexfh wrote: > > > I wonder whether `misc-swapped-arguments` can be tuned to handle these > > cases in a more generic way? The only missing part so far seems to be the

Re: [PATCH] D19146: [clang-tidy] New checker to detect suspicious string constructor.

2016-04-15 Thread Etienne Bergeron via cfe-commits
etienneb updated this revision to Diff 53895. etienneb added a comment. add missing unittest for large length parameter http://reviews.llvm.org/D19146 Files: clang-tidy/misc/CMakeLists.txt clang-tidy/misc/MiscTidyModule.cpp clang-tidy/misc/StringConstructorCheck.cpp clang-tidy/misc/Stri

Re: [PATCH] D19146: [clang-tidy] New checker to detect suspicious string constructor.

2016-04-15 Thread Etienne Bergeron via cfe-commits
etienneb updated this revision to Diff 53894. etienneb added a comment. fix unittests http://reviews.llvm.org/D19146 Files: clang-tidy/misc/CMakeLists.txt clang-tidy/misc/MiscTidyModule.cpp clang-tidy/misc/StringConstructorCheck.cpp clang-tidy/misc/StringConstructorCheck.h docs/clang-

Re: [PATCH] D19146: [clang-tidy] New checker to detect suspicious string constructor.

2016-04-15 Thread Etienne Bergeron via cfe-commits
etienneb updated this revision to Diff 53892. etienneb marked 2 inline comments as done. etienneb added a comment. alexfh comments. http://reviews.llvm.org/D19146 Files: clang-tidy/misc/CMakeLists.txt clang-tidy/misc/MiscTidyModule.cpp clang-tidy/misc/StringConstructorCheck.cpp clang-ti

Re: [PATCH] D19146: [clang-tidy] New checker to detect suspicious string constructor.

2016-04-15 Thread Alexander Kornienko via cfe-commits
alexfh added a comment. In http://reviews.llvm.org/D19146#402410, @alexfh wrote: > I wonder whether `misc-swapped-arguments` can be tuned to handle these cases > in a more generic way? The only missing part so far seems to be the lack of > `cxxConstructExpr` support. And by "these cases" I me

Re: [PATCH] D19146: [clang-tidy] New checker to detect suspicious string constructor.

2016-04-15 Thread Alexander Kornienko via cfe-commits
alexfh added a comment. I wonder whether `misc-swapped-arguments` can be tuned to handle these cases in a more generic way? The only missing part so far seems to be the lack of `cxxConstructExpr` support. Comment at: clang-tidy/misc/StringConstructorCheck.cpp:104 @@ +103,3 @@

Re: [PATCH] D19146: [clang-tidy] New checker to detect suspicious string constructor.

2016-04-15 Thread Aaron Ballman via cfe-commits
On Thu, Apr 14, 2016 at 11:29 PM, Etienne Bergeron via cfe-commits wrote: > etienneb created this revision. > etienneb added a reviewer: alexfh. > etienneb added a subscriber: cfe-commits. > > Checker to validate string constructor parameters. > > A common mistake is to swap parameter for the fill

[PATCH] D19146: [clang-tidy] New checker to detect suspicious string constructor.

2016-04-14 Thread Etienne Bergeron via cfe-commits
etienneb created this revision. etienneb added a reviewer: alexfh. etienneb added a subscriber: cfe-commits. Checker to validate string constructor parameters. A common mistake is to swap parameter for the fill-constructor. ``` std::string str('x', 4); std::string str('4', x); ``` http://rev