[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

[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(); ---

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] 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] 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-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.

[PATCH] D21815: [clang-tidy] Add 'included from' details to warning message.

2016-06-28 Thread Samuel Benzaquen via cfe-commits
sbenza created this revision. sbenza added a reviewer: alexfh. sbenza added a subscriber: cfe-commits. Add 'included from' details to warning message to google-global-names-in-headers. It should make it clearer on those cases where a non-header is being mistakenly #included. http://reviews.llvm

[clang-tools-extra] r274019 - [clang-tidy] Do not match on lambdas.

2016-06-28 Thread Samuel Benzaquen via cfe-commits
Author: sbenza Date: Tue Jun 28 09:19:41 2016 New Revision: 274019 URL: http://llvm.org/viewvc/llvm-project?rev=274019&view=rev Log: [clang-tidy] Do not match on lambdas. We match on the generated FunctionDecl of the lambda and try to fix it. This causes a crash. The right behavior is to ignore l

r274015 - [ASTMatchers] Add isLambda() matcher.

2016-06-28 Thread Samuel Benzaquen via cfe-commits
Author: sbenza Date: Tue Jun 28 09:08:56 2016 New Revision: 274015 URL: http://llvm.org/viewvc/llvm-project?rev=274015&view=rev Log: [ASTMatchers] Add isLambda() matcher. Modified: cfe/trunk/docs/LibASTMatchersReference.html cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h cfe/trunk/

Re: [PATCH] D20964: [clang-tidy] Add modernize-use-emplace

2016-06-21 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: clang-tools-extra/trunk/clang-tidy/modernize/UseEmplaceCheck.cpp:34 @@ +33,3 @@ + hasDeclaration(functionDecl(hasName("push_back"))), + on(hasType(cxxRecordDecl(hasAnyName("std::vector", "llvm::SmallVector", +

Re: [PATCH] D21185: [clang-tidy] Add performance-emplace-into-containers

2016-06-17 Thread Samuel Benzaquen via cfe-commits
sbenza added a comment. Missing the .rst file. Did you use the check_clang_tidy.py script to create the template? Comment at: clang-tidy/performance/EmplaceCheck.cpp:25 @@ +24,3 @@ + cxxMemberCallExpr( + on(expr(hasType(cxxRecordDecl(hasName("std::vector"), +

Re: [PATCH] D21036: Misplaced const-qualification with typedef types

2016-06-07 Thread Samuel Benzaquen via cfe-commits
sbenza accepted this revision. This revision is now accepted and ready to land. Comment at: clang-tidy/misc/MisplacedConstCheck.cpp:22 @@ +21,3 @@ + Finder->addMatcher( + valueDecl(allOf(hasType(isConstQualified()), + hasType(typedefType(hasDeclaration(

Re: [PATCH] D21036: Misplaced const-qualification with typedef types

2016-06-07 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: clang-tidy/misc/MisplacedConstCheck.cpp:22 @@ +21,3 @@ + Finder->addMatcher( + valueDecl(allOf(hasType(isConstQualified()), + hasType(typedefType(hasDeclaration( allOf() is unnecessary =

Re: [PATCH] D21036: Misplaced const-qualification with typedef types

2016-06-07 Thread Samuel Benzaquen via cfe-commits
sbenza added a comment. In http://reviews.llvm.org/D21036#450935, @aaron.ballman wrote: > In http://reviews.llvm.org/D21036#450106, @sbenza wrote: > > > I think this would be more interesting with macros. > > Eg triggering in code like this: > > > > #define FOO(type, op) const type& X = op() >

Re: [PATCH] D21036: Misplaced const-qualification with typedef types

2016-06-06 Thread Samuel Benzaquen via cfe-commits
sbenza added a comment. I think this would be more interesting with macros. Eg triggering in code like this: #define FOO(type, op) const type& X = op() FOO(int*, bar); Comment at: clang-tidy/misc/MisplacedConstCheck.cpp:32 @@ +31,3 @@ + +static QualType GuessAlternateQualif

[clang-tools-extra] r271896 - [clang-tidy] Do not try to suggest a fix if the parameter is partially in a macro.

2016-06-06 Thread Samuel Benzaquen via cfe-commits
Author: sbenza Date: Mon Jun 6 09:21:11 2016 New Revision: 271896 URL: http://llvm.org/viewvc/llvm-project?rev=271896&view=rev Log: [clang-tidy] Do not try to suggest a fix if the parameter is partially in a macro. It is not easy to tell where to do the suggestion and whether the suggestion wil

Re: [PATCH] D20917: [clang-tidy] Add RemoveStars option to the modernize-use-auto check

2016-06-02 Thread Samuel Benzaquen via cfe-commits
sbenza added a comment. Is it a typo in the description when it says that when RemoveStar is on we will write 'auto*' instead if 'auto'? http://reviews.llvm.org/D20917 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cg

[clang-tools-extra] r271426 - Fix uninitialized memory access when the token 'const' is not present in

2016-06-01 Thread Samuel Benzaquen via cfe-commits
Author: sbenza Date: Wed Jun 1 15:37:23 2016 New Revision: 271426 URL: http://llvm.org/viewvc/llvm-project?rev=271426&view=rev Log: Fix uninitialized memory access when the token 'const' is not present in the program. If the token is not there, we still warn but we don't try to give a fixit hint

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

2016-05-31 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: clang-tidy/performance/UnnecessaryValueParamCheck.cpp:34 @@ -29,1 +33,3 @@ +template bool isSetDifferenceEmpty(const S &S1, const S &S2) { + for (const auto &E : S1) isSubset? Comment at: clang-tidy/u

Re: [PATCH] D20597: Speed up check by using a recursive visitor.

2016-05-25 Thread Samuel Benzaquen via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL270714: Speed up check by using a recursive visitor. (authored by sbenza). Changed prior to commit: http://reviews.llvm.org/D20597?vs=58438&id=58440#toc Repository: rL LLVM http://reviews.llvm.org/D

[clang-tools-extra] r270714 - Speed up check by using a recursive visitor.

2016-05-25 Thread Samuel Benzaquen via cfe-commits
Author: sbenza Date: Wed May 25 11:19:23 2016 New Revision: 270714 URL: http://llvm.org/viewvc/llvm-project?rev=270714&view=rev Log: Speed up check by using a recursive visitor. Summary: Use a recursive visitor instead of forEachDescendant() matcher. The latter requires several layers of virtual

Re: [PATCH] D20597: Speed up check by using a recursive visitor.

2016-05-25 Thread Samuel Benzaquen via cfe-commits
sbenza updated this revision to Diff 58438. sbenza marked an inline comment as done. sbenza added a comment. Reformat code http://reviews.llvm.org/D20597 Files: clang-tidy/readability/FunctionSizeCheck.cpp clang-tidy/readability/FunctionSizeCheck.h Index: clang-tidy/readability/FunctionSiz

[PATCH] D20597: Speed up check by using a recursive visitor.

2016-05-24 Thread Samuel Benzaquen via cfe-commits
sbenza created this revision. sbenza added a reviewer: alexfh. sbenza added a subscriber: cfe-commits. Use a recursive visitor instead of forEachDescendant() matcher. The latter requires several layers of virtual function calls for each node and it is more expensive than the visitor. Benchmark res

Re: [PATCH] D19324: [ASTMatchers] new forEachOverriden matcher

2016-05-23 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: include/clang/AST/ASTContext.h:824 @@ -823,1 +823,3 @@ unsigned overridden_methods_size(const CXXMethodDecl *Method) const; + typedef llvm::iterator_range + overridden_method_range; Sure. Sorry about that. The mai

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] 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] 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: >

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] 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

[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

[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.

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

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] 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] D19324: [ASTMatchers] new forEachOverriden matcher

2016-04-26 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: include/clang/AST/DeclCXX.h:1830 @@ -1829,2 +1829,3 @@ unsigned size_overridden_methods() const; + const ArrayRef overridden_methods() const; Return type should have have toplevel `const`. Comment a

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

2016-04-26 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. 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(R

Re: [PATCH] D19324: [ASTMatchers] new forEachOverriden matcher

2016-04-21 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: lib/AST/ASTContext.cpp:1279 @@ -1282,1 +1278,3 @@ +const ASTContext::CXXMethodVector * +ASTContext::overridden_methods(const CXXMethodDecl *Method) const { llvm::DenseMap::const_iterator Pos It would be simpler to retur

Re: [PATCH] D19357: [ASTMatchers] New matcher forFunction

2016-04-21 Thread Samuel Benzaquen via cfe-commits
sbenza added a comment. Thanks for doing this! I think we want the version that iterates all parents. Otherwise it will have problems with templates. That is, you won't know which `FunctionDecl` you will get: the template or the instantiation. And you might need one or the other specifically.

Re: [PATCH] D19144: Handle TemplateArgument in DynTypedNode comparison operations.

2016-04-19 Thread Samuel Benzaquen via cfe-commits
sbenza added a comment. > > We can proceed with this change if you want, but it is not required > > anymore. I don't know whether we need the extra complexity of > > `TemplateArgumentLess`. > > > If this patch is not going to help with performance, I'm happy to abandon it. It might help i

Re: [PATCH] D19231: [ASTMatchers] Do not try to memoize nodes we can't compare.

2016-04-19 Thread Samuel Benzaquen via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL266748: [ASTMatchers] Do not try to memoize nodes we can't compare. (authored by sbenza). Changed prior to commit: http://reviews.llvm.org/D19231?vs=54089&id=54207#toc Repository: rL LLVM http://rev

r266748 - [ASTMatchers] Do not try to memoize nodes we can't compare.

2016-04-19 Thread Samuel Benzaquen via cfe-commits
Author: sbenza Date: Tue Apr 19 10:52:56 2016 New Revision: 266748 URL: http://llvm.org/viewvc/llvm-project?rev=266748&view=rev Log: [ASTMatchers] Do not try to memoize nodes we can't compare. Summary: Prevent hasAncestor from comparing nodes that are not supported. hasDescendant was fixed some t

Re: [PATCH] D19144: Handle TemplateArgument in DynTypedNode comparison operations.

2016-04-18 Thread Samuel Benzaquen via cfe-commits
sbenza added a comment. Sent http://reviews.llvm.org/D19231 to fix the underlying bug in `hasAncestor`. We can proceed with this change if you want, but it is not required anymore. I don't know whether we need the extra complexity of `TemplateArgumentLess`. http://reviews.llvm.org/D19144 ___

[PATCH] D19231: [ASTMatchers] Do not try to memoize nodes we can't compare.

2016-04-18 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. Prevent hasAncestor from comparing nodes that are not supported. hasDescendant was fixed some time ago to avoid this problem. I'm applying the same fix to hasAn

Re: [PATCH] D19144: Handle TemplateArgument in DynTypedNode comparison operations.

2016-04-15 Thread Samuel Benzaquen via cfe-commits
sbenza added a comment. To be more specific, the problem comes from the use of `hasAnscestor` (done by `isInTemplateInstantiation` ) while there is a `TemplateArgument` in the bound nodes. This tries to put the node into the cache. To trigger this easily you only need to have a hit in the cache.

Re: [PATCH] D19144: Handle TemplateArgument in DynTypedNode comparison operations.

2016-04-15 Thread Samuel Benzaquen via cfe-commits
sbenza added a comment. I think the bug is coming from `memoizedMatchesAncestorOfRecursively`. `memoizedMatchesRecursively` has a special case at the top to skip the cache if the node is not sortable. The other function should do that too. Although the check is stale also because it is only check

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

2016-04-14 Thread Samuel Benzaquen via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL266369: [clang-tidy] Add check misc-multiple-statement-macro (authored by sbenza). Changed prior to commit: http://reviews.llvm.org/D18766?vs=53398&id=53786#toc Repository: rL LLVM http://reviews.ll

[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

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

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] 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] 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] 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] 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] 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] 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] 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] 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-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] 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

[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] 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

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] 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: 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: 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: [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: [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

[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] 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

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

2016-03-28 Thread Samuel Benzaquen via cfe-commits
On Fri, Mar 25, 2016 at 7:01 PM, Richard Smith wrote: > On Fri, Mar 25, 2016 at 10:55 AM, David Blaikie via cfe-commits > wrote: > > > > > > On Fri, Mar 25, 2016 at 10:46 AM, Samuel Benzaquen via cfe-commits > > wrote: > >> > >> Author: sbe

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

2016-03-25 Thread Samuel Benzaquen via cfe-commits
sbenza updated this revision to Diff 51684. sbenza added a comment. Using new public hasAnyName API. http://reviews.llvm.org/D17811 Files: clang-tidy/misc/CMakeLists.txt clang-tidy/misc/DanglingHandleCheck.cpp clang-tidy/misc/DanglingHandleCheck.h clang-tidy/misc/MiscTidyModule.cpp do

Re: r264417 - [ASTMatchers] Add own version of VariadicFunction.

2016-03-25 Thread Samuel Benzaquen via cfe-commits
25, 2016 at 2:18 PM, Mehdi Amini >> wrote: >> >>> Hi, >>> >>> I think this broke clang-tidy somehow: >>> http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/10881/steps/build%20stage%201/logs/stdio >>> >>> -- >>> M

r264453 - [ASTMatchers] Don't use brace-init lists.

2016-03-25 Thread Samuel Benzaquen via cfe-commits
Author: sbenza Date: Fri Mar 25 14:41:32 2016 New Revision: 264453 URL: http://llvm.org/viewvc/llvm-project?rev=264453&view=rev Log: [ASTMatchers] Don't use brace-init lists. They are not supported everywhere yet. This fixes the MSVC build. Modified: cfe/trunk/include/clang/ASTMatchers/ASTMa

Re: r264417 - [ASTMatchers] Add own version of VariadicFunction.

2016-03-25 Thread Samuel Benzaquen via cfe-commits
builds/10881/steps/build%20stage%201/logs/stdio >> >> -- >> Mehdi >> >> >> >> >> > On Mar 25, 2016, at 9:29 AM, Samuel Benzaquen via cfe-commits < >> cfe-commits@lists.llvm.org> wrote: >> > >> > Author: sbenza >> > Date:

Re: r264417 - [ASTMatchers] Add own version of VariadicFunction.

2016-03-25 Thread Samuel Benzaquen via cfe-commits
> > > On Mar 25, 2016, at 9:29 AM, Samuel Benzaquen via cfe-commits < > cfe-commits@lists.llvm.org> wrote: > > > > Author: sbenza > > Date: Fri Mar 25 11:29:30 2016 > > New Revision: 264417 > > > > URL: http://llvm.org/viewvc/llvm-projec

Re: [PATCH] D18275: [ASTMatchers] Add own version of VariadicFunction.

2016-03-25 Thread Samuel Benzaquen via cfe-commits
On Fri, Mar 25, 2016 at 1:55 PM, Etienne Bergeron wrote: > etienneb added a subscriber: etienneb. > etienneb added a comment. > > Any plan for doing the same for : hasOverloadedOperatorName ? > hasAnyName() was added mostly for performance reasons. We could add the 'Any' version of hasOverloaded

r264428 - [ASTMatchers] Fix build for VariadicFunction.

2016-03-25 Thread Samuel Benzaquen via cfe-commits
Author: sbenza Date: Fri Mar 25 12:46:02 2016 New Revision: 264428 URL: http://llvm.org/viewvc/llvm-project?rev=264428&view=rev Log: [ASTMatchers] Fix build for VariadicFunction. Under some conditions the implicit conversion from array to ArrayRef<> is not working. Fix the build by making it expl

Re: [PATCH] D18275: [ASTMatchers] Add own version of VariadicFunction.

2016-03-25 Thread Samuel Benzaquen via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL264417: [ASTMatchers] Add own version of VariadicFunction. (authored by sbenza). Changed prior to commit: http://reviews.llvm.org/D18275?vs=51447&id=51645#toc Repository: rL LLVM http://reviews.llvm

r264417 - [ASTMatchers] Add own version of VariadicFunction.

2016-03-25 Thread Samuel Benzaquen via cfe-commits
Author: sbenza Date: Fri Mar 25 11:29:30 2016 New Revision: 264417 URL: http://llvm.org/viewvc/llvm-project?rev=264417&view=rev Log: [ASTMatchers] Add own version of VariadicFunction. Summary: llvm::VariadicFunction is only being used by ASTMatchers. Having our own copy here allows us to remove t

Re: [PATCH] D18275: [ASTMatchers] Add own version of VariadicFunction.

2016-03-23 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: include/clang/ASTMatchers/ASTMatchersInternal.h:80 @@ +79,3 @@ + ResultT operator()(ArrayRef Args) const { +std::vector InnerArgs; +for (const ArgT &Arg : Args) alexfh wrote: > It's unfortunate that we need to cre

Re: [PATCH] D18275: [ASTMatchers] Add own version of VariadicFunction.

2016-03-23 Thread Samuel Benzaquen via cfe-commits
sbenza updated this revision to Diff 51447. sbenza added a comment. Minor fix http://reviews.llvm.org/D18275 Files: include/clang/ASTMatchers/ASTMatchers.h include/clang/ASTMatchers/ASTMatchersInternal.h lib/ASTMatchers/Dynamic/Marshallers.h unittests/ASTMatchers/ASTMatchersTest.cpp In

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

2016-03-22 Thread Samuel Benzaquen via cfe-commits
sbenza added a comment. In http://reviews.llvm.org/D17811#380124, @jbcoe wrote: > Do you have commit access? I can apply this patch for you if not. I do. I am waiting on http://reviews.llvm.org/D18275 to fix the problem with using internal::HasNameMatcher directly. http://reviews.llvm.org/D1

Re: [PATCH] D17986: [ASTMatchers] New matcher hasReturnValue added

2016-03-21 Thread Samuel Benzaquen via cfe-commits
sbenza added a comment. In http://reviews.llvm.org/D17986#379271, @baloghadamsoftware wrote: > I can rerun the script, however it seems it was not executed before the last > commit on the master branch, thus if I rerun it then changes will appear in > my diff which are not related to my work. W

[clang-tools-extra] r263963 - [clang-tidy] Fix check broken in rL263822.

2016-03-21 Thread Samuel Benzaquen via cfe-commits
Author: sbenza Date: Mon Mar 21 13:00:43 2016 New Revision: 263963 URL: http://llvm.org/viewvc/llvm-project?rev=263963&view=rev Log: [clang-tidy] Fix check broken in rL263822. Add names missing from rL263822 and add tests to prevent future omissions. Modified: clang-tools-extra/trunk/clang-t

Re: [PATCH] D17986: [ASTMatchers] New matcher hasReturnValue added

2016-03-21 Thread Samuel Benzaquen via cfe-commits
sbenza added a comment. Can you rerun the doc script (dump_ast_matchers.py)? http://reviews.llvm.org/D17986 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] r263822 - [clang-tidy] Use hasAnyName() instead of matchesName().

2016-03-19 Thread Samuel Benzaquen via cfe-commits
Author: sbenza Date: Fri Mar 18 15:14:35 2016 New Revision: 263822 URL: http://llvm.org/viewvc/llvm-project?rev=263822&view=rev Log: [clang-tidy] Use hasAnyName() instead of matchesName(). matchesName() uses regular expressions and it is very slow. hasAnyName() gives the same result and it is muc

Re: [PATCH] D18243: [ASTMatchers] Existing matcher hasAnyArgument fixed

2016-03-19 Thread Samuel Benzaquen via cfe-commits
sbenza added a comment. Please add a test for this. http://reviews.llvm.org/D18243 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Re: [PATCH] D17986: [ASTMatchers] New matcher hasReturnValue added

2016-03-19 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: include/clang/ASTMatchers/ASTMatchers.h:4848 @@ +4847,3 @@ +/// \code +/// return a+b; +/// \endcode `a + b` (with spaces) A few in this comment, and one in the test. Comment at: include/clang/ASTMatche

Re: [PATCH] D18275: [ASTMatchers] Add own version of VariadicFunction.

2016-03-18 Thread Samuel Benzaquen via cfe-commits
sbenza added a comment. Alex, this is what we discussed to make `hasAnyName` take a `vector` directly. http://reviews.llvm.org/D18275 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D18275: [ASTMatchers] Add own version of VariadicFunction.

2016-03-18 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. llvm::VariadicFunction is only being used by ASTMatchers. Having own copy here allows us to remove the other one from llvm/ADT. Also, we can extend the API to o

Re: [PATCH] D17986: [ASTMatchers] Existing matcher hasAnyArgument fixed and new matcher hasReturnValue added

2016-03-11 Thread Samuel Benzaquen via cfe-commits
sbenza added a comment. > I will separate it, OK. In the Clang there is one use case that I fixed, > although it did not break the tests. Neither of the other "has..." checkers > (except the general ones) ignore implicit casts and parenthesized expressions > so this one should not do it either

Re: [PATCH] D17986: [ASTMatchers] Existing matcher hasAnyArgument fixed and new matcher hasReturnValue added

2016-03-11 Thread Samuel Benzaquen via cfe-commits
sbenza added a comment. The reason we haven't fixed hasAnyArgument is that it can potentially break its users. I'd prefer if you separated the fix from the addition. That way we can revert the fix if needed. Comment at: include/clang/ASTMatchers/ASTMatchers.h:4796 @@ +4795,3 @@

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

2016-03-07 Thread Samuel Benzaquen via cfe-commits
sbenza updated this revision to Diff 49998. sbenza marked 3 inline comments as done. sbenza added a comment. Minor fixes http://reviews.llvm.org/D17811 Files: clang-tidy/misc/CMakeLists.txt clang-tidy/misc/DanglingHandleCheck.cpp clang-tidy/misc/DanglingHandleCheck.h clang-tidy/misc/Mis

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

2016-03-07 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments. Comment at: clang-tidy/misc/DanglingHandleCheck.cpp:24 @@ +23,3 @@ + +std::vector parseClasses(StringRef Option) { + SmallVector Classes; alexfh wrote: > A very similar code has been added recently to > clang-tidy/utils/HeaderFileEx

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

2016-03-03 Thread Samuel Benzaquen via cfe-commits
sbenza added a comment. In http://reviews.llvm.org/D17811#366482, @Eugene.Zelenko wrote: > Does it make http://reviews.llvm.org/D17772 obsolete? Yes. The other patch has already been abandoned. http://reviews.llvm.org/D17811 ___ cfe-commits maili

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

2016-03-02 Thread Samuel Benzaquen via cfe-commits
sbenza created this revision. sbenza added a reviewer: alexfh. sbenza added a subscriber: cfe-commits. Add check misc-dangling-handle to detect dangling references in value handlers like std::experimental::string_view. It provides a configuration option to specify other handle types that should al

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: 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: 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-

  1   2   >