Re: [PATCH] D19876: Add an AST matcher for string-literal length

2016-05-11 Thread Aaron Ballman via cfe-commits
aaron.ballman accepted this revision. aaron.ballman added a comment. This revision is now accepted and ready to land. LGTM, thank you for this! http://reviews.llvm.org/D19876 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.

Re: [PATCH] D19876: Add an AST matcher for string-literal length

2016-05-11 Thread Etienne Bergeron via cfe-commits
etienneb updated this revision to Diff 56942. etienneb added a comment. re-generating doc http://reviews.llvm.org/D19876 Files: docs/LibASTMatchersReference.html include/clang/ASTMatchers/ASTMatchers.h include/clang/ASTMatchers/ASTMatchersInternal.h unittests/ASTMatchers/ASTMatchersTest

Re: [PATCH] D19876: Add an AST matcher for string-literal length

2016-05-10 Thread Aaron Ballman via cfe-commits
aaron.ballman added a comment. In http://reviews.llvm.org/D19876#423582, @etienneb wrote: > Aaron? minus re-generation of the doc. > Is that what you want to see? Yes, this is the direction I was hoping for, thank you! > note: returned types for both getLength are not the same (APInt vs unsig

Re: [PATCH] D19876: Add an AST matcher for string-literal length

2016-05-06 Thread Etienne Bergeron via cfe-commits
etienneb added a comment. Aaron? minus re-generation of the doc. Is that what you want to see? note: returned types for both getLength are not the same (APInt vs unsigned int). I took the 'hasSize'-Matcher approach to let overloaded operators do the job for dispatching types. note: there is a

Re: [PATCH] D19876: Add an AST matcher for string-literal length

2016-05-06 Thread Etienne Bergeron via cfe-commits
etienneb updated this revision to Diff 56425. etienneb added a comment. fix unittests http://reviews.llvm.org/D19876 Files: include/clang/ASTMatchers/ASTMatchers.h include/clang/ASTMatchers/ASTMatchersInternal.h unittests/ASTMatchers/ASTMatchersTest.cpp Index: unittests/ASTMatchers/ASTMa

Re: [PATCH] D19876: Add an AST matcher for string-literal length

2016-05-06 Thread Etienne Bergeron via cfe-commits
etienneb updated this revision to Diff 56423. etienneb added a comment. merging hasSize http://reviews.llvm.org/D19876 Files: include/clang/ASTMatchers/ASTMatchers.h include/clang/ASTMatchers/ASTMatchersInternal.h unittests/ASTMatchers/ASTMatchersTest.cpp Index: unittests/ASTMatchers/AST

Re: [PATCH] D19876: Add an AST matcher for string-literal length

2016-05-06 Thread Etienne Bergeron via cfe-commits
etienneb added inline comments. Comment at: include/clang/ASTMatchers/ASTMatchers.h:1578 @@ +1577,3 @@ +/// \endcode +AST_MATCHER_P(StringLiteral, lengthIs, unsigned, N) { + return Node.getLength() == N; etienneb wrote: > aaron.ballman wrote: > > etienneb wrote:

Re: [PATCH] D19876: Add an AST matcher for string-literal length

2016-05-04 Thread Etienne Bergeron via cfe-commits
etienneb added a comment. Other opinions? I'll proceed to the cleanup if no one else has comments. Comment at: include/clang/ASTMatchers/ASTMatchers.h:1575 @@ +1574,3 @@ +/// \code +/// char *s = "abcd"; wchar_t *ws = L"abcd"; +/// char *t = "a"; aaron.ballm

Re: [PATCH] D19876: Add an AST matcher for string-literal length

2016-05-04 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments. Comment at: include/clang/ASTMatchers/ASTMatchers.h:1575 @@ +1574,3 @@ +/// \code +/// char *s = "abcd"; wchar_t *ws = L"abcd"; +/// char *t = "a"; etienneb wrote: > aaron.ballman wrote: > > Split these onto two lines? > If

Re: [PATCH] D19876: Add an AST matcher for string-literal length

2016-05-04 Thread Etienne Bergeron via cfe-commits
etienneb added a comment. Aaron? could you comment on it? Comment at: include/clang/ASTMatchers/ASTMatchers.h:1575 @@ +1574,3 @@ +/// \code +/// char *s = "abcd"; wchar_t *ws = L"abcd"; +/// char *t = "a"; aaron.ballman wrote: > Split these onto two lines? I

Re: [PATCH] D19876: Add an AST matcher for string-literal length

2016-05-03 Thread Etienne Bergeron via cfe-commits
etienneb added inline comments. Comment at: include/clang/ASTMatchers/ASTMatchers.h:1578 @@ +1577,3 @@ +/// \endcode +AST_MATCHER_P(StringLiteral, lengthIs, unsigned, N) { + return Node.getLength() == N; aaron.ballman wrote: > Perhaps we can adjust the `hasSize()

Re: [PATCH] D19876: Add an AST matcher for string-literal length

2016-05-03 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments. Comment at: include/clang/ASTMatchers/ASTMatchers.h:1575 @@ +1574,3 @@ +/// \code +/// char *s = "abcd"; wchar_t *ws = L"abcd"; +/// char *t = "a"; Split these onto two lines? Comment at: include/clang/AST

Re: [PATCH] D19876: Add an AST matcher for string-literal length

2016-05-03 Thread Etienne Bergeron via cfe-commits
etienneb updated this revision to Diff 56025. etienneb added a comment. fix doc http://reviews.llvm.org/D19876 Files: docs/LibASTMatchersReference.html include/clang/ASTMatchers/ASTMatchers.h lib/ASTMatchers/Dynamic/Registry.cpp unittests/ASTMatchers/ASTMatchersTest.cpp Index: unittest

[PATCH] D19876: Add an AST matcher for string-literal length

2016-05-03 Thread Etienne Bergeron via cfe-commits
etienneb created this revision. etienneb added reviewers: alexfh, sbenza, aaron.ballman, klimek. etienneb added a subscriber: cfe-commits. Herald added a subscriber: klimek. This patch is adding support for a matcher to check string literal length. This matcher is used in clang-tidy checkers and