| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
llvm-svn: 172907
|
|
|
|
|
|
| |
brought into 'clang' namespace by clang/Basic/LLVM.h
llvm-svn: 172323
|
|
|
|
|
|
| |
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: 169236
|
|
|
|
| |
llvm-svn: 169235
|
|
|
|
| |
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
|
|
|
|
| |
llvm-svn: 166921
|
|
|
|
|
|
|
| |
Types, QualTypes and TypeLocs.
Review: http://llvm-reviews.chandlerc.com/D83
llvm-svn: 166917
|
|
|
|
| |
llvm-svn: 166567
|
|
|
|
| |
llvm-svn: 166479
|
|
|
|
|
|
| |
Patch by Gabor Horvath.
llvm-svn: 166477
|
|
|
|
| |
llvm-svn: 166421
|
|
|
|
|
|
| |
platforms to make buildbots happy.
llvm-svn: 166100
|
|
|
|
|
| |
Review: http://llvm-reviews.chandlerc.com/D47
llvm-svn: 166094
|
|
|
|
|
|
| |
"#include <initializer_list>" is unavailable for whatever reason.
llvm-svn: 164944
|
|
|
|
|
|
|
| |
Patch by Gábor Horváth.
Review: http://llvm-reviews.chandlerc.com/D46
llvm-svn: 164943
|
|
|
|
|
|
|
| |
broken as of r164656 as TemplateArgument::getAsDecl() now asserts
instead of returning NULL for other template arugment kinds.
llvm-svn: 164896
|
|
|
|
|
|
|
| |
Patch by Gábor Horváth.
Review: http://llvm-reviews.chandlerc.com/D45
llvm-svn: 164304
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Without this patch, the isDerivedFrom matcher asserts in the
"assert(ClassDecl != NULL);" in the new test, as a
DependentTemplateSpecilizationType is not a sub-type of
TemplateSpecializationType and also does not offer getAsCXXRecordDecl().
I am not sure why this did not cause problems before. It is now (after
the changed implementation of isDerivedFrom) easier to write a matcher
that actually gets into this branch of the code.
llvm-svn: 164127
|
|
|
|
|
|
| |
Patch by Gábor Horváth.
llvm-svn: 164123
|
|
|
|
|
|
|
|
|
|
| |
Having Expr-subclass-matchers being VariadicDynCast-Expr-matchers does
not provide additional type safety and just makes using them harder. In
the clang AST, expressions are always statements and an expression
matcher can be used anywhere, a statement matcher is expected. Any given
matcher definition still has at least one noun.
llvm-svn: 164121
|
|
|
|
|
| |
Review: http://llvm-reviews.chandlerc.com/D39
llvm-svn: 163794
|
|
|
|
|
|
|
|
|
|
|
| |
There are two evils we can choose from:
- Name overlap between isA-matcher and llvm::isa<>()
- Bad name for what the isA-matcher currently does
After some discussion we have agreed to go with the latter evil.
Review: http://llvm-reviews.chandlerc.com/D40
llvm-svn: 163740
|
|
|
|
|
|
|
|
|
|
|
|
| |
class itself. This caused some confusion (intuitively, a class is not
derived from itself) and makes it hard to write certain matchers, e.g.
"match and bind any pair of base and subclass".
The original behavior can be achieved with a new isA-matcher. Similar
to all other matchers, this matcher has the same behavior and name as
the corresponding AST-entity - in this case the isa<>() function.
llvm-svn: 163385
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Implements the hasAncestor matcher. This builds
on the previous patch that introduced DynTypedNode to build up
a parent map for an additional degree of freedom in the AST traversal.
The map is only built once we hit an hasAncestor matcher, in order
to not slow down matching for cases where this is not needed.
We could implement some speed-ups for special cases, like building up
the parent map as we go and only building up the full map if we break
out of the already visited part of the tree, but that is probably
not going to be worth it, and would make the code significantly more
complex.
Major TODOs are:
- implement hasParent
- implement type traversal
- implement memoization in hasAncestor
llvm-svn: 163382
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
UntypedBaseMatcher and TypedMatcher.
Due to DynTypedNode the basic dynamically typed matcher interface can now be simplified.
Also switches the traversal interfaces to use DynTypedNode;
this is in preperation for the hasAncestor implementation, and
also allows us to need fewer changes when we want to add new
nodes to traverse, thus making the code a little more decoupled.
Main design concerns: I went back towards the original design
of getNodeAs to return a pointer, and switched DynTypedNode::get
to always return a pointer (in case of value types like QualType
the pointer points into the storage of DynTypedNode, thus allowing
us to treat all the nodes the same from the point of view of a
user of the DynTypedNodes.
Adding the QualType implementation for DynTypedNode was needed
for the recursive traversal interface changes.
llvm-svn: 163212
|
|
|
|
|
|
|
| |
This is similar to how we divide up the StaticAnalyzer libraries to separate
core functionality to what is clearly associated with Frontend actions.
llvm-svn: 163050
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Intorduces an abstraction for DynTypedNode which makes
is impossible to create in ways that introduced the bug;
also hides the implementation details of the template
magic away from the user and prepares the code for adding
QualType and TypeLoc bindings, as well as using DynTypedNode
instead of overloads for child and ancestor matching.
getNodeAs<T> was changed towards a non-pointer type, as
we'll want QualType and TypeLoc nodes to be returned
by value (the alternative would be to create new storage
which is prohibitively costly if we want to use it for
child / ancestor matching).
DynTypedNode is moved into a new header ASTTypeTraits.h,
as it is completely independent of the rest of the matcher
infrastructure - if the need comes up, we can move it to
a more common place.
The interface for users before the introduction of the
common storage change remains the same, minus the introduced
bug, for which a regression test was added.
llvm-svn: 162936
|
|
|
|
|
|
| |
Also update the tests that rely on c++98 to explicitly mention that.
llvm-svn: 162890
|
|
|
|
| |
llvm-svn: 162609
|
|
|
|
|
|
|
|
|
| |
ASTMatchers have the same name as the corresponding AST nodes
but are lower case. The only exceptions are the "CXX" prefixes
which are not copied over to the matcher names as the goal is to
actually remove these prefixes from the AST node names.
llvm-svn: 162536
|
|
|
|
|
|
| |
declare size_t in system-independent way.
llvm-svn: 162158
|
|
|
|
| |
llvm-svn: 162153
|
|
|
|
|
|
| |
isExplicitTemplateSpecialization() matchers which do what their name says.
llvm-svn: 162115
|
|
|
|
|
|
| |
particular declaration within the statement, and single-Decl DeclStmts.
llvm-svn: 162027
|
|
|
|
|
|
| |
IgnoreParenImpCasts
llvm-svn: 162025
|
|
|
|
| |
llvm-svn: 161974
|