| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
| |
Differential Revision: http://llvm-reviews.chandlerc.com/D2114
llvm-svn: 194222
|
|
|
|
|
|
|
|
|
| |
The purpose of this function is to allow clients of the dynamic AST matcher
to enumerate each binding.
Differential Revision: http://llvm-reviews.chandlerc.com/D2095
llvm-svn: 194112
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes PR16182.
Normally RAV visits parameter variable declarations of a function by traversing the TypeLoc of
the parameter declarations. However, for implicit functions, their parameters don't have any
TypeLoc, because they are implicit.
So for implicit functions, we visit their parameter variable declarations by traversing them through
the function declaration, and visit them accordingly.
Reviewed by Richard Smith and Manuel Klimek.
llvm-svn: 190528
|
|
|
|
|
|
|
|
|
| |
- pull out function to drill to the CXXRecordDecl from the type,
to allow recursive resolution
- make the analysis more robust by rather skipping values we don't
understand
llvm-svn: 187676
|
|
|
|
|
|
| |
Patch by Chris Gray! Thanks!
llvm-svn: 187232
|
|
|
|
| |
llvm-svn: 186668
|
|
|
|
|
|
| |
the right polymorphic overload to use.
llvm-svn: 184558
|
|
|
|
|
|
| |
Most of the tests contributed by Edwin Vane.
llvm-svn: 184427
|
|
|
|
| |
llvm-svn: 184419
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is in preparation for the backwards references to bound
nodes, which will expose a lot more about how matches occur. Main
changes:
- instead of building the tree of bound nodes, we build a "set" of bound
nodes and explode all possible match combinations while running
through the matchers; this will allow us to also implement matchers
that filter down the current set of matches, like "equalsBoundNode"
- take the set of bound nodes at the start of the match into
consideration when doing memoization; as part of that, reevaluated
that memoization gives us benefits that are large enough (it still
does - the effect on common match patterns is up to an order of
magnitude)
- reset the bound nodes when a node does not match, thus never leaking
information from partial sub-matcher matches for failing matchers
Effects:
- we can now correctly "explode" combinatorial matches, for example:
allOf(forEachDescendant(...bind("a")),
forEachDescendant(...bind("b"))) will now trigger matches for all
combinations of matching "a" and "b"s.
- we now never expose bound nodes from partial matches in matchers that
did not match in the end - this fixes a long-standing issue
FIXMEs:
- rename BoundNodesTreeBuilder to BoundNodesBuilder or
BoundNodesSetBuilder, as we don't build a tree any more; this is out
of scope for this change, though
- we're seeing some performance regressions (around 10%), but I expect
some performance tuning will get that back, and it's easily worth
the increase in expressiveness for now
llvm-svn: 184313
|
|
|
|
|
|
| |
Differential Revision: http://llvm-reviews.chandlerc.com/D745
llvm-svn: 182798
|
|
|
|
|
|
| |
Differential Revision: http://llvm-reviews.chandlerc.com/D744
llvm-svn: 181588
|
|
|
|
|
|
| |
Updated reference and unit tests.
llvm-svn: 181522
|
|
|
|
| |
llvm-svn: 180808
|
|
|
|
|
|
|
|
| |
isVirtual - matches CXXMethodDecl nodes for virtual methods
isOverride - matches CXXMethodDecl nodes for methods that override virtual methods from a base class.
Author: Philip Dunstan <phil@philipdunstan.com>
llvm-svn: 179126
|
|
|
|
| |
llvm-svn: 179027
|
|
|
|
|
|
| |
Updated tests and docs.
llvm-svn: 178556
|
|
|
|
|
|
| |
Updated docs and tests.
llvm-svn: 178487
|
|
|
|
|
|
|
|
|
|
|
| |
This yields a log(#ast_nodes) worst-case improvement with matchers like
stmt(unless(hasAncestor(...))).
Also made the order of visitation for ancestor matches BFS, as the most
common use cases (for example finding the closest enclosing function
definition) rely on that.
llvm-svn: 177081
|
|
|
|
|
|
|
|
| |
Updated docs and tests.
Reviewers: klimek, gribozavr
llvm-svn: 176630
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Added two new narrowing matchers:
* hasMethod: aplies a matcher to a CXXRecordDecl's methods until a match is made
or there are no more methods.
* hasCanonicalType: applies a matcher to a QualType's canonicalType.
Enhanced hasOverloadedOperatorName to work on CXXMethodDecl as well as
CXXOperatorCallExpr.
Updated tests and docs.
Reviewers: klimek, gribozavr
llvm-svn: 176556
|
|
|
|
|
|
|
|
| |
Instead of passing NULL on to sub-matcher, just return false. Updated tests and
regenerated docs.
Author: Tareq A Siraj <tareq.a.siraj@intel.com>
llvm-svn: 176441
|
|
|
|
|
|
| |
Otherwise it'll break if there's a record type in the AST by default.
llvm-svn: 176181
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
New type matchers:
* recordType
* elaboratedType
New narrowing matchers:
* hasQualifier
* namesType
* hasDeclContext
Added tests and updated LibASTMatchersReference.
Reviewers: klimek
llvm-svn: 176047
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
TemplateSpecializationType doesn't quite have getDecl(). Need to go
through TemplateName to get a TemplateDecl.
Added test cases for the hasDeclaration() overload for
TemplateSpecializationType. Also introduced the type matcher
templateSpecializationType() used by the new hasDeclaration() test case.
Updated LibASTMatchersReference.
Reviewers: klimek
llvm-svn: 176025
|
|
|
|
|
|
|
|
|
|
|
| |
Re-introducing r175532. The has_getDecl metafunction didn't compile with
Visual Studio. This revision uses approaches has_getDecl from a
different angle that isn't a problem for Visual Studio.
Added dedicated tests for the metafunction.
Reviewers: klimek
llvm-svn: 176024
|
|
|
|
| |
llvm-svn: 176021
|
|
|
|
|
|
|
|
|
|
|
| |
Re-introducing r175532. The has_getDecl metafunction didn't compile with Visual
Studio. This revision approaches has_getDecl from a different angle that isn't
a problem for Visual Studio.
Added dedicated tests for the metafunction.
Reviewers: klimek
llvm-svn: 176019
|
|
|
|
|
|
|
| |
Also, add matchers isPrivate(), isProtected() and isPublic(), that
restrict the matching of such AccessSpecDecls and all other Decls.
llvm-svn: 176017
|
|
|
|
|
|
|
|
|
|
|
|
| |
Using a new metafunction for detecting the presence of the member
'getDecl' in a type T, added support to hasDeclaration for any such type
T. This allows hasDecl() to be replaced and enables several other
subclasses of clang::Type to use hasDeclaration.
Updated unittests and LibASTMatchersReference.html.
Reviewers: klimek
llvm-svn: 175532
|
|
|
|
| |
llvm-svn: 175454
|
|
|
|
|
|
|
|
| |
Adding overloads of allOf accepting 4 and 5 arguments.
Reviewer: klimek
llvm-svn: 174967
|
|
|
|
|
|
|
|
|
| |
This is a powerful tool when doing iterative refined matches,
where another match is started inside the match callback of the first
one; this allows for example to find out whether the node was in
the condition or body of its parent if-statement.
llvm-svn: 174605
|
|
|
|
|
|
|
|
| |
A very common use case is to search for the first occurrence of
a certain node that is a descendant of another node. In that
case, selectFirst significantly simplifies the code at the client side.
llvm-svn: 174499
|
|
|
|
|
|
|
|
|
|
|
| |
We found that findAll has been implemented incorrectly multiple times
by various people using the matchers. To prevent further wasted
development effort, it makes sense to add it as convenience matcher
implemented as eachOf(m, forEachDescendant(m)).
This patch also updates the docs with the new matchers.
llvm-svn: 174320
|
|
|
|
|
|
|
|
|
| |
eachOf gives closure on the forEach and forEachDescendant matchers.
Before, it was impossible to implement a findAll matcher, as matching
the node or any of its descendants was not expressible (since anyOf
only triggers the first match).
llvm-svn: 174315
|
|
|
|
|
|
|
|
|
|
|
|
| |
First, this implements a match() method on MatchFinder; this allows us
to get rid of the findAll implementation, as findAll is really a special
case of recursive matchers on match.
Instead of findAll, provide a convenience function match() that lets
users iterate easily over the results instead of needing to implement
callbacks.
llvm-svn: 174172
|
|
|
|
|
|
| |
100% sure.
llvm-svn: 169725
|
|
|
|
|
|
|
| |
Previously we would match the last visited parent, which in the
case of template instantiations was the last instantiated template.
llvm-svn: 169508
|
|
|
|
| |
llvm-svn: 169271
|
|
|
|
| |
llvm-svn: 169262
|
|
|
|
| |
llvm-svn: 169257
|
|
|
|
|
|
| |
I've tried to place sensible headers at the top as main-module headers.
llvm-svn: 169243
|
|
|
|
| |
llvm-svn: 169129
|
|
|
|
| |
llvm-svn: 169096
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The problem is that a partial match of an (explicit or implicit) allOf matcher
binds results, i.e.
recordDecl(decl().bind("x"), hasName("A"))
can very well bind a record that is not named "A". With this fix, the common
cases of stumbling over this bug are fixed by the BoundNodesMap overwriting the
results of a partial match. An error can still be created with a weird
combination of anyOf and allOf (see inactive test). We need to decide whether
this is worth fixing, as the fix will have performance impact.
Review: http://llvm-reviews.chandlerc.com/D124
llvm-svn: 168177
|
|
|
|
|
|
| |
The matchers rely on the complete AST being traversed as shown by the new test cases.
llvm-svn: 168022
|
|
|
|
|
|
|
|
|
|
| |
When recursively visiting the generated matches, the aggregated bindings need
to be copied during the recursion. Otherwise, we they might not be properly
overwritten (which is shown by the test), or there might be bound nodes present
that were bound on a different matching branch.
Review: http://llvm-reviews.chandlerc.com/D112
llvm-svn: 167695
|
|
|
|
|
|
|
|
|
| |
Often users of the ASTMatchers want to add tasks that are done once per
translation unit, for example, cleaning up caches. Combined with the
interception point for the end of source file one can add to the factory
creation, this covers the cases we've seen users need.
llvm-svn: 167271
|
|
|
|
|
|
|
|
|
| |
This implements has(), hasDescendant(), forEach() and
forEachDescendant() for NestedNameSpecifier and NestedNameSpecifierLoc
matchers.
Review: http://llvm-reviews.chandlerc.com/D86
llvm-svn: 167017
|