summaryrefslogtreecommitdiffstats
path: root/include/clang/ASTMatchers
Commit message (Collapse)AuthorAgeFilesLines
* [ASTMatchers] Fix some Clang-tidy modernize and Include What You Use ↵Eugene Zelenko2017-11-014-97/+165
| | | | | | warnings; other minor fixes (NFC). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@317137 91177308-0d34-0410-b5e6-96231b3b80d8
* Add objcCategoryImplDecl matcherDave Lee2017-10-261-0/+11
| | | | | | | | | | | | | | | | | Summary: Add `objcCategoryImplDecl` which matches ObjC category definitions (`@implementation`). This matcher complements `objcCategoryDecl` (`@interface`) which was added in D30854. Reviewers: aaron.ballman, malcolm.parsons, alexshap Reviewed By: aaron.ballman Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D39293 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316670 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang] Fix isExternC matcher docsAlexander Shaposhnikov2017-09-221-2/+7
| | | | | | | | | | | | The wording in the documentation for the matcher isExternC appears to be misleading since this matcher is applicable to functions and variables as well. This diff changes the comment and regenerates the html file. Differential revision: https://reviews.llvm.org/D38151 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314022 91177308-0d34-0410-b5e6-96231b3b80d8
* Add objcImplementationDecl matcherDave Lee2017-09-101-0/+11
| | | | | | | | | | | | | | | | | | | | | Summary: Add the `objcImplementationDecl` matcher. See related: D30854 Tested with: ``` ./tools/clang/unittests/ASTMatchers/ASTMatchersTests ``` Reviewers: aaron.ballman, compnerd, alexshap Reviewed By: aaron.ballman Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D37643 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@312889 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix typos, remove unused private members of CommonOptionsParser, NFCJohannes Altmanninger2017-08-231-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311544 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatcher] Add handling for DeducedType to HasDeclarationMatcherFlorian Gross2017-08-041-9/+19
| | | | | | | | | | | | | | | | | HasDeclarationMatcher did not handle DeducedType, it always returned false for deduced types. So with code like this: struct X{}; auto x = X{}; This did no longer match: varDecl(hasType(recordDecl(hasName("X")))) Because HasDeclarationMatcher didn't resolve the DeducedType of x. Differential Revision: https://reviews.llvm.org/D36308 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310095 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix typo and update documentation.Manuel Klimek2017-08-041-3/+16
| | | | | | The hasDeclaration documentation was outdated after r288366. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310041 91177308-0d34-0410-b5e6-96231b3b80d8
* Unify and simplify the behavior of the hasDeclaration matcher.Manuel Klimek2017-08-022-36/+113
| | | | | | | | | | | | | | | | | | | | | | | | | Originally, we weren't able to match on Type nodes themselves (only QualType), so the hasDeclaration matcher was initially written to give what we thought are reasonable results for QualType matches. When we chagned the matchers to allow matching on Type nodes, it turned out that the hasDeclaration matcher was by chance written templated enough to now allow hasDeclaration to also match on (some) Type nodes. This patch change the hasDeclaration matcher to: a) work the same on Type and QualType nodes, b) be completely explicit about what nodes we can match instead of just allowing anything with a getDecl() to match, c) explicitly control desugaring only one level in very specific instances. d) adds hasSpecializedTemplate and tagType matchers to allow migrating existing use cases that now need more explicit matchers Note: This patch breaks clang-tools-extra. The corresponding patch there is approved and will land in a subsequent patch. Differential Revision: https://reviews.llvm.org/D27104 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@309809 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatchers] Allow forField to match indirect fields.Malcolm Parsons2017-08-011-1/+1
| | | | | | | | This is needed for PR32966. Reviewed by alexfh. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@309667 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatchers][NFC] integerLiteral(): Mention negative integers inClement Courbet2017-07-111-0/+8
| | | | | | | | | | | | | | documentation. Trying to match integerLiteral(-1) will silently fail, because an numeric literal is always positive. - Update the documentation to explain how to match negative numeric literals. - Add a unit test. Differential Revision: https://reviews.llvm.org/D35196 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307663 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatchers] Add clang-query support for equals matcherPeter Wu2017-06-081-4/+40
| | | | | | | | | | | | | Summary: This allows the clang-query tool to use matchers like "integerLiteral(equals(32))". For this to work, an overloaded function is added for each possible parameter type. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D33094 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@305022 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatchers] Add support for floatLiteralsPeter Wu2017-06-083-2/+13
| | | | | | | | | | | | | Summary: Needed to support something like "floatLiteral(equals(1.0))". The parser for floating point numbers is kept simple, so instead of ".1" you have to use "0.1". Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D33135 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@305021 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatchers] Add support for boolean literalsPeter Wu2017-06-082-1/+15
| | | | | | | | | | | | | Summary: Recognize boolean literals for future extensions ("equals(true)"). Note that a specific VariantValue constructor is added to resolve ambiguity (like "Value = 5") between unsigned and bool. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D33093 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@305020 91177308-0d34-0410-b5e6-96231b3b80d8
* Add cxxStdInitializerListExpr AST matcherJakub Kuderski2017-05-051-0/+14
| | | | | | | | | | | | | | | | | Summary: This adds a new ASTMatcher for CXXStdInitializerListExprs that matches C++ initializer list expressions. The primary motivation is to use it to fix [[ https://bugs.llvm.org/show_bug.cgi?id=32896 | PR32896 ]] (review here [[ https://reviews.llvm.org/D32767 | D32767 ]]). Reviewers: alexfh, Prazek, aaron.ballman Reviewed By: alexfh, aaron.ballman Subscribers: malcolm.parsons, cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D32810 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302287 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix typo in comment.Nick Lewycky2017-04-231-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301138 91177308-0d34-0410-b5e6-96231b3b80d8
* Spelling mistakes in comments. NFCI. (PR27635)Simon Pilgrim2017-03-302-5/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299083 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatchers] add typeAliasTemplateDecl matcher.Eric Liu2017-03-281-0/+10
| | | | | | | | | | | | Reviewers: hokein, aaron.ballman Reviewed By: aaron.ballman Subscribers: aaron.ballman, cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D28671 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298912 91177308-0d34-0410-b5e6-96231b3b80d8
* Add AST matchers for ObjCProtocolDecl, ObjCCategoryDecl, ObjCMethodDecl, ↵Aaron Ballman2017-03-151-0/+63
| | | | | | | | ObjCIvarDecl, and ObjCPropertyDecl. Patch by Dave Lee. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297882 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r293518 as it caused module linking error in clang-reorder-fieldsAlex Lorenz2017-02-011-3/+3
| | | | | | | | | This commit reverts "r293518 - [ASTMatchers] Sprinkle some constexpr on the global matcher constructors" because after it a buildbot that builds clang stage 2 with modules failed to link clang-reorder-fields. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293759 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatchers] Sprinkle some constexpr on the global matcher constructors.Benjamin Kramer2017-01-301-3/+3
| | | | | | | This dramatically reduces the size of the global constructors we emit for those variables in debug mode. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293518 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix documentation typo.Malcolm Parsons2017-01-201-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@292595 91177308-0d34-0410-b5e6-96231b3b80d8
* Move VariantMatcher's Payload to std::shared_ptr rather than IntrusiveRefCntPtrDavid Blaikie2017-01-051-3/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@291156 91177308-0d34-0410-b5e6-96231b3b80d8
* [ADT] Delete RefCountedBaseVPTR.Justin Lebar2016-12-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This class is unnecessary. Its comment indicated that it was a compile error to allocate an instance of a class that inherits from RefCountedBaseVPTR on the stack. This may have been true at one point, but it's not today. Moreover you really do not want to allocate *any* refcounted object on the stack, vptrs or not, so if we did have a way to prevent these objects from being stack-allocated, we'd want to apply it to regular RefCountedBase too, obviating the need for a separate RefCountedBaseVPTR class. It seems that the main way RefCountedBaseVPTR provides safety is by making its subclass's destructor virtual. This may have been helpful at one point, but these days clang will emit an error if you define a class with virtual functions that inherits from RefCountedBase but doesn't have a virtual destructor. Reviewers: compnerd, dblaikie Subscribers: cfe-commits, klimek, llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D28162 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@290717 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatchers] Add hasInClassInitializer traversal matcher for FieldDecl.Malcolm Parsons2016-12-241-0/+21
| | | | | | | | | | | | | | | Summary: I needed to know whether a FieldDecl had an in-class initializer for D26453. I used a narrowing matcher there, but a traversal matcher might be generally useful. Reviewers: sbenza, bkramer, klimek, aaron.ballman Subscribers: aaron.ballman, Prazek, cfe-commits Differential Revision: https://reviews.llvm.org/D28034 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@290492 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatchers] Fix doc for hasBitWidthMalcolm Parsons2016-12-241-2/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@290491 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace APFloatBase static fltSemantics data members with getter functionsStephan Bergmann2016-12-141-4/+4
| | | | | | | | | | | | | At least the plugin used by the LibreOffice build (<https://wiki.documentfoundation.org/Development/Clang_plugins>) indirectly uses those members (through inline functions in LLVM/Clang include files in turn using them), but they are not exported by utils/extract_symbols.py on Windows, and accessing data across DLL/EXE boundaries on Windows is generally problematic. Differential Revision: https://reviews.llvm.org/D26671 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289647 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove deprecated methods ast_matchers::BoundNodes::{getStmtAs,getDeclAs}Alexander Kornienko2016-12-131-12/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289543 91177308-0d34-0410-b5e6-96231b3b80d8
* [AST, ASTMatchers, Basic] Fix some Clang-tidy modernize and Include What You ↵Eugene Zelenko2016-12-092-17/+20
| | | | | | Use warnings; other minor fixes (NFC). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289160 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatcher] Add hasReplacementType matcher for SubstTemplateTypeParmTypeMalcolm Parsons2016-12-081-0/+16
| | | | | | | | | | | | Summary: Needed for https://reviews.llvm.org/D27166 Reviewers: sbenza, bkramer, klimek Subscribers: aemerson, cfe-commits Differential Revision: https://reviews.llvm.org/D27447 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289042 91177308-0d34-0410-b5e6-96231b3b80d8
* Adds hasUnqualifiedDesugaredType to allow matching through type sugar.Manuel Klimek2016-12-011-0/+16
| | | | | | Differential Revision: https://reviews.llvm.org/D27207 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@288366 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatchers] Fix a typo in cStyleCastExpr() docs. NFC.Artem Dergachev2016-11-111-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@286628 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatcher] Add CXXNewExpr support to hasDeclarationMalcolm Parsons2016-10-312-9/+19
| | | | | | | | | | Reviewers: sbenza, lukasza, aaron.ballman, klimek Subscribers: lukasza, sbenza, cfe-commits Differential Revision: https://reviews.llvm.org/D26032 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@285644 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatcher] Clarify isStaticStorageClass and hasStaticStorageDuration ↵Haojian Wu2016-09-271-4/+10
| | | | | | | | | | | | documents. Reviewers: aaron.ballman Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D24928 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@282474 91177308-0d34-0410-b5e6-96231b3b80d8
* Complete support for the cxxCtorInitializer() AST matcher so that it can be ↵Aaron Ballman2016-09-262-0/+4
| | | | | | used as a top-level matcher. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@282417 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatcher] Add isStaticStorageClass matcher for varDecl and functionDecl.Haojian Wu2016-09-261-0/+18
| | | | | | | | | | Reviewers: klimek Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D24821 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@282415 91177308-0d34-0410-b5e6-96231b3b80d8
* Correct the documentation for isSignedInteger() and isUnsignedInteger().Aaron Ballman2016-08-181-2/+2
| | | | | | Patch by Visoiu Mistrih Francis git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@279055 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an AST matcher for external formal linkage.Aaron Ballman2016-08-171-0/+24
| | | | | | Patch by Visoiu Mistrih git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@278926 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatchers] Extend documentation for match()Martin Bohme2016-08-101-0/+4
| | | | | | | Summary: Adds an explanation of how to use findAll() to find all matches in a subtree. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@278213 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatchers] Add matchers canReferToDecl() and hasUnderlyingDecl()Martin Bohme2016-08-091-0/+40
| | | | | | | | | | | | Summary: Required for D22220 Reviewers: sbenza, klimek, aaron.ballman, alexfh Subscribers: alexfh, klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D23004 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@278123 91177308-0d34-0410-b5e6-96231b3b80d8
* Make isExternC work on VarDecls too.Benjamin Kramer2016-08-041-1/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@277712 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a typo in document.Haojian Wu2016-07-291-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@277174 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatcher] Add templateName matcher.Haojian Wu2016-07-291-0/+29
| | | | | | | | | | Reviewers: klimek Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D22963 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@277155 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatcher] Add hasTemplateArgument/hasAnyTemplateArgument support in ↵Haojian Wu2016-07-292-6/+30
| | | | | | | | | | | | functionDecl. Reviewers: klimek Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D22957 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@277142 91177308-0d34-0410-b5e6-96231b3b80d8
* [NFC] Header cleanupMehdi Amini2016-07-182-2/+0
| | | | | | | | | | Summary: Removed unused headers, replaced some headers with forward class declarations Patch by: Eugene <claprix@yandex.ru> Differential Revision: https://reviews.llvm.org/D20100 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@275882 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatchers] isSignedInteger() and isUnsignedInteger()Clement Courbet2016-07-121-0/+28
| | | | | | | | | Complementary to isInteger(), these match signed and unsigned integers respectively. Review: http://reviews.llvm.org/D21989 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@275157 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatchers] Add missing forEachArgumentWithParam() to code sampleAlexander Kornienko2016-07-081-2/+5
| | | | | | | | | | | | | Reviewers: klimek Subscribers: cfe-commits, klimek Patch by Martin Boehme! Differential Revision: http://reviews.llvm.org/D21799 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@274835 91177308-0d34-0410-b5e6-96231b3b80d8
* Add AST matchers for handling bit-fields and narrowing based on their width.Aaron Ballman2016-07-061-0/+32
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@274652 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatchers] New forEachOverriden matcher.Clement Courbet2016-07-051-0/+41
| | | | | | Matches methods overridden by the given method. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@274531 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatcher] Add a node matcher for EnumType.Haojian Wu2016-06-301-0/+15
| | | | | | | | | | Reviewers: aaron.ballman Subscribers: cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D21860 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@274217 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatchers] Add isLambda() matcher.Samuel Benzaquen2016-06-281-0/+13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@274015 91177308-0d34-0410-b5e6-96231b3b80d8