summaryrefslogtreecommitdiffstats
path: root/lib/ASTMatchers
Commit message (Collapse)AuthorAgeFilesLines
* [ASTMatchers] Fix use after free.Benjamin Kramer2017-06-091-1/+2
| | | | | | Found by asan. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@305094 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatchers] Add clang-query support for equals matcherPeter Wu2017-06-081-9/+19
| | | | | | | | | | | | | 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-084-15/+81
| | | | | | | | | | | | | 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-083-2/+52
| | | | | | | | | | | | | 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/+1
| | | | | | | | | | | | | | | | | 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
* [clang] Register isConstexpr matcherAlexander Shaposhnikov2017-04-161-0/+1
| | | | | | | | | | | | | | This diff registers isConstexpr matcher. Test plan: make check-all check that "match varDecl(isConstexpr())" works in clang-query Differential revision: https://reviews.llvm.org/D32112 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300427 91177308-0d34-0410-b5e6-96231b3b80d8
* Add isStaticStorageClass to the dynamic matcher registry so that it can be ↵Aaron Ballman2017-04-151-0/+1
| | | | | | | | used from clang-query. Patch by Dave Lee. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300400 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatchers] add typeAliasTemplateDecl matcher.Eric Liu2017-03-281-0/+1
| | | | | | | | | | | | 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/+5
| | | | | | | | ObjCIvarDecl, and ObjCPropertyDecl. Patch by Dave Lee. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297882 91177308-0d34-0410-b5e6-96231b3b80d8
* Move VariantMatcher's Payload to std::shared_ptr rather than IntrusiveRefCntPtrDavid Blaikie2017-01-051-3/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@291156 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatchers] Add hasInClassInitializer traversal matcher for FieldDecl.Malcolm Parsons2016-12-241-0/+1
| | | | | | | | | | | | | | | 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
* [ASTMatcher] Add hasReplacementType matcher for SubstTemplateTypeParmTypeMalcolm Parsons2016-12-081-0/+1
| | | | | | | | | | | | 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/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D27207 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@288366 91177308-0d34-0410-b5e6-96231b3b80d8
* [AST] Convert Marshallers to use unique_ptr.Justin Lebar2016-10-102-60/+62
| | | | | | | | | | Reviewers: timshen Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D25425 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@283773 91177308-0d34-0410-b5e6-96231b3b80d8
* Complete support for the cxxCtorInitializer() AST matcher so that it can be ↵Aaron Ballman2016-09-261-0/+38
| | | | | | used as a top-level matcher. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@282417 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an AST matcher for external formal linkage.Aaron Ballman2016-08-171-0/+1
| | | | | | Patch by Visoiu Mistrih git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@278926 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatchers] Add templateTypeParmDecl() to Registry.cppMartin Bohme2016-08-121-0/+1
| | | | | | | | | | | | | | Summary: This appears to have been forgotten when templateTypeParmDecl() was initially added. Reviewers: alexfh, aaron.ballman Subscribers: aaron.ballman, klimek, aemerson, rengolin, samparker, cfe-commits Differential Revision: https://reviews.llvm.org/D23448 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@278507 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatchers] Add matchers canReferToDecl() and hasUnderlyingDecl()Martin Bohme2016-08-091-0/+2
| | | | | | | | | | | | 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
* [ASTMatcher] Add templateName matcher.Haojian Wu2016-07-291-0/+1
| | | | | | | | | | 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
* Move some IntrusiveRefCntPtrs instead of copying.Benjamin Kramer2016-07-211-6/+7
| | | | | | No functionality change intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@276292 91177308-0d34-0410-b5e6-96231b3b80d8
* [NFC] Header cleanupMehdi Amini2016-07-181-1/+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/+2
| | | | | | | | | 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
* Add AST matchers for handling bit-fields and narrowing based on their width.Aaron Ballman2016-07-061-0/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@274652 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatcher] Add a node matcher for EnumType.Haojian Wu2016-06-301-0/+1
| | | | | | | | | | 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/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@274015 91177308-0d34-0410-b5e6-96231b3b80d8
* IgnoringImplicit matcher.Cong Liu2016-06-241-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@273659 91177308-0d34-0410-b5e6-96231b3b80d8
* Apply some suggestions from clang-tidy's performance-unnecessary-value-param.Benjamin Kramer2016-06-151-1/+1
| | | | | | No functionality change intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@272789 91177308-0d34-0410-b5e6-96231b3b80d8
* Adding an AST matcher to ignore parenthesis in *types* (rather than ↵Aaron Ballman2016-06-061-0/+1
| | | | | | expressions). This is required for traversing certain types (like function pointer types). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@271927 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatcher] Add a node matcher for UnresolvedLookupExpr.Haojian Wu2016-05-181-0/+1
| | | | | | | | | | Reviewers: alexfh, aaron.ballman Subscribers: aaron.ballman, klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D20360 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@269916 91177308-0d34-0410-b5e6-96231b3b80d8
* Add the hasDynamicExceptionSpec() AST matcher to match function declarations ↵Aaron Ballman2016-05-161-0/+1
| | | | | | | | that have a dynamic exception specification. Patch by Don Hinton. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@269662 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an AST matcher for CastExpr kindEtienne Bergeron2016-05-132-0/+23
| | | | | | | | | | | | | | Summary: This AST matcher will match a given CastExpr kind. It's an narrowing matcher on CastExpr. Reviewers: klimek, alexfh, sbenza, aaron.ballman Subscribers: Prazek, jroelofs, aaron.ballman, klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D19871 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@269460 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatchers] New matcher forFunctionGabor Horvath2016-05-041-0/+1
| | | | | | | | | | | | Summary: Matcher proposed in the review of checker misc-assign-operator (name pending). Its goal is to find the direct enclosing function declaration of a statement and run the inner matcher on it. Two version is attached in this patch (thus it will not compile), to be decided which approach to take. The second one always chooses one single parent while the first one does a depth-first search upwards (thus a height-first search) and returns the first positive match of the inner matcher (thus it always returns zero or one matches, not more). Further questions: is it enough to implement it in-place, or ASTMatchersInternals or maybe ASTMatchFinder should be involved? Reviewers: sbenza Subscribers: aaron.ballman, klimek, o.gyorgy, xazax.hun, cfe-commits Differential Revision: http://reviews.llvm.org/D19357 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@268490 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatchers] Do not try to memoize nodes we can't compare.Samuel Benzaquen2016-04-191-19/+30
| | | | | | | | | | | | | | | | Summary: Prevent hasAncestor from comparing nodes that are not supported. hasDescendant was fixed some time ago to avoid this problem. I'm applying the same fix to hasAncestor: if any object in the Builder map is not comparable, skip the cache. Reviewers: alexfh Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D19231 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@266748 91177308-0d34-0410-b5e6-96231b3b80d8
* Add typedefNameDecl() and typeAliasDecl() to the AST matchers; improves ↵Aaron Ballman2016-04-141-0/+2
| | | | | | | | hasType() to match on TypedefNameDecl nodes. Patch by Clement Courbet. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@266331 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatchers] Add own version of VariadicFunction.Samuel Benzaquen2016-03-251-5/+6
| | | | | | | | | | | | | | | | Summary: llvm::VariadicFunction is only being used by ASTMatchers. Having our own copy here allows us to remove the other one from llvm/ADT. Also, we can extend the API to meet our needs without modifying the common implementation. Reviewers: alexfh Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D18275 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264417 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatchers] New matcher hasReturnValue addedAlexander Kornienko2016-03-221-0/+1
| | | | | | | | | | | | | | | Summary: A checker (will be uploaded after this patch) needs to check implicit casts. Existing generic matcher "has" ignores implicit casts and parenthesized expressions and no specific matcher for matching return value expression preexisted. The patch adds such a matcher (hasReturnValue). Reviewers: klimek, sbenza Subscribers: xazax.hun, klimek, cfe-commits Patch by Ádám Balogh! Differential Revision: http://reviews.llvm.org/D17986 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264037 91177308-0d34-0410-b5e6-96231b3b80d8
* Adding new AST matchers for: addrLabelExpr, atomicExpr, ↵Aaron Ballman2016-03-091-0/+13
| | | | | | | | binaryConditionalOperator, designatedInitExpr, designatorCountIs, hasSyntacticForm, implicitValueInitExpr, labelDecl, opaqueValueExpr, parenListExpr, predefinedExpr, requiresZeroInitialization, and stmtExpr. Patch by Aleksei Sidorin. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@263027 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a -Wunused-variable diagnostic.Alexander Kornienko2016-02-231-0/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261626 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix Visual Studio build after r261574Hans Wennborg2016-02-221-3/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261583 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatchers] Add matcher hasAnyName.Samuel Benzaquen2016-02-222-51/+108
| | | | | | | | | | | | Summary: Add matcher hasAnyName as an optimization over anyOf(hasName(),...) Reviewers: alexfh Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D17163 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261574 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an AST matcher for real floating-point types. e.g., float, double, long ↵Aaron Ballman2016-02-181-0/+1
| | | | | | double, but not complex. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261221 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a nullPointerConstant() AST matcher to handle variations of null pointer ↵Aaron Ballman2016-02-161-0/+1
| | | | | | constants in one matcher. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261008 91177308-0d34-0410-b5e6-96231b3b80d8
* Add isAnyPointer() matchers. Register missing matchers.Felix Berger2016-02-151-0/+2
| | | | | | | | | | | | | Summary: The isAnyPointer() matcher is useful for http://reviews.llvm.org/D15623. Reviewers: alexfh, klimek Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D15819 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@260872 91177308-0d34-0410-b5e6-96231b3b80d8
* Reduce the number of implicit StringRef->std::string conversions by ↵Benjamin Kramer2016-02-131-2/+3
| | | | | | | | threading StringRef through more APIs. No functionality change intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@260815 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify and rename ASTMatchFinder's getCXXRecordDecl to make it more obviousRichard Smith2016-02-091-41/+23
| | | | | | | what it's actually trying to do. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@260277 91177308-0d34-0410-b5e6-96231b3b80d8
* Pass /bigobj when building lib/ASTMatchers/Dynamic/Registry.cppReid Kleckner2016-02-091-0/+9
| | | | | | | | | This is the third time it has crossed the 2^16 section limit. We've already spent time optimizing this file to reduce template instantiations, and it's not clear that there is anymore low hanging fruit. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@260267 91177308-0d34-0410-b5e6-96231b3b80d8
* Registering the gnuNullExpr AST matcher as a dynamic matcher so that it is ↵Aaron Ballman2016-02-091-0/+1
| | | | | | available from clang-query. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@260222 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatchers] Allow hasName() to look through inline namespacesSamuel Benzaquen2016-02-051-21/+125
| | | | | | | | | | | | | | | | | Summary: Allow hasName() to look through inline namespaces. This will fix the interaction between some clang-tidy checks and libc++. libc++ defines names in an inline namespace named std::<version_#>. When we try to match a name using hasName("std::xxx") it fails to match and the clang-tidy check does not work. Reviewers: klimek Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D15506 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@259898 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply r259210 with a fix for RegistryTest.cpp.Aaron Ballman2016-02-011-0/+1
| | | | | | Patch by Richard Thomson. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@259359 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r259210 "Extend hasType narrowing matcher for TypedefDecls, add ↵Hans Wennborg2016-01-291-1/+0
| | | | | | | | 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