[clang-tools-extra] r322002 - [clang-tidy] Fix DanglingHandleCheck for the correct conversion operation between basic_string and basic_string_view.

2018-01-08 Thread Samuel Benzaquen via cfe-commits
Author: sbenza Date: Mon Jan 8 07:59:08 2018 New Revision: 322002 URL: http://llvm.org/viewvc/llvm-project?rev=322002&view=rev Log: [clang-tidy] Fix DanglingHandleCheck for the correct conversion operation between basic_string and basic_string_view. Summary: Fix DanglingHandleCheck to handle th

Re: [PATCH] D24339: [clang-tidy] Add check 'readability-redundant-member-init'

2016-09-08 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: clang-tidy/readability/RedundantMemberInitCheck.cpp:33 @@ +32,3 @@ + const auto *Init = Result.Nodes.getNodeAs("init"); + const auto *Construct = Result.Nodes.getNodeAs("construct"); + const auto arguments = Construct->arguments(); ---

[clang-tools-extra] r322497 - [clang-tidy] Expand readability-redundant-smartptr-get to understand implicit converions to bool in more contexts.

2018-01-15 Thread Samuel Benzaquen via cfe-commits
Author: sbenza Date: Mon Jan 15 10:03:20 2018 New Revision: 322497 URL: http://llvm.org/viewvc/llvm-project?rev=322497&view=rev Log: [clang-tidy] Expand readability-redundant-smartptr-get to understand implicit converions to bool in more contexts. Summary: Expand readability-redundant-smartptr-g

Re: [PATCH] D13368: [clang-tidy] add check cppcoreguidelines-pro-type-static-cast-downcast

2015-10-02 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: test/clang-tidy/cppcoreguidelines-pro-type-static-cast-downcast.cpp:19 @@ +18,3 @@ + // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: do not use static_cast to cast from base to derived. Use dynamic_cast instead. (C++ Core Guidelines, rule

Re: [PATCH] D13311: [clang-tidy] Add check cppcoreguidelines-pro-bounds-pointer-arithmetic

2015-10-02 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.cpp:38 @@ +37,3 @@ + Finder->addMatcher( + arraySubscriptExpr(hasBase(implicitCastExpr(hasSourceExpression( + hasType(pointerType()).bind("e

Re: [PATCH] D13311: [clang-tidy] Add check cppcoreguidelines-pro-bounds-pointer-arithmetic

2015-10-05 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.cpp:35 @@ +34,3 @@ + + //Array subscript on a pointer (not an array) is also pointer arithmetic + Finder->addMatcher( Space after // Comment

Re: [PATCH] D13446: [PATCH] Add checker discouraging definition of variadic function definitions in C++

2015-10-05 Thread Samuel Benzaquen via cfe-commits
sbenza accepted this revision. sbenza added a comment. This revision is now accepted and ready to land. See comment regarding //CHECKs Comment at: test/clang-tidy/cert-variadic-function-def.cpp:4 @@ +3,3 @@ +// Variadic function definitions are diagnosed. +// CHECK-MESSAGES: :[[

Re: [PATCH] D13368: [clang-tidy] add check cppcoreguidelines-pro-type-static-cast-downcast

2015-10-07 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: test/clang-tidy/cppcoreguidelines-pro-type-static-cast-downcast.cpp:28 @@ +27,3 @@ + + auto P0 = static_cast(new Base()); + // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: do not use static_cast to downcast from a base to a derived class

Re: [PATCH] D12031: Const std::move() argument ClangTidy check

2015-08-21 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: clang-tidy/misc/MoveConstantArgumentCheck.cpp:20 @@ +19,3 @@ + const auto* CallMove = result.Nodes.getNodeAs("call-move"); + if (CallMove->getNumArgs() != 1) return; + const Expr* Arg = CallMove->getArg(0); You can move

r246037 - [ASTMatchers] Add type matcher for SubstTemplateTypeParmType.

2015-08-26 Thread Samuel Benzaquen via cfe-commits
Author: sbenza Date: Wed Aug 26 11:15:59 2015 New Revision: 246037 URL: http://llvm.org/viewvc/llvm-project?rev=246037&view=rev Log: [ASTMatchers] Add type matcher for SubstTemplateTypeParmType. Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h cfe/trunk/lib/ASTMatchers/Dynamic/

Re: [PATCH] D13510: [PATCH] Support C++ Core Guidelines copy assignment restrictions

2015-10-07 Thread Samuel Benzaquen via cfe-commits
sbenza added a comment. In http://reviews.llvm.org/D13510#261925, @aaron.ballman wrote: > In http://reviews.llvm.org/D13510#261825, @Eugene.Zelenko wrote: > > > I think it'll be fine to rename check without leaving traces of misc. Same > > thing happened with modernize-shrink-to-fit. > > > I thi

Re: [PATCH] D13567: [PATCH] Add checker discouraging use of setjmp/longjmp in C++

2015-10-08 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: clang-tidy/cert/SetLongJmpCheck.cpp:31 @@ +30,3 @@ +public: + explicit SetJmpMacroCallbacks(Preprocessor *PP, SetLongJmpCheck &Check) + : PP(PP), Check(Check) {} Why do you pass one as a pointer and one as a referenc

Re: [PATCH] D13640: [clang-tidy] Add new check cppcoreguidelines-pro-bounds-array-to-pointer-decay

2015-10-12 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp:29 @@ +28,3 @@ + implicitCastExpr(unless(hasParent(arraySubscriptExpr())), + unless(hasSourceExpression(declRefExpr(to(varDecl(hasName("__range

Re: [PATCH] D13784: [clang-tidy] add check cppcoreguidelines-pro-type-union-access

2015-10-16 Thread Samuel Benzaquen via cfe-commits
sbenza accepted this revision. sbenza added a comment. This revision is now accepted and ready to land. Seems straightforward. http://reviews.llvm.org/D13784 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailm

Re: [PATCH] D13787: [clang-tidy] add check cppcoreguidelines-pro-type-vararg-use

2015-10-16 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: clang-tidy/cppcoreguidelines/ProTypeVarargUseCheck.cpp:20 @@ +19,3 @@ +void ProTypeVarargUseCheck::registerMatchers(MatchFinder *Finder) { + Finder->addMatcher(callExpr(callee(functionDecl(isVariadic(.bind("expr"), this); +} ---

Re: [PATCH] D13784: [clang-tidy] add check cppcoreguidelines-pro-type-union-access

2015-10-16 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: clang-tidy/cppcoreguidelines/ProTypeUnionAccessCheck.cpp:20 @@ +19,3 @@ +void ProTypeUnionAccessCheck::registerMatchers(MatchFinder *Finder) { + Finder->addMatcher(memberExpr(hasObjectExpression(hasType(recordDecl(isUnion().bind("exp

Re: [PATCH] D13746: [clang-tidy] add check cppcoreguidelines-pro-bounds-constant-array-index

2015-10-16 Thread Samuel Benzaquen via cfe-commits
sbenza added a comment. Thanks for the patch. A few comments below. Comment at: clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp:23 @@ +22,3 @@ + + Finder->addMatcher(arraySubscriptExpr(hasBase(ignoringImpCasts(hasType(constantArrayType().bind("type", +

Re: [PATCH] D13746: [clang-tidy] add check cppcoreguidelines-pro-bounds-constant-array-index

2015-10-16 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp:55 @@ +54,3 @@ + if (!IndexExpr->isIntegerConstantExpr(Index, *Result.Context, nullptr, true)) { +//Fixit would need gsl::at() +diag(Matched->getExprLoc(), "do not

Re: [PATCH] D13787: [clang-tidy] add check cppcoreguidelines-pro-type-vararg-use

2015-10-19 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: clang-tidy/cppcoreguidelines/ProTypeVarargUseCheck.cpp:20 @@ +19,3 @@ +void ProTypeVarargUseCheck::registerMatchers(MatchFinder *Finder) { + Finder->addMatcher(callExpr(callee(functionDecl(isVariadic(.bind("expr"), this); +} ---

Re: [PATCH] D13787: [clang-tidy] add check cppcoreguidelines-pro-type-vararg-use

2015-10-19 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: clang-tidy/cppcoreguidelines/ProTypeVarargCheck.cpp:26 @@ +25,3 @@ + Finder->addMatcher( + varDecl(hasType(pointsTo(cxxRecordDecl(hasName("__va_list_tag") + .bind("va_list"), Is there a way to look for t

Re: [PATCH] D13787: [clang-tidy] add check cppcoreguidelines-pro-type-vararg-use

2015-10-19 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: test/clang-tidy/cppcoreguidelines-pro-type-vararg.cpp:27 @@ +26,3 @@ +template +void CallFooIfAvailableImpl(T& t, ...) { +} You would still warn on the callers of this. Maybe we should ignore any call if the variadic part

[clang-tools-extra] r250742 - Added check uniqueptr-delete-release to replace "delete x.release()" with "x = nullptr"

2015-10-19 Thread Samuel Benzaquen via cfe-commits
Author: sbenza Date: Mon Oct 19 16:49:51 2015 New Revision: 250742 URL: http://llvm.org/viewvc/llvm-project?rev=250742&view=rev Log: Added check uniqueptr-delete-release to replace "delete x.release()" with "x = nullptr" Reviewers: alexfh Differential Revision: http://reviews.llvm.org/D13179 A

[PATCH] D13899: Fix bug in suggested fix that truncated variable names to 1 character.

2015-10-20 Thread Samuel Benzaquen via cfe-commits
sbenza created this revision. sbenza added reviewers: alexfh, aaron.ballman. sbenza added a subscriber: cfe-commits. Fix bug in suggested fix that truncated variable names to 1 character. Also, rework the suggested fix to try to remove unnecessary whitespace. http://reviews.llvm.org/D13899 Files

Re: [clang-tools-extra] r250742 - Added check uniqueptr-delete-release to replace "delete x.release()" with "x = nullptr"

2015-10-20 Thread Samuel Benzaquen via cfe-commits
On Mon, Oct 19, 2015 at 6:00 PM, David Blaikie wrote: > > > On Mon, Oct 19, 2015 at 2:49 PM, Samuel Benzaquen via cfe-commits < > cfe-commits@lists.llvm.org> wrote: > >> Author: sbenza >> Date: Mon Oct 19 16:49:51 2015 >> New Revision: 250742 >> &g

Re: [PATCH] D13787: [clang-tidy] add check cppcoreguidelines-pro-type-vararg-use

2015-10-20 Thread Samuel Benzaquen via cfe-commits
sbenza added a comment. Minor comments only. Comment at: clang-tidy/cppcoreguidelines/ProTypeVarargCheck.cpp:29 @@ +28,3 @@ + callExpr(callee(functionDecl(isVariadic(), + unless(hasName("__builtin_va_start") + .bind("callvararg

Re: [PATCH] D13787: [clang-tidy] add check cppcoreguidelines-pro-type-vararg-use

2015-10-20 Thread Samuel Benzaquen via cfe-commits
sbenza accepted this revision. sbenza added a comment. This revision is now accepted and ready to land. Thanks for check. http://reviews.llvm.org/D13787 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/li

Re: [PATCH] D13946: Shrink DynTypedNode by one pointer from 40 to 32 bytes (on x86_64).

2015-10-21 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: include/clang/AST/ASTTypeTraits.h:250 @@ +249,3 @@ +return NodeKind.hasPointerIdentity() + ? *reinterpret_cast(Storage.buffer) + : nullptr; I'm not sure about this reinterpret_cast. We are n

Re: [PATCH] D13946: Shrink DynTypedNode by one pointer from 40 to 32 bytes (on x86_64).

2015-10-21 Thread Samuel Benzaquen via cfe-commits
sbenza accepted this revision. This revision is now accepted and ready to land. Comment at: include/clang/AST/ASTTypeTraits.h:300 @@ -288,2 +299,3 @@ if (ASTNodeKind::getFromNodeKind().isBaseOf(NodeKind)) -return cast(*reinterpret_cast(Storage)); +return cas

Re: [PATCH] D7639: Add readability-redundant-void-arg check to clang-tidy

2015-10-23 Thread Samuel Benzaquen via cfe-commits
sbenza added a comment. I'm sorry. This change fell through the cracks. I'll take a look today. http://reviews.llvm.org/D7639 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Re: [PATCH] D13640: [clang-tidy] Add new check cppcoreguidelines-pro-bounds-array-to-pointer-decay

2015-10-26 Thread Samuel Benzaquen via cfe-commits
sbenza accepted this revision. sbenza added a comment. This revision is now accepted and ready to land. Just one formatting comment. Comment at: clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp:52 @@ +51,3 @@ + + diag(MatchedCast->getExprLoc(), "do not implic

Re: [PATCH] D14049: clang-tidy/add_new_check.py: Adapt to use %check_clang_tidy in tests

2015-10-26 Thread Samuel Benzaquen via cfe-commits
sbenza accepted this revision. sbenza added a comment. This revision is now accepted and ready to land. Thanks for the fix. http://reviews.llvm.org/D14049 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/

Re: [PATCH] D7639: Add readability-redundant-void-arg check to clang-tidy

2015-10-26 Thread Samuel Benzaquen via cfe-commits
sbenza added a comment. Just fyi, I am looking at this diff. It is very large with a lot of rounds of comments and I didn't have the context. I don't know if I should giving comments at this point of the change, but here it is. Have you considered matching on typeLoc() instead of having a large

Re: [PATCH] D14096: [clang-tidy] add new check cppcoreguidelines-pro-type-cstyle-cast

2015-10-26 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: clang-tidy/cppcoreguidelines/ProTypeCstyleCastCheck.cpp:44 @@ +43,3 @@ + if (MatchedCast->getCastKind() == CK_BitCast || + MatchedCast->getCastKind() == CK_LValueBitCast || + MatchedCast->getCastKind() == CK_IntegralToPointer ||

Re: [PATCH] D14096: [clang-tidy] add new check cppcoreguidelines-pro-type-cstyle-cast

2015-10-27 Thread Samuel Benzaquen via cfe-commits
sbenza added a comment. In http://reviews.llvm.org/D14096#275902, @xazax.hun wrote: > There is already a similar check in the Google package. What are the > differences between those two checks? What is the reason we can not just > register that check into the core guidelines module? That oth

Re: [PATCH] D7639: Add readability-redundant-void-arg check to clang-tidy

2015-10-27 Thread Samuel Benzaquen via cfe-commits
sbenza accepted this revision. sbenza added a comment. This revision is now accepted and ready to land. Just wanted to know it was considered, and it was. It looks good to me then. http://reviews.llvm.org/D7639 ___ cfe-commits mailing list cfe-commi

Re: [PATCH] D13899: Fix bug in suggested fix that truncated variable names to 1 character.

2015-11-11 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: clang-tidy/misc/UnusedParametersCheck.cpp:25 @@ +24,3 @@ +template +static CharSourceRange removeNode(const MatchFinder::MatchResult &Result, + const T *PrevNode, const T *Node, aaron.ball

[clang-tools-extra] r252773 - Fix bug in suggested fix that truncated variable names to 1 character.

2015-11-11 Thread Samuel Benzaquen via cfe-commits
Author: sbenza Date: Wed Nov 11 12:40:36 2015 New Revision: 252773 URL: http://llvm.org/viewvc/llvm-project?rev=252773&view=rev Log: Fix bug in suggested fix that truncated variable names to 1 character. Summary: Fix bug in suggested fix that truncated variable names to 1 character. Also, rework

Re: [PATCH] D13899: Fix bug in suggested fix that truncated variable names to 1 character.

2015-11-11 Thread Samuel Benzaquen via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL252773: Fix bug in suggested fix that truncated variable names to 1 character. (authored by sbenza). Changed prior to commit: http://reviews.llvm.org/D13899?vs=37885&id=39944#toc Repository: rL LLVM

Re: [PATCH] D22220: [clang-tidy] Add check 'misc-move-forwarding-reference'

2016-07-25 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: clang-tidy/misc/MoveForwardingReferenceCheck.cpp:20 @@ +19,3 @@ + +static void ReplaceMoveWithForward(const UnresolvedLookupExpr *Callee, + const TemplateTypeParmType *TypeParmType, aaron.

Re: [PATCH] Add support for the 'unless' matcher in the dynamic layer.

2016-07-26 Thread Samuel Benzaquen via cfe-commits
One of the reasons we added the minimum was because these nodes added overhead to the matching that was not unnecessary when they only had a single node. On the current implementation we could actually get rid of the node completely for the one argument calls. I would be ok with removing the lower

Re: [PATCH] D22220: [clang-tidy] Add check 'misc-move-forwarding-reference'

2016-07-28 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: clang-tidy/misc/MoveForwardingReferenceCheck.cpp:93 @@ +92,3 @@ + hasArgument(0, ignoringParenImpCasts(declRefExpr( + to(ForwardingReferenceParmMatcher) + .bind("call-move"),

Re: [PATCH] D22220: [clang-tidy] Add check 'misc-move-forwarding-reference'

2016-08-10 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: clang-tidy/misc/MoveForwardingReferenceCheck.cpp:64 @@ +63,3 @@ +void MoveForwardingReferenceCheck::registerMatchers(MatchFinder *Finder) { + if (!getLangOpts().CPlusPlus11) +return; I'm guessing this is checking Lang

Re: [PATCH] D16152: [clang-tidy] Add check performance-faster-string-find

2016-02-03 Thread Samuel Benzaquen via cfe-commits
sbenza updated this revision to Diff 46796. sbenza added a comment. Added comment about StringLikeClasses http://reviews.llvm.org/D16152 Files: clang-tidy/performance/CMakeLists.txt clang-tidy/performance/FasterStringFindCheck.cpp clang-tidy/performance/FasterStringFindCheck.h clang-tid

Re: [PATCH] D16152: [clang-tidy] Add check performance-faster-string-find

2016-02-03 Thread Samuel Benzaquen via cfe-commits
sbenza updated this revision to Diff 46798. sbenza added a comment. Make the delimiter a constant and fix mismatch between parse/serialize of the option. http://reviews.llvm.org/D16152 Files: clang-tidy/performance/CMakeLists.txt clang-tidy/performance/FasterStringFindCheck.cpp clang-tid

r259898 - [ASTMatchers] Allow hasName() to look through inline namespaces

2016-02-05 Thread Samuel Benzaquen via cfe-commits
Author: sbenza Date: Fri Feb 5 12:29:24 2016 New Revision: 259898 URL: http://llvm.org/viewvc/llvm-project?rev=259898&view=rev Log: [ASTMatchers] Allow hasName() to look through inline namespaces Summary: Allow hasName() to look through inline namespaces. This will fix the interaction between so

Re: [PATCH] D15506: [ASTMatchers] Allow hasName() to look through inline namespaces

2016-02-05 Thread Samuel Benzaquen via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL259898: [ASTMatchers] Allow hasName() to look through inline namespaces (authored by sbenza). Changed prior to commit: http://reviews.llvm.org/D15506?vs=45438&id=47029#toc Repository: rL LLVM http:/

Re: [clang-tools-extra] r260217 - [clang-tidy] Make readability-container-size-empty work with inline namespaces. Fix PR25812.

2016-02-09 Thread Samuel Benzaquen via cfe-commits
Now that I submitted the fix to hasName(), I'll work on adding hasAnyName. On Tue, Feb 9, 2016 at 6:54 AM, Alexander Kornienko wrote: > I think, we need to add a `hasAnyName()` matcher that would take a list of > names. > > On Tue, Feb 9, 2016 at 11:20 AM, Gabor Horvath via cfe-commits < > cfe-c

Re: [PATCH] D17034: Add an AST matcher for null pointers

2016-02-09 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: include/clang/ASTMatchers/ASTMatchers.h:4821 @@ +4820,3 @@ +/// initializer for i. +AST_MATCHER(Expr, nullPointerConstant) { + return Matcher( Use AST_MATCHER_FUNCTION instead, where the return value is the matcher (in

Re: [PATCH] D17034: Add an AST matcher for null pointers

2016-02-09 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: include/clang/ASTMatchers/ASTMatchers.h:4821 @@ +4820,3 @@ +/// initializer for i. +AST_MATCHER(Expr, nullPointerConstant) { + return Matcher( aaron.ballman wrote: > aaron.ballman wrote: > > sbenza wrote: > > > sbenza w

[PATCH] D17163: [ASTMatchers] Add matcher hasAnyName.

2016-02-11 Thread Samuel Benzaquen via cfe-commits
sbenza created this revision. sbenza added a reviewer: alexfh. sbenza added a subscriber: cfe-commits. Herald added a subscriber: klimek. Add matcher hasAnyName as an optimization over anyOf(hasName(),...) http://reviews.llvm.org/D17163 Files: docs/LibASTMatchersReference.html docs/tools/dum

Re: [PATCH] D16152: [clang-tidy] Add check performance-faster-string-find

2016-02-12 Thread Samuel Benzaquen via cfe-commits
sbenza added a comment. Friendly ping. http://reviews.llvm.org/D16152 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Re: [PATCH] D17163: [ASTMatchers] Add matcher hasAnyName.

2016-02-12 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: include/clang/ASTMatchers/ASTMatchersInternal.h:644 @@ -643,2 +643,3 @@ explicit HasNameMatcher(StringRef Name); + explicit HasNameMatcher(ArrayRef Names); alexfh wrote: > bkramer wrote: > > alexfh wrote: > > > Why n

Re: [PATCH] D17163: [ASTMatchers] Add matcher hasAnyName.

2016-02-12 Thread Samuel Benzaquen via cfe-commits
sbenza updated this revision to Diff 47802. sbenza marked 2 inline comments as done. sbenza added a comment. Minor fixes: - Add argument comments - Move vector contructor to callers to simply API of HasNameMatcher http://reviews.llvm.org/D17163 Files: docs/LibASTMatchersReference.html docs

Re: [PATCH] D16152: [clang-tidy] Add check performance-faster-string-find

2016-02-12 Thread Samuel Benzaquen via cfe-commits
sbenza updated this revision to Diff 47808. sbenza marked an inline comment as done. sbenza added a comment. Minor fix on comment http://reviews.llvm.org/D16152 Files: clang-tidy/performance/CMakeLists.txt clang-tidy/performance/FasterStringFindCheck.cpp clang-tidy/performance/FasterStrin

[clang-tools-extra] r260712 - [clang-tidy] Add check performance-faster-string-find

2016-02-12 Thread Samuel Benzaquen via cfe-commits
Author: sbenza Date: Fri Feb 12 13:28:14 2016 New Revision: 260712 URL: http://llvm.org/viewvc/llvm-project?rev=260712&view=rev Log: [clang-tidy] Add check performance-faster-string-find Summary: Add check performance-faster-string-find. It replaces single character string literals to character l

Re: [PATCH] D16152: [clang-tidy] Add check performance-faster-string-find

2016-02-12 Thread Samuel Benzaquen via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL260712: [clang-tidy] Add check performance-faster-string-find (authored by sbenza). Changed prior to commit: http://reviews.llvm.org/D16152?vs=47808&id=47825#toc Repository: rL LLVM http://reviews.l

Re: [PATCH] D17034: Add an AST matcher for null pointers

2016-02-16 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: include/clang/ASTMatchers/ASTMatchers.h:4838 @@ +4837,3 @@ + gnuNullExpr(), cxxNullPtrLiteralExpr(), + expr(integerLiteral(equals(0), hasParent(expr(hasType(pointerType())); +} is this expr() necessary? ht

Re: [PATCH] D17034: Add an AST matcher for null pointers

2016-02-16 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: include/clang/ASTMatchers/ASTMatchers.h:4838 @@ +4837,3 @@ + gnuNullExpr(), cxxNullPtrLiteralExpr(), + expr(integerLiteral(equals(0), hasParent(expr(hasType(pointerType())); +} aaron.ballman wrote: > sbenza

[clang-tools-extra] r261102 - [clang-tidy] Match the type against the get() method we are calling,

2016-02-17 Thread Samuel Benzaquen via cfe-commits
Author: sbenza Date: Wed Feb 17 10:13:14 2016 New Revision: 261102 URL: http://llvm.org/viewvc/llvm-project?rev=261102&view=rev Log: [clang-tidy] Match the type against the get() method we are calling, instead of a get() method we find in the class. The duck typed smart pointer class could have o

Re: [PATCH] D17447: Add check for CERT ENV33-C

2016-02-19 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: clang-tidy/cert/CommandProcessorCheck.cpp:22 @@ +21,3 @@ + Finder->addMatcher( + callExpr(callee(functionDecl(anyOf(hasName("system"), hasName("popen"), + hasName("_popen"))) S

Re: [PATCH] D17447: Add check for CERT ENV33-C

2016-02-19 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: clang-tidy/cert/CommandProcessorCheck.cpp:36 @@ +35,3 @@ + // is not a security risk by itself. + if (Fn->getName() == "system" && E->getNumArgs() == 1 && + E->getArg(0)->isNullPointerConstant(*Result.Context, You c

Re: [PATCH] D17163: [ASTMatchers] Add matcher hasAnyName.

2016-02-22 Thread Samuel Benzaquen via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL261574: [ASTMatchers] Add matcher hasAnyName. (authored by sbenza). Changed prior to commit: http://reviews.llvm.org/D17163?vs=47802&id=48720#toc Repository: rL LLVM http://reviews.llvm.org/D17163

r261574 - [ASTMatchers] Add matcher hasAnyName.

2016-02-22 Thread Samuel Benzaquen via cfe-commits
Author: sbenza Date: Mon Feb 22 15:13:02 2016 New Revision: 261574 URL: http://llvm.org/viewvc/llvm-project?rev=261574&view=rev Log: [ASTMatchers] Add matcher hasAnyName. Summary: Add matcher hasAnyName as an optimization over anyOf(hasName(),...) Reviewers: alexfh Subscribers: klimek, cfe-comm

Re: r261574 - [ASTMatchers] Add matcher hasAnyName.

2016-02-22 Thread Samuel Benzaquen via cfe-commits
On Mon, Feb 22, 2016 at 4:19 PM, Aaron Ballman wrote: > On Mon, Feb 22, 2016 at 4:13 PM, Samuel Benzaquen via cfe-commits > wrote: > > Author: sbenza > > Date: Mon Feb 22 15:13:02 2016 > > New Revision: 261574 > > > > URL: http://llvm.org/viewvc/llvm

Re: r261574 - [ASTMatchers] Add matcher hasAnyName.

2016-02-22 Thread Samuel Benzaquen via cfe-commits
On Mon, Feb 22, 2016 at 4:44 PM, Aaron Ballman wrote: > On Mon, Feb 22, 2016 at 4:43 PM, Samuel Benzaquen > wrote: > > > > On Mon, Feb 22, 2016 at 4:19 PM, Aaron Ballman > > wrote: > >> > >> On Mon, Feb 22, 2016 at 4:13 PM, Samuel Benzaquen via cfe-

Re: r261574 - [ASTMatchers] Add matcher hasAnyName.

2016-02-22 Thread Samuel Benzaquen via cfe-commits
On Mon, Feb 22, 2016 at 5:27 PM, Hans Wennborg wrote: > On Mon, Feb 22, 2016 at 1:13 PM, Samuel Benzaquen via cfe-commits > wrote: > > Author: sbenza > > Date: Mon Feb 22 15:13:02 2016 > > New Revision: 261574 > > > > URL: http://llvm.org/viewvc/llvm

Re: [PATCH] D17575: Determine if there's a getDecl member function using less hacks

2016-02-24 Thread Samuel Benzaquen via cfe-commits
sbenza added a comment. I assume you checked that the new trait works on MSVC. Aren't both the same type of expression SFINAE? Is somehow one supported but not the other? http://reviews.llvm.org/D17575 ___ cfe-commits mailing list cfe-commits@lists

Re: [PATCH] D18265: [clang-tidy] New: checker misc-unconventional-assign-operator replacing misc-assign-operator-signature

2016-04-27 Thread Samuel Benzaquen via cfe-commits
sbenza accepted this revision. Comment at: clang-tidy/misc/UnconventionalAssignOperatorCheck.cpp:69 @@ +68,3 @@ +void UnconventionalAssignOperatorCheck::check(const MatchFinder::MatchResult &Result) { + if (const auto *RetStmt = Result.Nodes.getNodeAs("returnStmt")) { +diag(

Re: [PATCH] D19871: Add an AST matcher for CastExpr kind

2016-05-03 Thread Samuel Benzaquen via cfe-commits
sbenza added a comment. In http://reviews.llvm.org/D19871#419985, @aaron.ballman wrote: > In http://reviews.llvm.org/D19871#419954, @etienneb wrote: > > > In http://reviews.llvm.org/D19871#419947, @aaron.ballman wrote: > > > > > Is this required for some purpose? > > > > > > It's used in clang-ti

Re: [PATCH] D19871: Add an AST matcher for CastExpr kind

2016-05-03 Thread Samuel Benzaquen via cfe-commits
sbenza added a comment. > > So even if the above solution is working, we still need to call it that way > > (as a string): > > > clang-query> match castExpr(hasCastKind("CK_Dependent")) > > > Correct, that's expected behavior for clang-query (though I would love if > someday we could

[PATCH] D19877: [clang-tidy] Speedup misc-static-assert.

2016-05-03 Thread Samuel Benzaquen via cfe-commits
sbenza created this revision. sbenza added a reviewer: alexfh. sbenza added a subscriber: cfe-commits. Speedup the misc-static-assert check by not use `stmt()` as the toplevel matcher. The framework runs a filter on the matchers before trying them on each node and uses the toplevel type for this.

[clang-tools-extra] r268430 - [clang-tidy] Speedup misc-static-assert.

2016-05-03 Thread Samuel Benzaquen via cfe-commits
Author: sbenza Date: Tue May 3 15:11:09 2016 New Revision: 268430 URL: http://llvm.org/viewvc/llvm-project?rev=268430&view=rev Log: [clang-tidy] Speedup misc-static-assert. Summary: Speedup the misc-static-assert check by not use `stmt()` as the toplevel matcher. The framework runs a filter on

Re: [PATCH] D19877: [clang-tidy] Speedup misc-static-assert.

2016-05-03 Thread Samuel Benzaquen via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL268430: [clang-tidy] Speedup misc-static-assert. (authored by sbenza). Changed prior to commit: http://reviews.llvm.org/D19877?vs=56028&id=56053#toc Repository: rL LLVM http://reviews.llvm.org/D1987

r268548 - Fix the doc extraction script to work with hasAnyName and with equalsNode.

2016-05-04 Thread Samuel Benzaquen via cfe-commits
Author: sbenza Date: Wed May 4 15:45:00 2016 New Revision: 268548 URL: http://llvm.org/viewvc/llvm-project?rev=268548&view=rev Log: Fix the doc extraction script to work with hasAnyName and with equalsNode. The change from llvm::VariadicFunction to internal::VariadicFunction broke the extraction

Re: [PATCH] D19871: Add an AST matcher for CastExpr kind

2016-05-05 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: lib/ASTMatchers/Dynamic/Marshallers.h:102 @@ +101,3 @@ + static clang::CastKind getCastKind(llvm::StringRef AttrKind) { +return llvm::StringSwitch(AttrKind) + .Case("CK_Dependent", CK_Dependent) etienneb wrote: >

Re: [PATCH] D19871: Add an AST matcher for CastExpr kind

2016-05-10 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: lib/ASTMatchers/Dynamic/Registry.cpp:78 @@ -77,2 +77,3 @@ // Need Variant/Parser fixes: + // hasCastKind // ofKind Is it registered or not? You add this comment, but also add the matcher in the registry below. h

Re: [PATCH] D20277: [clang-tidy] UnnecessaryValueParamCheck - suggest std::move() if non-const value parameter can be moved.

2016-05-16 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: clang-tidy/performance/UnnecessaryValueParamCheck.cpp:83 @@ +82,3 @@ + if (!IsConstQualified) { +auto Matches = utils::decl_ref_expr::allDeclRefExprs( +*Param, *Function->getBody(), *Result.Context); We should

Re: [PATCH] D18475: [clang-tidy] Add more detection rules for redundant c_str calls.

2016-03-29 Thread Samuel Benzaquen via cfe-commits
sbenza added a comment. In http://reviews.llvm.org/D18475#385789, @alexfh wrote: > Looks good to me. Adding Samuel, since he has done a lot of similar stuff by > now and might have good ideas on improving this and making this more general. There are two things I've done before that might apply

[clang-tools-extra] r264759 - [clang-tidy] Add check to detect dangling references in value handlers.

2016-03-29 Thread Samuel Benzaquen via cfe-commits
Author: sbenza Date: Tue Mar 29 13:02:26 2016 New Revision: 264759 URL: http://llvm.org/viewvc/llvm-project?rev=264759&view=rev Log: [clang-tidy] Add check to detect dangling references in value handlers. Summary: Add check misc-dangling-handle to detect dangling references in value handlers like

Re: [PATCH] D17811: [clang-tidy] Add check to detect dangling references in value handlers.

2016-03-29 Thread Samuel Benzaquen via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL264759: [clang-tidy] Add check to detect dangling references in value handlers. (authored by sbenza). Changed prior to commit: http://reviews.llvm.org/D17811?vs=51684&id=51956#toc Repository: rL LLVM

Re: [PATCH] D17811: [clang-tidy] Add check to detect dangling references in value handlers.

2016-03-30 Thread Samuel Benzaquen via cfe-commits
This is already being done in http://reviews.llvm.org/D18582 On Wed, Mar 30, 2016 at 12:44 PM, Richard wrote: > LegalizeAdulthood added a subscriber: LegalizeAdulthood. > LegalizeAdulthood added a comment. > > Can you add a synopsis of this new check to `docs/ReleaseNotes.rst` please? > > > Repo

Re: r264428 - [ASTMatchers] Fix build for VariadicFunction.

2016-03-31 Thread Samuel Benzaquen via cfe-commits
t;> >> On Fri, Mar 25, 2016 at 10:46 AM, Samuel Benzaquen via cfe-commits < >> cfe-commits@lists.llvm.org> wrote: >> >>> Author: sbenza >>> Date: Fri Mar 25 12:46:02 2016 >>> New Revision: 264428 >>> >>> URL: http://llvm.org/view

Re: r264428 - [ASTMatchers] Fix build for VariadicFunction.

2016-03-31 Thread Samuel Benzaquen via cfe-commits
to the function pointer template >> parameter. >> gcc doesn't want to do the implicit conversion from X to A, but if I make >> the conversion explicit it works. >> >> >> On Fri, Mar 25, 2016 at 1:58 PM, Alexey Samsonov >> wrote: >> >>>

Re: [PATCH] D18265: [clang-tidy] New: checker misc-assign-operator-return

2016-04-01 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: clang-tidy/misc/AssignOperatorCheck.cpp:63 @@ +62,3 @@ + + Finder->addMatcher(returnStmt(IsBadReturnStatement, hasAncestor(IsGoodAssign)) + .bind("returnStmt"), I dislike these uses of hasAnscesto

Re: [PATCH] D18191: [clang-tidy] Add check for function parameters that are const& to builtin types

2016-04-04 Thread Samuel Benzaquen via cfe-commits
sbenza added a comment. As Alex mentioned, we have a test like this. It also adds a hardcoded list of user-defined types that are known to be better when passed by value (eg. StringRef) One big difference is that we decided to not trigger on typedefs. We can't know that the typedef is documented

Re: [PATCH] D18191: [clang-tidy] Add check for function parameters that are const& to builtin types

2016-04-04 Thread Samuel Benzaquen via cfe-commits
sbenza added a comment. In http://reviews.llvm.org/D18191#391168, @sdowney wrote: > At least in my codebase, skipping templates is too strong. I run across ones > where the const& parameter is not one controlled by a template. It's often a > size_t. The only check we are doing (other than mat

[PATCH] D18766: [clang-tidy] Add check misc-multiple-statement-macro

2016-04-04 Thread Samuel Benzaquen via cfe-commits
sbenza created this revision. sbenza added a reviewer: alexfh. sbenza added a subscriber: cfe-commits. The check detects multi-statement macros that are used in unbraced conditionals. Only the first statement will be part of the conditionals and the rest will fall outside of it and executed uncond

Re: [PATCH] D18766: [clang-tidy] Add check misc-multiple-statement-macro

2016-04-04 Thread Samuel Benzaquen via cfe-commits
sbenza updated this revision to Diff 52625. sbenza marked an inline comment as done. sbenza added a comment. Minor fixes http://reviews.llvm.org/D18766 Files: clang-tidy/misc/CMakeLists.txt clang-tidy/misc/MiscTidyModule.cpp clang-tidy/misc/MultipleStatementMacroCheck.cpp clang-tidy/mis

Re: [PATCH] D18766: [clang-tidy] Add check misc-multiple-statement-macro

2016-04-04 Thread Samuel Benzaquen via cfe-commits
sbenza marked an inline comment as done and an inline comment as not done. Comment at: clang-tidy/misc/MultipleStatementMacroCheck.cpp:33 @@ +32,3 @@ + +namespace { + etienneb wrote: > I feel it nicer if you merge this namespace with the one at line 20. I like to

Re: [PATCH] D18265: [clang-tidy] New: checker misc-assign-operator-return

2016-04-05 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: clang-tidy/misc/AssignOperatorCheck.cpp:63 @@ +62,3 @@ + + Finder->addMatcher(returnStmt(IsBadReturnStatement, hasAncestor(IsGoodAssign)) + .bind("returnStmt"), baloghadamsoftware wrote: > sbenza

Re: [PATCH] D18766: [clang-tidy] Add check misc-multiple-statement-macro

2016-04-05 Thread Samuel Benzaquen via cfe-commits
sbenza updated this revision to Diff 52702. sbenza marked 2 inline comments as done and an inline comment as not done. sbenza added a comment. Minor fixes http://reviews.llvm.org/D18766 Files: clang-tidy/misc/CMakeLists.txt clang-tidy/misc/MiscTidyModule.cpp clang-tidy/misc/MultipleStatem

Re: [PATCH] D18766: [clang-tidy] Add check misc-multiple-statement-macro

2016-04-05 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: docs/clang-tidy/checks/misc-multiple-statement-macro.rst:15 @@ +14,3 @@ + if (do_increment) +INCREMENT_TWO(a, b); + hokein wrote: > Would be better to add a comment to explain the sample. The sentence just before the

Re: [PATCH] D18265: [clang-tidy] New: checker misc-assign-operator-return

2016-04-07 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: clang-tidy/misc/AssignOperatorCheck.cpp:63 @@ +62,3 @@ + + Finder->addMatcher(returnStmt(IsBadReturnStatement, hasAncestor(IsGoodAssign)) + .bind("returnStmt"), baloghadamsoftware wrote: > sbenza

Re: [PATCH] D18914: [clang-tidy] new readability-redundant-inline

2016-04-11 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: clang-tidy/readability/RedundantInlineCheck.cpp:59 @@ +58,3 @@ + while (!RawLexer.LexFromRawLexer(Tok)) { +if (Tok.is(tok::semi) || Tok.is(tok::l_brace)) + break; Parsing C++ is hard. Stopping at the first `{` me

Re: [PATCH] D18914: [clang-tidy] new readability-redundant-inline

2016-04-12 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: clang-tidy/readability/RedundantInlineCheck.cpp:68 @@ +67,3 @@ + } + llvm_unreachable("InlineTok() did not encounter the 'inline' token"); +} This is still reachable. The token might be hidden through macros, for example

Re: [PATCH] D18766: [clang-tidy] Add check misc-multiple-statement-macro

2016-04-12 Thread Samuel Benzaquen via cfe-commits
sbenza updated this revision to Diff 53398. sbenza marked an inline comment as done. sbenza added a comment. Change warning message. http://reviews.llvm.org/D18766 Files: clang-tidy/misc/CMakeLists.txt clang-tidy/misc/MiscTidyModule.cpp clang-tidy/misc/MultipleStatementMacroCheck.cpp cl

Re: [PATCH] D18766: [clang-tidy] Add check misc-multiple-statement-macro

2016-04-12 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: clang-tidy/misc/MultipleStatementMacroCheck.cpp:99 @@ +98,3 @@ + + diag(InnerRanges.back().first, "multiple statement macro spans unbraced " + "conditional and the following statement"); al

Re: [PATCH] D19059: Reorder ASTNodeKind::AllKindInfo to match NodeKindId.

2016-04-13 Thread Samuel Benzaquen via cfe-commits
sbenza added a comment. Those tests are testing the code completion you get in clang-query. The type list must match what that matcher supports. `hasParent` is declared as const internal::ArgumentAdaptingMatcherFunc< internal::HasParentMatcher, internal::TypeList, internal::T

Re: [PATCH] D18265: [clang-tidy] New: checker misc-assign-operator-return

2016-04-13 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: clang-tidy/misc/AssignOperatorCheck.cpp:63 @@ +62,3 @@ + + Finder->addMatcher(returnStmt(IsBadReturnStatement, hasAncestor(IsGoodAssign)) + .bind("returnStmt"), baloghadamsoftware wrote: > sbenza

[clang-tools-extra] r266369 - [clang-tidy] Add check misc-multiple-statement-macro

2016-04-14 Thread Samuel Benzaquen via cfe-commits
Author: sbenza Date: Thu Apr 14 16:15:57 2016 New Revision: 266369 URL: http://llvm.org/viewvc/llvm-project?rev=266369&view=rev Log: [clang-tidy] Add check misc-multiple-statement-macro Summary: The check detects multi-statement macros that are used in unbraced conditionals. Only the first statem

  1   2   >