Commit Graph

91 Commits

Author SHA1 Message Date
Aaron Ballman 005df9362e Add an AST matcher for real floating-point types. e.g., float, double, long double, but not complex.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261221 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-18 16:36:01 +00:00
Aaron Ballman 3f8756990c Add a nullPointerConstant() AST matcher to handle variations of null pointer constants in one matcher.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261008 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-16 21:02:23 +00:00
Aaron Ballman 31c95759cb Reapply r259210 with a fix for RegistryTest.cpp.
Patch by Richard Thomson.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@259359 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-01 14:11:47 +00:00
Hans Wennborg 433204fddc Revert r259210 "Extend hasType narrowing matcher for TypedefDecls, add functionProtoType matcher for FunctionProtoType nodes, extend parameterCountIs to FunctionProtoType nodes."
It didn't pass check-clang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@259218 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-29 18:24:34 +00:00
Aaron Ballman fd056b6d07 Extend hasType narrowing matcher for TypedefDecls, add functionProtoType matcher for FunctionProtoType nodes, extend parameterCountIs to FunctionProtoType nodes.
Patch by Richard Thomson

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@259210 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-29 17:03:11 +00:00
Aaron Ballman 817e45ed3b Improving documentation for the isMoveAssignmentOperator AST matcher.
Patch by Jonathan Coe.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258628 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-23 17:49:18 +00:00
Aaron Ballman 4eb7bf8669 Properly encode the < entity; it was missing the semicolon. Regenerating the AST matcher reference after fixing the issue. Thanks to Richard for noticing the issue and bringing it to my attention!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258579 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-22 23:15:00 +00:00
Aaron Ballman a5cde4ff1b Add am AST matcher for isMoveAssignmentOperator.
Patch by Jonathan Coe.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258573 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-22 22:37:09 +00:00
Nico Weber 9f3e3d5de8 Add an isVirtualAsWritten AST matcher.
http://reviews.llvm.org/D16394


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258415 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-21 17:56:24 +00:00
Aaron Ballman 49a5928400 When dumping documentation for AST matchers, do something more useful with \see doxygen commands. Ideally this would link to the target of \see, but for now it translates \see into "See also: "
Regenerate the AST documentation for this new functionality.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258401 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-21 15:18:25 +00:00
Aaron Ballman bd6321c036 Add AST matcher support for FunctionDecls with the hasBody matcher.
Patch by Aleksei Sidorin.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258322 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-20 16:26:48 +00:00
Aaron Ballman 649afe2db6 Add AST matcher for paren expressions.
Patch by Adrian Zgorzałek.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258321 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-20 16:17:39 +00:00
Aaron Ballman 0003ec16f3 Add an AST matcher for checking whether a function is defaulted.
Patch by Jonathan Coe.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258072 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-18 20:37:44 +00:00
Aaron Ballman f58f101d18 Augments r258042; changes the AST matcher tests to use matchesNot and EXPECT_TRUE instead of EXPECT_FALSE. Adds a matcher test to ensure that static member functions are properly handled. Generates the documentation from the matcher.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258070 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-18 20:28:57 +00:00
Samuel Benzaquen a2f288bcf1 [ASTMatchers] Fix typo in booleanType() doc.
Fix typo in booleanType() doc and recreate the
LibASTMatchersReference.html reference document.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@256284 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-22 21:06:36 +00:00
Aaron Ballman b5478a7e86 Add a narrowing AST matcher that matches on a FunctionDecl with a non-throwing exception specification.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@254516 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-02 15:23:59 +00:00
Aaron Ballman fc33c2db15 Add an AST matcher for narrowing when a type is volatile-qualified.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253882 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-23 17:09:24 +00:00
Benjamin Kramer 1a52114f4d Regenerate ASTMatchersReference without CRLF.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253654 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-20 07:57:46 +00:00
Benjamin Kramer 8180a1c712 Fix ASTMatcher reference newlines and make the generator script windows-proof.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253653 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-20 07:46:19 +00:00
Aaron Ballman 64ba2ebce0 Re-committing r253473 after hopefully fixing the bot breakage. There was a copy-pasta issue that my local testing did not catch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253481 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-18 17:56:55 +00:00
Aaron Ballman f5ba677028 Reverting r253473 while I investigate build bot failures.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253475 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-18 17:16:01 +00:00
Aaron Ballman 9e9a205afb Adding AST matchers for VarDecl storage durations. Can now determine whether a VarDecl has automatic, static, or thread storage duration. This also updates the documentation for matchers, which appear to be missing some previous additions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253473 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-18 17:05:39 +00:00
Eric Fiselier 6af718e79b Add an AST node matcher for TemplateTypeParmDecl objects.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250602 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-17 02:34:44 +00:00
Matthias Gehre 135d049ab2 Add decayedType and hasDecayedType AST matchers
Summary: Add decayedType and hasDecayedType AST matchers

Reviewers: klimek

Subscribers: klimek, cfe-commits

Differential Revision: http://reviews.llvm.org/D13639

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250114 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-12 21:46:07 +00:00
Aaron Ballman 9fc9d8db3d Adding an AST node matcher for NonTypeTemplateParmDecl objects.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249341 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-05 19:44:42 +00:00
Aaron Ballman 1082a41a51 Adding a narrowing AST matcher for FunctionDecl::isVariadic(), plus tests and documentation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249321 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-05 14:41:27 +00:00
Aaron Ballman 5d6b9bd99d Rename AST node matchers to match the AST node names directly. Part of this rename also splits recordDecl() (which used to match CXXRecordDecl) into recordDecl() (that matches RecordDecl) and cxxRecordDecl (that matches CXXRecordDecl). Also adds isStruct(), isUnion(), and isClass() narrowing matchers for RecordDecl objects.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247885 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-17 13:30:52 +00:00
Aaron Ballman 9912604fc7 Fixed HasDeclarationMatcher to properly convert all types into decls where possible. Added objcObjectPointerType(), objcInterfaceDecl(), templateTypeParmType(), injectedClassNameType(), and unresolvedUsingTypenameDecl(). Updated documentation for pointerType() to call out that it does not match ObjCObjectPointerType types. Changed pointsTo() to handle ObjCObjectPointerType as well as PointerType.
While this may seem like a lot of unrelated changes, they all relate back to fixing HasDeclarationMatcher.

This now allows us to write a matcher like:

varDecl(hasType(namedDecl(hasName("Foo"))))

that matches code using typedefs, objc interfaces, template type parameters, injected class names, or unresolved using typenames.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247404 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 11:51:24 +00:00
Aaron Ballman 6223b3f989 Updating the AST matcher documentation with a new entry; NFC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246324 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-28 19:39:56 +00:00
Aaron Ballman e80122dbc3 Adding an AST matcher for namespaceAliasDecl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246322 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-28 19:39:21 +00:00
Aaron Ballman 67775378ed Add AST narrowing matchers for inline and anonymous namespaces. Since the inline keyword can also be specified on a FunctionDecl, this is a polymorphic matcher.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245337 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-18 19:55:20 +00:00
Manuel Klimek ee3c24fa92 Fix AST matcher documentation.
Fix a bug in the matcher docs where callExpr(on(...)) was in the examples,
but didn't work (on() only works for memberCallExpr).

Fix a bug in the doc dump script that was introduced in r231575 when
removing a regexp capture without adapting the code that uses the
captures.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245040 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 11:47:51 +00:00
Aaron Ballman eb92309f04 Add missing documentation for conversionDecl; NFC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@244669 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-11 21:12:46 +00:00
Aaron Ballman ea8e04cc0d Add a polymorphic AST matcher for testing whether a constructor or a conversion declaration is marked as explicit or not.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@244666 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-11 21:09:52 +00:00
Aaron Ballman 2356ddbded Add an AST matcher to match member intializers of a CXXCtorInitializer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@244662 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-11 20:42:00 +00:00
Aaron Ballman ee3af39c91 Add AST matchers for narrowing constructors that are default, copy, or move constructors, as well as functionality to determine whether a ctor initializer is a base initializer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@244036 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-05 12:11:30 +00:00
Aaron Ballman 5fc313fcdc Add an AST matcher, isFinal(), for testing whether a method or class declaration are marked final.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243107 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-24 12:35:41 +00:00
Aaron Ballman 8103d305d8 Updating the documentation for the hasAttr AST matcher, which behaves somewhat differently when used within clang-query. Fixes PR24217.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243029 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-23 17:54:59 +00:00
Aaron Ballman c9afbb4aaa Something was unbalanced, and it wasn't the parentheses. ;-) Reverts r242915.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242927 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-22 20:02:00 +00:00
Aaron Ballman fa1bcdbeeb Balancing parenthesis in comments and documentation; NFC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242915 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-22 17:51:42 +00:00
Aaron Ballman 19eed2939e Add the ability to AST match a variable declaration that is an exception variable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242303 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-15 17:11:21 +00:00
Aaron Ballman a8245d8fe2 Implement an AST matcher for C++ exception catch handlers that can catch any exception type (...).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241256 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-02 12:53:22 +00:00
Samuel Benzaquen 796ff0980f Add translationUnitDecl matcher.
Summary: Add translationUnitDecl matcher.

Reviewers: alexfh

Subscribers: klimek, cfe-commits

Differential Revision: http://reviews.llvm.org/D7512

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@228694 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-10 14:46:45 +00:00
Manuel Klimek b3cf7e2fbf Re-apply r222646 (was reverted in r222667). Adding 4 ASTMatchers: typedefDecl, isInMainFile, isInSystemFile, isInFileMatchingName
Change to original: ifndef out tests in Windows due to /-separated
paths.

Summary:
Often one is only interested in matches within the main-file or matches
that are not within a system-header, for which this patch adds
isInMainFile and isInSystemFile. They take no arguments and narrow down
the matches.

The isInFileMatchingName is mainly thought for interactive
clang-query-sessions, to make a matcher more specific without restarting
the session with the files you are interested in for that moment. It
takes a string that will be used as regular-expression to match the
filename of where the matched node is expanded.

Patch by Hendrik von Prince.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@222765 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-25 17:01:06 +00:00
Aaron Ballman 14951ec707 Reverting r222646; the tests do not pass on Windows. Also reverts r222664, which was required for r222646 to compile with Visual Studio 2012.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@222667 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-24 17:39:44 +00:00
Manuel Klimek c07700ac27 Adding 4 ASTMatchers: typedefDecl, isInMainFile, isInSystemFile, isInFileMatchingName
Summary:
Often one is only interested in matches within the main-file or matches
that are not within a system-header, for which this patch adds
isInMainFile and isInSystemFile. They take no arguments and narrow down
the matches.

The isInFileMatchingName is mainly thought for interactive
clang-query-sessions, to make a matcher more specific without restarting
the session with the files you are interested in for that moment. It
takes a string that will be used as regular-expression to match the
filename of where the matched node is expanded.

Patch by Hendrik von Prince.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@222646 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-24 09:10:56 +00:00
Manuel Klimek bcdf6054e5 Implement various matchers around template argument handling.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219408 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-09 13:06:22 +00:00
Manuel Klimek 057305f685 Add matcher for linkage specification
Patch by Jacques Pienaar.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217135 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-04 08:51:06 +00:00
Manuel Klimek ccbd7aeb11 Add hasAttr matcher for declarations.
Delete special-case CUDA attribute matchers.

Patch by Jacques Pienaar.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216379 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-25 11:23:50 +00:00
Samuel Benzaquen 35211d0afd Add isDeleted() matcher for FunctionDecl nodes.
Reviewers: klimek

Subscribers: klimek, cfe-commits

Differential Revision: http://reviews.llvm.org/D4911

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@215714 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-15 14:20:59 +00:00