• Home
  • History
  • Annotate
  • only in /external/clang/include/clang/ASTMatchers/
History log of /external/clang/include/clang/ASTMatchers/
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
ef8225444452a1486bd721f3285301fe84643b00 21-Jul-2014 Stephen Hines <srhines@google.com> Update Clang for rebase to r212749.

This also fixes a small issue with arm_neon.h not being generated always.

Includes a cherry-pick of:
r213450 - fixes mac-specific header issue
r213126 - removes a default -Bsymbolic on Android

Change-Id: I2a790a0f5d3b2aab11de596fc3a74e7cbc99081d
STMatchers.h
STMatchersInternal.h
STMatchersMacros.h
ynamic/Registry.h
6bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89 29-May-2014 Stephen Hines <srhines@google.com> Update Clang for 3.5 rebase (r209713).

Change-Id: I8c9133b0f8f776dc915f270b60f94962e771bc83
STMatchFinder.h
STMatchers.h
STMatchersInternal.h
ynamic/Diagnostics.h
ynamic/Parser.h
ynamic/Registry.h
ynamic/VariantValue.h
651f13cea278ec967336033dd032faef0e9fc2ec 24-Apr-2014 Stephen Hines <srhines@google.com> Updated to Clang 3.5a.

Change-Id: I8127eb568f674c2e72635b639a3295381fe8af82
STMatchFinder.h
STMatchers.h
STMatchersInternal.h
STMatchersMacros.h
ynamic/Diagnostics.h
ynamic/Parser.h
ynamic/Registry.h
ynamic/VariantValue.h
6c1dc7870f457803a9b256ed868da82532be820b 18-Nov-2013 Samuel Benzaquen <sbenza@google.com> Add partial support for the hasDeclaration() matcher in the dynamic layer.

Summary:
Add partial support for the hasDeclaration() matcher in the dynamic layer.
This matcher has some special logic to allow any type that has a getDecl() method. We do not support this right now.

Reviewers: klimek

CC: cfe-commits, revane

Differential Revision: http://llvm-reviews.chandlerc.com/D1889

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@195013 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
STMatchersInternal.h
STMatchersMacros.h
51fcdf84a794a01601c7c78889efa21fbfc1db08 07-Nov-2013 Peter Collingbourne <peter@pcc.me.uk> Introduce MatchFinder::matchAST.

Differential Revision: http://llvm-reviews.chandlerc.com/D2115

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194223 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchFinder.h
d2bd58907f77e1c1b68a6fa8fc72e1c5b057a5b1 07-Nov-2013 Peter Collingbourne <peter@pcc.me.uk> Re-introduce MatchFinder::addDynamicMatcher.

Differential Revision: http://llvm-reviews.chandlerc.com/D2114

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194222 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchFinder.h
3f0e0402d8cd40b428f975f1a3607dbbd94d2ca6 06-Nov-2013 Peter Collingbourne <peter@pcc.me.uk> Introduce BoundNodes::getMap.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194112 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
STMatchersInternal.h
b7488d77414b000ce2506b520a6b29f845fb3950 29-Oct-2013 Samuel Benzaquen <sbenza@google.com> Resubmit "Refactor DynTypedMatcher into a value type class, just like Matcher<T>."

Summary: This resubmits r193100, plus a fix for a breakage with MSVC.

Reviewers: klimek, rnk

CC: cfe-commits, revane

Differential Revision: http://llvm-reviews.chandlerc.com/D2005

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193613 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchFinder.h
STMatchersInternal.h
ynamic/Parser.h
ynamic/VariantValue.h
c30bf45115860b8de8628295f0d9cd86998841de 22-Oct-2013 Reid Kleckner <reid@kleckner.net> Revert "Refactor DynTypedMatcher into a value type class, just like Matcher<T>."

This reverts commit r193100.

It was failing to compile with MSVC 2012 while instantiating
llvm::Optional<DynTypedMatcher>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193123 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchFinder.h
STMatchersInternal.h
ynamic/Parser.h
ynamic/VariantValue.h
341b5df7f859e640c2ea2f35c0fff553ec55ada4 21-Oct-2013 Samuel Benzaquen <sbenza@google.com> Refactor DynTypedMatcher into a value type class, just like Matcher<T>.

Summary:
Refactor DynTypedMatcher into a value type class, just like Matcher<T>.
This simplifies its usage and removes the virtual hierarchy from Matcher<T>.
It also enables planned changes to replace MatcherInteface<T>.
Too many instantiaions of this class hierarchy has been causing Registry.cpp.o to bloat in size and number of symbols.

Reviewers: klimek

CC: cfe-commits, revane

Differential Revision: http://llvm-reviews.chandlerc.com/D1661

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193100 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchFinder.h
STMatchersInternal.h
ynamic/Parser.h
ynamic/VariantValue.h
063820655db8121f0022a7c51458463c7250324c 20-Oct-2013 Benjamin Kramer <benny.kra@googlemail.com> Miscellaneous speling fixes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193046 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
STMatchersMacros.h
e575359c34a9248c55ec0c03a8fc945f1ee4cb01 09-Sep-2013 Benjamin Kramer <benny.kra@googlemail.com> Fix constructor-related typos.

Noticed by Roman Divacky.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190311 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
1245a54ca6e9c5b14196461dc3f84b24ea6594b1 07-Sep-2013 Enea Zaffanella <zaffanella@cs.unipr.it> Fix missing source location in CXXTemporaryObjectExpr nodes.
For clarity, renamed (get/set)ParenRange as (get/set)ParenOrBraceRange
in CXXConstructExpr nodes.
Added testcase.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190239 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
9e046e1575fb957a8acb76666c67ed509e7ffe96 04-Sep-2013 Eric Christopher <echristo@gmail.com> More unused warning silencing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189951 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
799bf2d371bb1cba04317c216ce1cd707d389c74 04-Sep-2013 Eric Christopher <echristo@gmail.com> Attempt to silence some defined but not used warnings.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189922 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
7156ffff6de12d8a14b0597f1ca5053115cf5773 03-Sep-2013 Samuel Benzaquen <sbenza@google.com> Remove DynCastMatcher, since it is pretty much the same as Matcher<T>::WrappedMatcher.

Summary:
Remove DynCastMatcher, since it is pretty much the same as Matcher<T>::WrappedMatcher.
This reduces the number of template instantiations and number of symbols in the object file.

Reviewers: klimek

CC: cfe-commits, revane

Differential Revision: http://llvm-reviews.chandlerc.com/D1560

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189800 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchersInternal.h
4e899d9b0b5aa31b0a3704374d245fc345c19fa8 30-Aug-2013 Samuel Benzaquen <sbenza@google.com> Reduce the number of symbols by changing how templates are instantiated per function bound in the registry.

Summary:
Reduce the number of symbols by changing how templates are instantiated per function bound in the registry.
This change reduces the number of sections in Registry.cpp.o by a little over 10%.

Reviewers: klimek

CC: cfe-commits, revane

Differential Revision: http://llvm-reviews.chandlerc.com/D1557

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189676 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchersInternal.h
ynamic/VariantValue.h
a735090449197f1edcdc85a6080eebc0304a31dd 28-Aug-2013 Samuel Benzaquen <sbenza@google.com> Add support for eachOf/allOf/anyOf variadic matchers in the dynamic layer.

Summary:
Add support for eachOf/allOf/anyOf variadic matchers in the dynamic layer.
These function require some late binding behavior for the type conversions, thus changes in VariadicValue's MatcherList.
Second try. This time with a fix for C++11 builds.

Reviewers: klimek

CC: cfe-commits, revane

Differential Revision: http://llvm-reviews.chandlerc.com/D1536

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189500 91177308-0d34-0410-b5e6-96231b3b80d8
ynamic/VariantValue.h
99e0df4ab60c5fa4afd2bf63b896fd4f88792127 27-Aug-2013 Samuel Benzaquen <sbenza@google.com> Revert "Add support for eachOf/allOf/anyOf variadic matchers in the dynamic layer."

Summary:
This reverts commit 3b082a3c72324aa3363b5184731740534c6b9a2b.

It breaks the build in c++11 mode.

Reviewers: klimek

CC: cfe-commits, revane

Differential Revision: http://llvm-reviews.chandlerc.com/D1533

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189368 91177308-0d34-0410-b5e6-96231b3b80d8
ynamic/VariantValue.h
3b082a3c72324aa3363b5184731740534c6b9a2b 27-Aug-2013 Samuel Benzaquen <sbenza@google.com> Add support for eachOf/allOf/anyOf variadic matchers in the dynamic layer.

Summary:
Add support for eachOf/allOf/anyOf variadic matchers in the dynamic layer.
These function require some late binding behavior for the type conversions, thus changes in VariadicValue's MatcherList.

Reviewers: klimek

CC: cfe-commits, revane

Differential Revision: http://llvm-reviews.chandlerc.com/D1531

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189362 91177308-0d34-0410-b5e6-96231b3b80d8
ynamic/VariantValue.h
d36e46350b50907425bba0db1b3ddfb46cc1637f 27-Aug-2013 Samuel Benzaquen <sbenza@google.com> Rewrite eachOf/allOf/anyOf to use a variadic operator.

Summary:
Rewrite eachOf/allOf/anyOf to use a variadic operator, instead of hand-written calls to Polymorphic matchers.
This simplifies their definition and future changes to add them to the dynamic registry.

Reviewers: klimek

CC: cfe-commits, revane

Differential Revision: http://llvm-reviews.chandlerc.com/D1427

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189357 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
STMatchersInternal.h
544ae5bb0ae09e65f7e09754bdd5d0c97602884d 22-Aug-2013 Samuel Benzaquen <sbenza@google.com> Refactor VariantMatcher to use an interface underneath.

Summary:
Refactor VariantMatcher to use an interface underneath.
It supports "Single" and "Polymorphic". Will support more in the future.

Reviewers: klimek

CC: cfe-commits, revane

Differential Revision: http://llvm-reviews.chandlerc.com/D1446

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189032 91177308-0d34-0410-b5e6-96231b3b80d8
ynamic/VariantValue.h
ee0da9520fe94f701240e9e1c97773ee412be102 16-Aug-2013 Samuel Benzaquen <sbenza@google.com> Refactor ArgumentAdaptativeMatcher matchers to remove the template from their declaration.

Summary:
Refactor ArgumentAdaptativeMatcher matchers to remove the template from their declaration.
This facilitates dynamic registration. Change the registry code to use the regular overload resolution mechanism for adaptative matchers.

Reviewers: klimek

CC: cfe-commits, revane

Differential Revision: http://llvm-reviews.chandlerc.com/D1402

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188560 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
STMatchersInternal.h
9d02807c3ea9782442b98201df68294cd7cd7313 13-Aug-2013 Samuel Benzaquen <sbenza@google.com> Refactor "MatcherList" into "VariantMatcher" and abstract the notion of a list of matchers for the polymorphic case.

Summary:
Refactor "MatcherList" into "VariantMatcher" and abstract the notion of a list of matchers for the polymorphic case.
This work is to support future changes needed for eachOf/allOf/anyOf matchers. We will add a new type on VariantMatcher.

Reviewers: klimek

CC: cfe-commits, revane

Differential Revision: http://llvm-reviews.chandlerc.com/D1365

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188272 91177308-0d34-0410-b5e6-96231b3b80d8
ynamic/Parser.h
ynamic/Registry.h
ynamic/VariantValue.h
c5ae717c2b774bfce6bce4bb51072f664b2d54aa 26-Jul-2013 Daniel Jasper <djasper@google.com> Add matcher for float literals.

Patch by Chris Gray! Thanks!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187232 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
6de440e1989ee7932c942dcba85e862c31bf4604 24-Jul-2013 Samuel Benzaquen <sbenza@google.com> Add support for Adaptative matchers on the dynamic registry.

Summary:
Add support for Adaptative matchers on the dynamic registry.
Each adaptative matcher is created with a function template. We instantiate the function N times, one for each possible From type and apply the techniques used on argument overloaded and polymorphic matchers to add them to the registry.

Reviewers: klimek

CC: cfe-commits, revane

Differential Revision: http://llvm-reviews.chandlerc.com/D1201

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187044 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
STMatchersInternal.h
0e1896a753845deee5206b28cdbde1640abb9cac 22-Jul-2013 Samuel Benzaquen <sbenza@google.com> Add support for overloaded matchers. ie different matcher function signatures with the same name.

Summary:
Add support for overloaded matchers.
This composes with other features, like supporting polymorphic matchers.

Reviewers: klimek

CC: cfe-commits, revane

Differential Revision: http://llvm-reviews.chandlerc.com/D1188

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186836 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
STMatchersMacros.h
ynamic/Diagnostics.h
2f5a23103f691b1bf7522494fabeaa8f7bd7122b 19-Jul-2013 Samuel Benzaquen <sbenza@google.com> Add support for raw_ostream on the printing methods of Diagnostics.

Summary:
Add printToStream*(llvm::raw_ostream&) methods to Diagnostics, and reimplement everything based on streams instead of concatenating strings.
Also, fix some functions to start with lowercase to match the style guide.

Reviewers: klimek

CC: cfe-commits, revane

Differential Revision: http://llvm-reviews.chandlerc.com/D1187

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186715 91177308-0d34-0410-b5e6-96231b3b80d8
ynamic/Diagnostics.h
de9ed71c696bee936a21323f61548164de0eda13 19-Jul-2013 Enea Zaffanella <zaffanella@cs.unipr.it> Fix source range of implicitly instantiated friend declaration.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186702 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
06963013d1972f1f7a58875bb40976b60522700b 19-Jul-2013 Manuel Klimek <klimek@google.com> Adds ctorInitializer and forEachConstructorInitializer matchers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186668 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
8a77c20375874c0759a5cd5b4a34e83465d821b2 18-Jul-2013 Samuel Benzaquen <sbenza@google.com> Separate the notion of 'context' when recursing down in the parser and actual errors.

Summary:
Change how error messages are constructed and stored in Diagnostics.
Separate the notion of 'context' when recursing down in the parser and actual errors.
This will simplify adding some new features, like argument overloading and error recovery.

Reviewers: klimek

CC: cfe-commits, revane

Differential Revision: http://llvm-reviews.chandlerc.com/D1168

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186602 91177308-0d34-0410-b5e6-96231b3b80d8
ynamic/Diagnostics.h
d4de59d3e54421ef88316d650e35802ba9c572cf 17-Jul-2013 Enea Zaffanella <zaffanella@cs.unipr.it> Fixed source range of C++03 access declarations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186522 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
3f84bb341bfb1312842b09db71d76bc3898ba247 15-Jul-2013 Samuel Benzaquen <sbenza@google.com> Add support for type traversal matchers.

Summary:
Fixup the type traversal macros/matchers to specify the supported types.
Make the marshallers a little more generic to support any variadic function.
Update the doc script.

Reviewers: klimek

CC: cfe-commits, revane

Differential Revision: http://llvm-reviews.chandlerc.com/D1023

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186340 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
STMatchersInternal.h
STMatchersMacros.h
bd9cbd22b832ce65a085801259cf2d3df77830e4 07-Jul-2013 Enea Zaffanella <zaffanella@cs.unipr.it> Fixed source range for functional cast and unresolved construct expr nodes.
Added testcases.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185773 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
2d77634e839880704d51656bebd1d2daff661d4e 06-Jul-2013 Enea Zaffanella <zaffanella@cs.unipr.it> Fixed source location info for UnaryTransformTypeLoc nodes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185765 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
ef7eb024397a6a9d1455b31bc7b10288a817ac3b 21-Jun-2013 Samuel Benzaquen <sbenza@google.com> Add support for polymorphic matchers. Use runtime type checking to determine the right polymorphic overload to use.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184558 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
STMatchersInternal.h
STMatchersMacros.h
ynamic/Diagnostics.h
ynamic/Parser.h
ynamic/Registry.h
ynamic/VariantValue.h
76c2f92c4b4ab7e02857661a05e53ba4b501d87a 20-Jun-2013 Samuel Benzaquen <sbenza@google.com> Enhancements for the DynTypedMatcher system.
- Added conversion routines and checks in Matcher<T> that take a DynTypedMatcher.
- Added type information on the error messages for the marshallers.
- Allows future work on Polymorphic/overloaded matchers. We should be
able to disambiguate at runtime and choose the appropriate overload.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184429 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchFinder.h
STMatchersInternal.h
ynamic/VariantValue.h
cf52ca6bb6dd76a1bd967bc422287fafafa1e45a 20-Jun-2013 Manuel Klimek <klimek@google.com> Adds the equalsBoundNode matcher.

Most of the tests contributed by Edwin Vane.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184427 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
STMatchersInternal.h
1a68afd5bbecd05a3bb22854954aa4e5448c4470 20-Jun-2013 Manuel Klimek <klimek@google.com> Implements declaratorDecl, parmVarDecl and hassTypeLoc matchers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184419 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
054d049174eb1ec8e93a4a0831c0d8caac00cb3a 19-Jun-2013 Manuel Klimek <klimek@google.com> Completely revamp node binding for AST matchers.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184313 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
STMatchersInternal.h
03a83238c39e290ed6e2ced7663efa9fa8c19158 10-Jun-2013 Manuel Klimek <klimek@google.com> Fixes the comment for hasDeclaration.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183640 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
7a337af9e8bc752a2d3b227e4058ed2baf7a19d1 04-Jun-2013 Samuel Benzaquen <sbenza@google.com> Parser/Registry argument enhancements.

Summary:
Parser/Registry argument enhancements.
- 2 argument support.
- unsigned values support.

Reviewers: klimek

CC: cfe-commits, revane

Differential Revision: http://llvm-reviews.chandlerc.com/D915

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183231 91177308-0d34-0410-b5e6-96231b3b80d8
ynamic/Diagnostics.h
ynamic/Parser.h
ynamic/VariantValue.h
4f37d925927dfdd0c770702ffb22de38fc2007dc 03-Jun-2013 Samuel Benzaquen <sbenza@google.com> Add support for .bind("foo") expressions on the dynamic matchers.

Summary: Add support on the parser, registry, and DynTypedMatcher for binding IDs dynamically.

Reviewers: klimek

CC: cfe-commits, revane

Differential Revision: http://llvm-reviews.chandlerc.com/D911

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183144 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchersInternal.h
ynamic/Diagnostics.h
ynamic/Parser.h
ynamic/Registry.h
8f9e590f78b1b05c36c2a14d68c4b9f9acbb891a 28-May-2013 Peter Collingbourne <peter@pcc.me.uk> Add an overridable MatchCallback::onEndOfTranslationUnit() function.

Differential Revision: http://llvm-reviews.chandlerc.com/D745

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182798 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchFinder.h
6e01994046860c5c120c832a22557ec1c6b72ce9 14-May-2013 Reid Kleckner <reid@kleckner.net> Fix the MSVC build broken by r181768

MSVC accepts the using decl but not the typedef. It complains that the
typedef is ambiguous.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181826 91177308-0d34-0410-b5e6-96231b3b80d8
ynamic/VariantValue.h
f7f295f321fd434e1e542844a71f538a56f2f8fb 14-May-2013 Manuel Klimek <klimek@google.com> First revision of the dynamic ASTMatcher library.

This library supports all the features of the compile-time based ASTMatcher
library, but allows the user to specify and construct the matchers at runtime.
It contains the following modules:
- A variant type, to be used by the matcher factory.
- A registry, where the matchers are indexed by name and have a factory method
with a generic signature.
- A simple matcher expression parser, that can be used to convert a matcher
expression string into actual matchers that can be used with the AST at
runtime.

Many features where omitted from this first revision to simplify this code
review. The main ideas are still represented in this change and it already has
support working use cases.
Things that are missing:
- Support for polymorphic matchers. These requires supporting code in the
registry, the marshallers and the variant type.
- Support for numbers, char and bool arguments to the matchers. This requires
supporting code in the parser and the variant type.
- A command line program putting everything together and providing an already
functional tool.

Patch by Samuel Benzaquen.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181768 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchFinder.h
STMatchersInternal.h
ynamic/Diagnostics.h
ynamic/Parser.h
ynamic/Registry.h
ynamic/VariantValue.h
acf02715ab1aa1e5a791f20e0d1ca217af256823 10-May-2013 Peter Collingbourne <peter@pcc.me.uk> Add caseStmt(), defaultStmt(), eachCase() and hasCaseConstant() matchers.

Differential Revision: http://llvm-reviews.chandlerc.com/D744

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181588 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
32a6ebc63900b85780328c337787bb7adad2bcab 09-May-2013 Edwin Vane <edwin.vane@intel.com> Adding isConst() ASTMatcher for CXXMethodDecl nodes

Updated reference and unit tests.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181522 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
54eeac9cb538e4fc4eecd81f2eda8f6fa727ca76 07-May-2013 Edwin Vane <edwin.vane@intel.com> Prevent crashes from hasCanonicalType matcher

Adding an QualType::isNull() check.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181329 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
5771a2f0830228ac50e3473740e24d9dca67b54f 09-Apr-2013 Edwin Vane <edwin.vane@intel.com> Adding new AST Matchers isVirtual and isOverride

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>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179126 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
abe922342d67d4ffe05b366a5a2af972185272f8 08-Apr-2013 Daniel Jasper <djasper@google.com> Add matcher for NamespaceDecls.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179027 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
7b69cd09440976d6b93a0db661a770b2337be8d2 02-Apr-2013 Edwin Vane <edwin.vane@intel.com> Adding a hasLocalQualifiers() AST Matcher.

Updated tests and docs.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178556 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
88be2fdec7a1375bc729a6499629532e7872f11a 01-Apr-2013 Edwin Vane <edwin.vane@intel.com> Adding parenType() and innerType() AST Matchers

Updated docs and tests.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178487 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
f4b48042724d2253d0426cadcb93e24eeb47e264 07-Mar-2013 Edwin Vane <edwin.vane@intel.com> Adding lvalue and rvalue reference type matchers

Updated docs and tests.

Reviewers: klimek, gribozavr


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176630 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
6a19a97e57c8678adb0505a07c97d7ccadc8fe4e 06-Mar-2013 Edwin Vane <edwin.vane@intel.com> New ASTMatchers and enhancement to hasOverloadedOperatorName

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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176556 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
STMatchersInternal.h
aec89ac22e1876bb1cfff9062c882a622bc84510 04-Mar-2013 Edwin Vane <edwin.vane@intel.com> hasQualifer() matcher should return false if there's no qualifier

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>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176441 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
ff9a01000ff74a994aa3da26ea2ec732c97291b7 28-Feb-2013 Manuel Klimek <klimek@google.com> First step towards adding a parent map to the ASTContext.

This does not yet implement the LimitNode approach discussed.

The impact of this is an O(n) in the number of nodes in the AST
reduction of complexity for certain kinds of matchers (as otherwise the
parent map gets recreated for every new MatchFinder).

See FIXMEs in the comments for the direction of future work.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176251 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchersInternal.h
STTypeTraits.h
742d9e77e32f014194679575c97c6bb4fd0998c4 25-Feb-2013 Edwin Vane <edwin.vane@intel.com> Various additions to ASTMatcher library:

New type matchers:
* recordType
* elaboratedType

New narrowing matchers:
* hasQualifier
* namesType
* hasDeclContext

Added tests and updated LibASTMatchersReference.

Reviewers: klimek


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176047 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
3abf77872ca6c520903f9174cf6cd89a50df2714 25-Feb-2013 Edwin Vane <edwin.vane@intel.com> Adding hasDeclaration overload for TemplateSpecializationType

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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176025 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
STMatchersInternal.h
b45083d08377a8b9528401fdafd7210e78895dbe 25-Feb-2013 Edwin Vane <edwin.vane@intel.com> Support in hasDeclaration for types with getDecl()

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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176024 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchersInternal.h
1b354b868c1aa227619d81e299fe6e384e1999b7 25-Feb-2013 Edwin Vane <edwin.vane@intel.com> Reverting r176019. Corrupt patch.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176021 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchersInternal.h
0b6f23a23c55b7024e7a0edca1fecf9bd4c380a1 25-Feb-2013 Edwin Vane <edwin.vane@intel.com> Support in hasDeclaration for types with getDecl()

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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176019 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchersInternal.h
f3197e9eb02120522c1f60f88dacc1cfe5b210f0 25-Feb-2013 Daniel Jasper <djasper@google.com> Add matcher for AccessSpecDecls.

Also, add matchers isPrivate(), isProtected() and isPublic(), that
restrict the matching of such AccessSpecDecls and all other Decls.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176017 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
c9088966de61c4958efbb7b635dad78d779ac6e6 22-Feb-2013 Aaron Ballman <aaron@aaronballman.com> Removing has_getDecl (added in r175532). It cause a build break for MSVC, and was not yet being used in the codebase. If we start using std::enable_if, we can look into resurrecting the idea in a more portable fashion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175837 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchersInternal.h
523806028d812a7f29636c59a8bc0e7e3d3fd9ae 19-Feb-2013 Edwin Vane <edwin.vane@intel.com> Support in hasDeclaration for types with getDecl()

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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175532 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
STMatchersInternal.h
5be093c0ef46c7749c942d0d9056af6dc3d591a4 18-Feb-2013 David Blaikie <dblaikie@gmail.com> Clean up last use of dyn_cast on TypeLoc in ASTMatchers

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175454 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchersMacros.h
7f43fcf5d9406788ce95c9f3b785e0a6bc75a7f7 12-Feb-2013 Edwin Vane <edwin.vane@intel.com> Adding more overloads for allOf matcher

Adding overloads of allOf accepting 4 and 5 arguments.

Reviewer: klimek



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174967 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
06b247f0ffb69854e32150c80f347a9376d3709b 11-Feb-2013 Manuel Klimek <klimek@google.com> Do not use VariadicDynCastAllOfMatcher where VariadicAllOfMatcher works.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174862 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
fa37c5ca61af275a329386407e58cf70f4d9f596 07-Feb-2013 Manuel Klimek <klimek@google.com> Implements equalsNode for Decl and Stmt.

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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174605 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
415514d5fbc2761b7f2938aa9112b079249820d6 06-Feb-2013 Manuel Klimek <klimek@google.com> Cleanup of ASTMatcher macros and adding support for overloaded matchers.

This is in preparation for adding other overloaded matchers. This change
alone is a net win in LOC.
I went through all matchers and looked whether we could now encode them
as macro, or simplify them with the matcher atoms that were not
available before.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174540 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
STMatchersInternal.h
STMatchersMacros.h
cf87bffc346244f0ed8eae7fffb52a0f03cd0413 06-Feb-2013 Manuel Klimek <klimek@google.com> Adds a convenience function selectFirst to simplify matching.

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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174499 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchFinder.h
afbcab8d10d4208c7ad8da79e948432117d4a326 05-Feb-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR15095: Use more correct source locations for the InitListExpr we fake up for
vector initialization. Patch by John Stratton!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174339 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
152ea0e4711f7aed75f6a1d1995b0bd94eb31c98 04-Feb-2013 Manuel Klimek <klimek@google.com> Implements the convenience matcher findAll.

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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174320 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
7387673f83b8b37f660422947c9990778ba88193 04-Feb-2013 Manuel Klimek <klimek@google.com> Add an eachOf matcher.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174315 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
STMatchersInternal.h
f8c12146fa2153a6d97b7c92d27d2ece0cd26e79 03-Feb-2013 Dmitri Gribenko <gribozavr@gmail.com> Remove unneeded const_casts


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174287 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
60969f5f6be1cbf7ac2384cc5ad571d28adf6bf1 01-Feb-2013 Manuel Klimek <klimek@google.com> Re-design the convenience interfaces on MatchFinder.

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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174172 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchFinder.h
cfa88f893915ceb8ae4ce2f17c46c24a4d67502f 12-Jan-2013 Dmitri Gribenko <gribozavr@gmail.com> Remove useless 'llvm::' qualifier from names like StringRef and others that are
brought into 'clang' namespace by clang/Basic/LLVM.h


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172323 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
STMatchersInternal.h
9946fc735d7285f2195f89635370f534afd9877e 12-Jan-2013 Dmitri Gribenko <gribozavr@gmail.com> Add missing includes and forward declarations so that headers don't depend on
other headers included before them.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172320 91177308-0d34-0410-b5e6-96231b3b80d8
STTypeTraits.h
7bb7fb634d20d9f3f5c6b5058a514a4b41b6f33d 08-Jan-2013 Manuel Klimek <klimek@google.com> clang-format can now format #defines.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171865 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchersMacros.h
31bdf071afc18bb9551e4f4254be297333200c4a 10-Dec-2012 Manuel Klimek <klimek@google.com> Clarifying comments for the MatchFinder and matchesNames matcher.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169737 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchFinder.h
STMatchers.h
36e29d6732814e958aea4b2f403cec63d7ed3116 04-Dec-2012 Daniel Jasper <djasper@google.com> Add parameterCountIs() matcher.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169257 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
189f2e421d06526ea8b4a3dcd9f4a072e10a859c 03-Dec-2012 Daniel Jasper <djasper@google.com> Make hasDeclaration work for enums.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169129 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchersInternal.h
7f2d4804510799a1a19d72b2b089e48370ab8686 30-Nov-2012 Manuel Klimek <klimek@google.com> Allow matchers to access the ASTContext.

Patch by Edwin Vane.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169000 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchersInternal.h
11c98771ba5d7fb1ec5707f9e1c77a6cf65bbc59 11-Nov-2012 Daniel Jasper <djasper@google.com> Fix binding of nodes in case of forEach..() matchers.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167695 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchersInternal.h
e579328ec9a95acc7f181e04c58a747ba001d80f 02-Nov-2012 Manuel Klimek <klimek@google.com> Insert interception point onStartOfTranslationUnit.

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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167271 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchFinder.h
d1ce3c178b9c648687591b190e0d252124fc2459 30-Oct-2012 Daniel Jasper <djasper@google.com> Implement descendant matchers for NestedNamespecifiers

This implements has(), hasDescendant(), forEach() and
forEachDescendant() for NestedNameSpecifier and NestedNameSpecifierLoc
matchers.

Review: http://llvm-reviews.chandlerc.com/D86

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167017 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchersInternal.h
a267cf6f87dc695143d65fc61ec1744564f55932 29-Oct-2012 Daniel Jasper <djasper@google.com> Implement has(), hasDescendant(), forEach() and forEachDescendant() for
Types, QualTypes and TypeLocs.

Review: http://llvm-reviews.chandlerc.com/D83

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166917 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
STMatchersInternal.h
STTypeTraits.h
3e2aa99e992b89bd421ac2a6bf79307114d257fc 24-Oct-2012 Manuel Klimek <klimek@google.com> Adds the possibility to run ASTMatchFinder over arbitrary AST nodes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166567 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchFinder.h
c711af2ddbbb1d46223cc9379d32a203fb5bc7f4 23-Oct-2012 Daniel Jasper <djasper@google.com> Make hasDeclaration() matcher work inside the memberExpr() matcher.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166479 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
STMatchersInternal.h
70b9db9879c1cb8b8ca7d6c9809e35361cab83dc 23-Oct-2012 Manuel Klimek <klimek@google.com> Implements the thisExpr matcher.
Patch by Gabor Horvath.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166477 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
c99a3ad8c2bf29da45a0c64b88d58bfbd2f78ef2 22-Oct-2012 Daniel Jasper <djasper@google.com> Implement hasParent()-matcher.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166421 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
STMatchersInternal.h
a1a4c0385a0fd458243d9e357e1eceb137f29abf 19-Oct-2012 Nick Lewycky <nicholas@mxc.ca> Fix typo in comment.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166253 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
ce62007526cdf718faed10df5e9fc7c3cd160cde 17-Oct-2012 Daniel Jasper <djasper@google.com> First version of matchers for Types and TypeLocs.

Review: http://llvm-reviews.chandlerc.com/D47

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166094 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchFinder.h
STMatchers.h
STMatchersInternal.h
STMatchersMacros.h
STTypeTraits.h
31f7c08a0d2b140bf31a08894d1948649de53c15 01-Oct-2012 Daniel Jasper <djasper@google.com> Add matchers for selected C++11 features.

Patch by Gábor Horváth.
Review: http://llvm-reviews.chandlerc.com/D46

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164943 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
aaa8e45b8e392a1f1b7498e2f00c6ed66d41119a 29-Sep-2012 Daniel Jasper <djasper@google.com> Fix refersToDeclaration()-matcher and add missing test case. This was
broken as of r164656 as TemplateArgument::getAsDecl() now asserts
instead of returning NULL for other template arugment kinds.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164896 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
9158a5624154bc43bbbf059c07a2f7b2cd45c1a1 25-Sep-2012 Alexander Kornienko <alexfh@google.com> A minor doc fix.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164601 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
b54b7646b2d00a85d80e40adf7c49553f150c736 20-Sep-2012 Daniel Jasper <djasper@google.com> Add some matchers for basic AST nodes.

Patch by Gábor Horváth.
Review: http://llvm-reviews.chandlerc.com/D45

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164304 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
STMatchersInternal.h
b3278162bd6d34783607d4bfe8814df73e8ef8c1 20-Sep-2012 Daniel Jasper <djasper@google.com> Provide better error messages for incorrect matchers.

By changing the conversion operator into a conversion constructor, we
can enabled based on the template parameters leading to better error
messages. E.g.: stmt(decl()) will now create an error message including:

note: candidate function not viable: no known conversion from
'clang::ast_matchers::internal::BindableMatcher<clang::Decl>' to 'const
clang::ast_matchers::internal::Matcher<clang::Stmt>' for 1st argument

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164298 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchersInternal.h
e6d2a96cc9689be584c3bfc09ac527a03a25b3bc 18-Sep-2012 Daniel Jasper <djasper@google.com> Add missing matcher for C-style cast expressions.

Patch by Gábor Horváth.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164123 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
3680b4f7494b6744b9c5a25f83b63cd8b7e434fc 18-Sep-2012 Daniel Jasper <djasper@google.com> Make all VariadicDynCast-Expr-matchers StatementMatchers

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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164121 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
f56faa01936b9cf909623d7f06e3c2569ca4a78e 15-Sep-2012 Dmitri Gribenko <gribozavr@gmail.com> Use LLVM_DELETED_FUNCTION in place of 'DO NOT IMPLEMENT' comments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163983 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchersInternal.h
760402327bd688bb477b1d8084e34be81db5baf0 13-Sep-2012 NAKAMURA Takumi <geek4civic@gmail.com> ASTMatchersMacros.h: Appease msvc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163798 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchersMacros.h
a7564433191601cb8851196b8dde39392c9c05ee 13-Sep-2012 Daniel Jasper <djasper@google.com> Create initial support for matching and binding NestedNameSpecifier(Loc)s.

Review: http://llvm-reviews.chandlerc.com/D39

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163794 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchFinder.h
STMatchers.h
STMatchersInternal.h
STMatchersMacros.h
STTypeTraits.h
63d88728d862f8a69b3291e533d193d1d8513f5a 12-Sep-2012 Daniel Jasper <djasper@google.com> Rename isA to isSameOrDerivedFrom.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163740 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
76dafa7e6487c0b51fadebd16bdefe0e0e23d595 07-Sep-2012 Daniel Jasper <djasper@google.com> Change the behavior of the isDerivedFrom-matcher to not match on the
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163385 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
579b120038ca817e0ce423303ebc1b4e0c6cbbe1 07-Sep-2012 Manuel Klimek <klimek@google.com> Implements hasAncestor.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163382 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
STMatchersInternal.h
a78d0d6203a990b88c9c3e4c4f2a277001e8bd46 05-Sep-2012 Manuel Klimek <klimek@google.com> Introduces DynTypedMatcher as a new concept that replaces the 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163212 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchFinder.h
STMatchers.h
STMatchersInternal.h
STTypeTraits.h
66341c596f93d0c6475d839db94072b8ebd1cf5b 30-Aug-2012 Manuel Klimek <klimek@google.com> Fixes a bug for binding memoized match results.

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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162936 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
STMatchersInternal.h
STTypeTraits.h
ec2a396c6f11b4017e30f1865f7b62c5a42425b8 29-Aug-2012 Manuel Klimek <klimek@google.com> Modifes BoundNodes to store void* and allow casting them
into the correct types when pulling them out in the result
callback in a type safe way.

This is also the base change for multiple things that will
allow handling things more generally and thus supporting more
of the AST, especially handling Type nodes.

Patch contributed by Michael Diamond.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162804 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
STMatchersInternal.h
e16acd3817e501ee2bcf5f631b6911021fa88ba7 25-Aug-2012 Sam Panzer <espanz@gmail.com> New matcher for MaterializeTemporaryExpr

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162609 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
2dc75ed2ef2fa3cbfd8b2ed88eb2369f3fcd98a9 24-Aug-2012 Daniel Jasper <djasper@google.com> Rename the ASTMatchers to better match AST nodes. Now, all
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162536 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
e50ee7e513c0707302bd8e2a78befc318a7d593c 20-Aug-2012 Dmitri Gribenko <gribozavr@gmail.com> Use correct matcher name in the comment.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162206 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
25466496a2ace2aa533abc7bac1e92a4f425e2b1 20-Aug-2012 Manuel Klimek <klimek@google.com> Fix comments and variable naming:
- use InnerMatcher consistently, fix style violations on the way
- doxygenify code snippets across all comments
- start doxygenifying code references in text
- addeed missing Usable as: sections



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162205 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
217c484522926f9fc664ec3bfaf3cffe456244b0 18-Aug-2012 Benjamin Kramer <benny.kra@googlemail.com> Silence a sign compare warning that only occurs on 32 bit platforms.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162168 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
8456ae602783b615019a42f7d5c6f0e71639b11b 17-Aug-2012 Dmitri Gribenko <gribozavr@gmail.com> AST Matchers: introduce functionTemplate(), classTemplate() and
isExplicitTemplateSpecialization() matchers which do what their name says.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162115 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
STMatchersInternal.h
425f41b370a8795fbca9ffc3b35e9b0ccbb15d97 16-Aug-2012 Sam Panzer <espanz@gmail.com> Matchers related to DeclStmt for matching the count of declarations, a particular declaration within the statement, and single-Decl DeclStmts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162027 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
089e5b3bf2e57da0173b170ad501867b43395385 16-Aug-2012 Sam Panzer <espanz@gmail.com> Matchers which correspond to CastExpr, IgnoreImpCasts, IgnoreParenCasts, and IgnoreParenImpCasts

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162025 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
8cc7efa2da2c6be43cbd3d09a9ae01353bb921d2 15-Aug-2012 Daniel Jasper <djasper@google.com> Add ASTMatcher for matching extern "C" function declarations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161974 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
297f71daa4eec8beb2eb29573e0892539f8e7172 31-Jul-2012 Manuel Klimek <klimek@google.com> Document the result type of the matcher functions where
it's not obvious from the source code.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161035 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
715c9568ee5d75f25dab98229c87bcec880daf5d 25-Jul-2012 Manuel Klimek <klimek@google.com> Introduces the 'decl' matcher which was missing for a while
and became necessary with the change to require BindableMatchers
for binding.

Also fixes PR 13445: "hasSourceExpression only works for implicit casts".



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160716 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
9f17408d50c1d76c5eab435e4ceb924cc10757ab 24-Jul-2012 Manuel Klimek <klimek@google.com> Introduces a new concept for binding results to matchers
as per Chandler's request:
- introduces a new matcher base type BindableMatcher that
provides the bind() call
- makes all dynamic-cast matcher creation functions return
BindableMatchers; the special case about dynamic-cast
matchers is that the node they match on and the node
their child matchers match on are the same node, just
casted to a different type; thus, there is no ambiguity
on what bind() matches on; additionally, those are the
matchers that we name with nouns in the matcher language,
so it's easy for users to intuitively know which matchers
are bindable

To make this change possible, we got rid of a non-orthogonal
implementation of thisPointerType, which had an implicit
dynamic-cast matcher from CallExpr to CXXMemberCallExpr; as
alternative, we now provide a memberCall dynamic-cast matcher
and thisPointerType is a predicate on CXXMemberCallExpr.

Last, the ArgumentAdaptingMatcher is actually not required
for the implementation of makeDynCastAllOfComposite - this
simplification makes it more obvious where the bind() call
can be used based on the matcher creation function types.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160673 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
STMatchersInternal.h
d5c66dd664b005866c9f7fc91eb0d49164bca36f 17-Jul-2012 Daniel Jasper <djasper@google.com> Move RefactoringCallbacks to Tooling to avoid dependency from
ASTMatchers (lower level abstraction) to Tooling (higher level
abstraction).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160351 91177308-0d34-0410-b5e6-96231b3b80d8
efactoringCallbacks.h
20b802d186dfc5db9b4a9ce83e9f31fa5aa4efcc 17-Jul-2012 Daniel Jasper <djasper@google.com> Make the isDerivedFrom matcher more generic.

It now accepts an arbitrary inner matcher but is fully backwards
compatible.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160348 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
STMatchersInternal.h
fe7beeb421b90f66b4a96c2358c5a838c376a0a8 16-Jul-2012 Daniel Jasper <djasper@google.com> Add refactoring callbacks to make common kinds of refactorings easy.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160255 91177308-0d34-0410-b5e6-96231b3b80d8
efactoringCallbacks.h
ff2fcb8db242a54f72bbb4e5595261e12672ed66 15-Jul-2012 Daniel Jasper <djasper@google.com> Fix spelling of anyOf matcher and add missing test.

Patch by Sam Panzer!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160233 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
6a12449ec8862211856447d3df4c082a346339f2 12-Jul-2012 Daniel Jasper <djasper@google.com> This commit combines three patches to the ASTMatchers.

One adds matchers for the various parts of a for loop (initializer, condition,
increment), as well as extending the hasBody matcher to work for while and
do-while loops. The second patch adds an isInteger matcher for types.
The third patch fixes a bug in allOf, where a few of the name chages
(AllOf --> allOf) had been missed.

All matchers come with unit tests.

Patches by Sam Panzer!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160115 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
2db5abb43b7a7fce4771063f6a5de561780c1335 11-Jul-2012 Daniel Jasper <djasper@google.com> Move CompileAssert into namespace clang::ast_matchers:: to avoid naming
collisions until it is properly integrated in llvm/Support.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160063 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchersInternal.h
e0e6b9e79a0c4edae92abd3928263875c78e23aa 10-Jul-2012 Daniel Jasper <djasper@google.com> Add more matchers and do cleanups.

Reviewers: klimek

Differential Revision: http://ec2-50-18-127-156.us-west-1.compute.amazonaws.com/D2

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160013 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchers.h
STMatchersInternal.h
4da216637fa1ad4bdfd31bc265edb57ca35c2c12 06-Jul-2012 Manuel Klimek <klimek@google.com> Adds the AST Matcher library, which provides a in-C++ DSL to express
matches on interesting parts of the AST, and callback mechanisms to
act on them.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159805 91177308-0d34-0410-b5e6-96231b3b80d8
STMatchFinder.h
STMatchers.h
STMatchersInternal.h
STMatchersMacros.h