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
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
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.
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
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
___
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
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
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
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.
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
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
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
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
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
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
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
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
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
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
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
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
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
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()
>
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
=
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(
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"),
+
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",
+
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/
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
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
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
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
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
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
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 @@
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
>
> > 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
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:
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
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
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
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
sbenza added inline comments.
Comment at: unittests/ASTMatchers/ASTMatchersTest.cpp:4994
@@ +4993,3 @@
+ EXPECT_TRUE(matches("typedef int hasUnderlyingTypeTest;",
+ typedefDecl(hasUnderlyingType(asString("int");
+ EXPECT_TRUE(matches("typedef const int T
sbenza created this revision.
sbenza added a reviewer: alexfh.
sbenza added a subscriber: cfe-commits.
Add check performance-faster-string-find.
It replaces single character string literals to character literals in calls to
string::find and friends.
http://reviews.llvm.org/D16152
Files:
clang
sbenza updated this revision to Diff 44886.
sbenza marked 4 inline comments as done.
sbenza added a comment.
Added template and macro tests.
Fixed warning message.
http://reviews.llvm.org/D16152
Files:
clang-tidy/performance/CMakeLists.txt
clang-tidy/performance/FasterStringFindCheck.cpp
sbenza marked an inline comment as done.
Comment at: clang-tidy/performance/FasterStringFindCheck.cpp:51
@@ +50,3 @@
+ const auto StringFindFunctions =
+ anyOf(hasName("find"), hasName("rfind"), hasName("find_first_of"),
+hasName("find_first_not_of"), hasName("fi
sbenza updated this revision to Diff 44889.
sbenza marked 2 inline comments as done.
sbenza added a comment.
Added support for non 'char' chars.
http://reviews.llvm.org/D16152
Files:
clang-tidy/performance/CMakeLists.txt
clang-tidy/performance/FasterStringFindCheck.cpp
clang-tidy/performa
sbenza marked 2 inline comments as done.
sbenza added a comment.
http://reviews.llvm.org/D16152
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
sbenza updated this revision to Diff 44901.
sbenza marked an inline comment as done.
sbenza added a comment.
More checks in argument parsing.
http://reviews.llvm.org/D16152
Files:
clang-tidy/performance/CMakeLists.txt
clang-tidy/performance/FasterStringFindCheck.cpp
clang-tidy/performance
sbenza added inline comments.
Comment at: clang-tidy/performance/FasterStringFindCheck.cpp:29
@@ +28,3 @@
+Class = Class.trim();
+ return std::vector(Classes.begin(), Classes.end());
+}
aaron.ballman wrote:
> I think hasName() will assert if given an empty st
sbenza added inline comments.
Comment at: unittests/ASTMatchers/ASTMatchersTest.cpp:4994
@@ +4993,3 @@
+ EXPECT_TRUE(matches("typedef int hasUnderlyingTypeTest;",
+ typedefDecl(hasUnderlyingType(asString("int");
+ EXPECT_TRUE(matches("typedef const int T
sbenza updated this revision to Diff 45438.
sbenza added a comment.
Rename functions.
http://reviews.llvm.org/D15506
Files:
include/clang/ASTMatchers/ASTMatchersInternal.h
lib/ASTMatchers/ASTMatchersInternal.cpp
unittests/ASTMatchers/ASTMatchersTest.cpp
Index: unittests/ASTMatchers/ASTMa
sbenza added inline comments.
Comment at: lib/ASTMatchers/ASTMatchersInternal.cpp:351
@@ +350,3 @@
+
+ // First, match the name.
+ if (!MatchNodeName(Pattern, Node))
klimek wrote:
> Perhaps comment that Pattern will be changed to the prefix, so it's clear
> aft
sbenza created this revision.
sbenza added a reviewer: klimek.
sbenza added a subscriber: cfe-commits.
Herald added a subscriber: klimek.
Allow hasName() to look through inline namespaces.
This will fix the interaction between some clang-tidy checks and libc++.
libc++ defines names in an inline n
sbenza updated this revision to Diff 42767.
sbenza added a comment.
Minor fixes
http://reviews.llvm.org/D15506
Files:
lib/ASTMatchers/ASTMatchersInternal.cpp
unittests/ASTMatchers/ASTMatchersTest.cpp
Index: unittests/ASTMatchers/ASTMatchersTest.cpp
=
sbenza added a comment.
I am thinking on doing this some other way.
Copying the PrintingPolicy object is very expensive, as it contains quite a few
strings and vectors of strings.
In the past I changed this matcher to make no allocations in the common path
(ie using SmallString<>, etc) to reduce
sbenza updated this revision to Diff 42884.
sbenza added a comment.
Add a faster version of the qualified name matcher.
It falls back to the previous version if it can't handle the name.
http://reviews.llvm.org/D15506
Files:
include/clang/ASTMatchers/ASTMatchersInternal.h
lib/ASTMatchers/AS
sbenza added inline comments.
Comment at: lib/ASTMatchers/ASTMatchersInternal.cpp:322
@@ +321,3 @@
+ for (bool SkipUnwritten : SkipUnwrittenCases) {
+llvm::SmallString<128> NodeName = StringRef("::");
+llvm::raw_svector_ostream OS(NodeName);
yaron.keren w
Author: sbenza
Date: Tue Dec 22 14:06:40 2015
New Revision: 256278
URL: http://llvm.org/viewvc/llvm-project?rev=256278&view=rev
Log:
[ASTMatchers] Add booleanType() matcher.
Modified:
cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
cfe/
Author: sbenza
Date: Tue Dec 22 15:06:36 2015
New Revision: 256284
URL: http://llvm.org/viewvc/llvm-project?rev=256284&view=rev
Log:
[ASTMatchers] Fix typo in booleanType() doc.
Fix typo in booleanType() doc and recreate the
LibASTMatchersReference.html reference document.
Modified:
cfe/trun
On Tue, Dec 22, 2015 at 3:16 PM, Aaron Ballman
wrote:
> On Tue, Dec 22, 2015 at 3:06 PM, Samuel Benzaquen via cfe-commits
> wrote:
> > Author: sbenza
> > Date: Tue Dec 22 14:06:40 2015
> > New Revision: 256278
> >
> > URL: http://llvm.org/viewvc/llvm
101 - 176 of 176 matches
Mail list logo