summaryrefslogtreecommitdiffstats
path: root/clang/lib/ASTMatchers
Commit message (Collapse)AuthorAgeFilesLines
...
* Add an isVirtualAsWritten AST matcher.Nico Weber2016-01-211-0/+1
| | | | | | http://reviews.llvm.org/D16394 llvm-svn: 258415
* Register the isCopyAssignmentOperator AST matcher so that it can be used ↵Aaron Ballman2016-01-201-0/+1
| | | | | | | | dynamically. Path by Jonathan Coe. llvm-svn: 258341
* Add AST matcher for paren expressions.Aaron Ballman2016-01-201-0/+1
| | | | | | Patch by Adrian Zgorzałek. llvm-svn: 258321
* Add an AST matcher for checking whether a function is defaulted.Aaron Ballman2016-01-181-0/+1
| | | | | | Patch by Jonathan Coe. llvm-svn: 258072
* Add forEachArgumentWithParam AST matcher.Manuel Klimek2016-01-181-0/+1
| | | | | | | | | | | | The new matcher allows users to provide a matcher for both the argument of a CallExpr/CxxConstructExpr a well as the ParmVarDecl of the argument. Patch by Felix Berger. Differential Revision: http://reviews.llvm.org/D13845 llvm-svn: 258042
* [ASTMatchers] Add booleanType() matcher.Samuel Benzaquen2015-12-221-0/+1
| | | | llvm-svn: 256278
* Add a narrowing AST matcher that matches on a FunctionDecl with a ↵Aaron Ballman2015-12-021-0/+1
| | | | | | non-throwing exception specification. llvm-svn: 254516
* Use data recursion in RecursiveASTVisitor when traversing Stmt and Expr nodes.Richard Smith2015-11-241-6/+0
| | | | | | | | | | | | | | | | | | When RAV traverses a Stmt or Expr node, if the corresponding Traverse* functions have not been overridden, it will now use data recursion to walk those nodes. We arrange this to be an unobservable optimization to RAV subclasses, and to gracefully degrade as parts of the visitation are overridden with functions that might observe the visitation. For instance, if an RAV subclass overrides TraverseUnaryNot, we will ensure that there are real recursive stack frames for those traversals, but we'll use data recursion for all other traversals. This removes the need for DataRecursiveASTVisitor, and for the 'shouldUseDataRecursionFor' extension point, both of which are removed by this change. llvm-svn: 253948
* Add an AST matcher for narrowing when a type is volatile-qualified.Aaron Ballman2015-11-231-0/+1
| | | | llvm-svn: 253882
* Re-committing r253473 after hopefully fixing the bot breakage. There was a ↵Aaron Ballman2015-11-181-0/+3
| | | | | | copy-pasta issue that my local testing did not catch. llvm-svn: 253481
* Reverting r253473 while I investigate build bot failures.Aaron Ballman2015-11-181-3/+0
| | | | llvm-svn: 253475
* Adding AST matchers for VarDecl storage durations. Can now determine whether ↵Aaron Ballman2015-11-181-0/+3
| | | | | | a VarDecl has automatic, static, or thread storage duration. This also updates the documentation for matchers, which appear to be missing some previous additions. llvm-svn: 253473
* [AST] Re-add TypeLocs and NestedNameSpecifierLocs to the ParentMap.Benjamin Kramer2015-10-231-3/+4
| | | | | | | | | | | | | | | | | | | | This relands r250831 after some fixes to shrink the ParentMap overall with one addtional tweak: nodes with pointer identity (e.g. Decl* and friends) can be store more efficiently so I put them in a separate map. All other nodes (so far only TypeLoc and NNSLoc) go in a different map keyed on DynTypedNode. This further uglifies the code but significantly reduces memory overhead. Overall this change still make ParentMap significantly larger but it's nowhere as bad as before. I see about 25 MB over baseline (pre-r251008) on X86ISelLowering.cpp. If this becomes an issue we could consider splitting the maps further as DynTypedNode is still larger (32 bytes) than a single TypeLoc (16 bytes) but I didn't want to introduce even more complexity now. Differential Revision: http://reviews.llvm.org/D14011 llvm-svn: 251101
* Revert "[AST] Put TypeLocs and NestedNameSpecifierLocs into the ParentMap."Benjamin Kramer2015-10-211-4/+3
| | | | | | | | | | | | Putting DynTypedNode in the ParentMap bloats its memory foot print. Before the void* key had 8 bytes, now we're at 40 bytes per key which can mean multiple gigabytes increase for large ASTs and this count doesn't even include all the added TypeLoc nodes. Revert until I come up with a better data structure. This reverts commit r250831. llvm-svn: 250889
* [AST] Put TypeLocs and NestedNameSpecifierLocs into the ParentMap.Benjamin Kramer2015-10-201-3/+4
| | | | | | | | | | | | | | | | Firstly this changes the type of parent map to be keyed on DynTypedNode to simplify the following changes. This comes with a DenseMapInfo for DynTypedNode, which is a bit incomplete still and will probably only work for parentmap right now. Then the RecursiveASTVisitor in ASTContext is updated and finally ASTMatchers hasParent and hasAncestor learn about the new functionality. Now ParentMap is only missing TemplateArgumentLocs and CXXCtorInitializers. Differential Revision: http://reviews.llvm.org/D13897 llvm-svn: 250831
* Roll-back r250822.Angel Garcia Gomez2015-10-204-9/+9
| | | | | | | | | | Summary: It breaks the build for the ASTMatchers Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D13893 llvm-svn: 250827
* Apply modernize-use-default to clang.Angel Garcia Gomez2015-10-204-9/+9
| | | | | | | | | | | | Summary: Replace empty bodies of default constructors and destructors with '= default'. Reviewers: bkramer, klimek Subscribers: klimek, alexfh, cfe-commits Differential Revision: http://reviews.llvm.org/D13890 llvm-svn: 250822
* Add decayedType and hasDecayedType AST matchersMatthias Gehre2015-10-121-0/+2
| | | | | | | | | | | | Summary: Add decayedType and hasDecayedType AST matchers Reviewers: klimek Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D13639 llvm-svn: 250114
* ASTMatchers: Keep AllCallbacks in a set instead of a vectorDaniel Jasper2015-10-071-6/+6
| | | | | | | | | | | AllCallbacks is currently only used to call onStartOfTranslationUnit and onEndOfTranslationUnit on them. In this (and any other scenario I can come up with), it is important (or at least better) not to have duplicates in this container. E.g. currently onEndOfTranslationUnit is called repeatedly on the same callback for every matcher that is registered with it. llvm-svn: 249598
* Adding a narrowing AST matcher for FunctionDecl::isVariadic(), plus tests ↵Aaron Ballman2015-10-051-0/+1
| | | | | | and documentation. llvm-svn: 249321
* SourceRanges are small and trivially copyable, don't them by reference.Craig Topper2015-10-044-18/+18
| | | | llvm-svn: 249259
* Rename AST node matchers to match the AST node names directly. Part of this ↵Aaron Ballman2015-09-171-27/+31
| | | | | | 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. llvm-svn: 247885
* Fixed HasDeclarationMatcher to properly convert all types into decls where ↵Aaron Ballman2015-09-111-0/+5
| | | | | | | | | | | | | | 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. llvm-svn: 247404
* Adding an AST matcher for namespaceAliasDecl.Aaron Ballman2015-08-281-0/+1
| | | | llvm-svn: 246322
* [ASTMatchers] Add type matcher for SubstTemplateTypeParmType.Samuel Benzaquen2015-08-261-0/+1
| | | | llvm-svn: 246037
* Add AST narrowing matchers for inline and anonymous namespaces. Since the ↵Aaron Ballman2015-08-181-0/+2
| | | | | | inline keyword can also be specified on a FunctionDecl, this is a polymorphic matcher. llvm-svn: 245337
* Switching from an explicit loop to DeleteContainerSeconds; NFC.Aaron Ballman2015-08-121-2/+2
| | | | llvm-svn: 244802
* RangRangify some more for loops; NFC.Aaron Ballman2015-08-121-17/+15
| | | | llvm-svn: 244792
* Add a polymorphic AST matcher for testing whether a constructor or a ↵Aaron Ballman2015-08-111-0/+1
| | | | | | conversion declaration is marked as explicit or not. llvm-svn: 244666
* Add an AST matcher to match member intializers of a CXXCtorInitializer.Aaron Ballman2015-08-111-0/+1
| | | | llvm-svn: 244662
* Add AST matchers for narrowing constructors that are default, copy, or move ↵Aaron Ballman2015-08-051-0/+4
| | | | | | constructors, as well as functionality to determine whether a ctor initializer is a base initializer. llvm-svn: 244036
* Add an AST matcher, isFinal(), for testing whether a method or class ↵Aaron Ballman2015-07-241-0/+1
| | | | | | declaration are marked final. llvm-svn: 243107
* [ASTMatchers] Use provided target NodeKind instead of inferring it from the ↵Samuel Benzaquen2015-07-172-6/+6
| | | | | | | | | | matchers. Individual matchers might not be convertible to each other's kind, but they might still all be convertible to the target kind. All the callers already know the target kind, so just pass it down. llvm-svn: 242534
* Add the ability to AST match a variable declaration that is an exception ↵Aaron Ballman2015-07-151-0/+1
| | | | | | variable. llvm-svn: 242303
* AST Matchers: pass ast_type_traits::DynTypedNode by const-refHans Wennborg2015-07-141-9/+9
| | | | | | (Broken out from http://reviews.llvm.org/D11168) llvm-svn: 242161
* Replace some const std::string & with llvm::StringRef or std::stringYaron Keren2015-07-062-3/+3
| | | | | | | | and std::move to avoid implicit std::string construction. Patch by Eugene Kosov. llvm-svn: 241433
* Revert r241330. It compiled with Visual C++ 2013 and gcc 4.9.1 (mingw) but ↵Yaron Keren2015-07-032-3/+3
| | | | | | now fails the bots. llvm-svn: 241335
* Replace some const std::string & with llvm::StringRef or std::stringYaron Keren2015-07-032-3/+3
| | | | | | | | and std::move to avoid implicit std::string construction. Patch by Eugene Kosov. llvm-svn: 241330
* Revert r241319, investigating.Yaron Keren2015-07-032-3/+3
| | | | llvm-svn: 241321
* Replace some const std::string & with llvm::StringRef or std::stringYaron Keren2015-07-032-3/+3
| | | | | | | | | | and std::move to avoid implicit std::string construction. Part 1/2. Patch by Eugene Kosov. llvm-svn: 241319
* When testing for anyOf(), the test should not be for an exact type match for ↵Aaron Ballman2015-07-021-2/+2
| | | | | | all members of the set. Instead, test that all members are convertible to the common type. llvm-svn: 241263
* Implement an AST matcher for C++ exception catch handlers that can catch any ↵Aaron Ballman2015-07-021-0/+1
| | | | | | exception type (...). llvm-svn: 241256
* Move a test from static-assert.cpp to DeclPrinterTestDavid Majnemer2015-06-051-0/+1
| | | | | | | | It's better not to rely on the diagnostics engine to pretty print the argument to decltype. Instead, exercise the functionality in DeclPrinterTest. llvm-svn: 239197
* Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial typesBenjamin Kramer2015-05-292-9/+9
| | | | | | | | | | | | | | | | | | | | If the type isn't trivially moveable emplace can skip a potentially expensive move. It also saves a couple of characters. Call sites were found with the ASTMatcher + some semi-automated cleanup. memberCallExpr( argumentCountIs(1), callee(methodDecl(hasName("push_back"))), on(hasType(recordDecl(has(namedDecl(hasName("emplace_back")))))), hasArgument(0, bindTemporaryExpr( hasType(recordDecl(hasNonTrivialDestructor())), has(constructExpr()))), unless(isInTemplateInstantiation())) No functional change intended. llvm-svn: 238601
* Add conversionDecl matcher for node CXXConversionDecl.Samuel Benzaquen2015-04-201-0/+1
| | | | llvm-svn: 235348
* Use 'override/final' instead of 'virtual' for overridden methodsAlexander Kornienko2015-04-112-25/+30
| | | | | | | | | | | | | | | | | | | | Summary: The patch is generated using clang-tidy misc-use-override check. This command was used: tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py \ -checks='-*,misc-use-override' -header-filter='llvm|clang' -j=32 -fix Reviewers: dblaikie Reviewed By: dblaikie Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D8926 llvm-svn: 234678
* ASTMatchers: Add an explicit dependency on libclangBasic.Benjamin Kramer2015-03-121-0/+1
| | | | | | | In a static build the dependency is picked up implictly, but not in a shared library build. This is needed for the new ObjC matchers that reference Selector. llvm-svn: 232055
* Add support for a few Objective-C matchers.Manuel Klimek2015-03-121-0/+8
| | | | | | | | | | | Add some matchers for Objective-C selectors and messages to ASTMatchers.h. Minor mods to ASTMatchersTest.h to allow test files with ".m" extension in addition to ".cpp". New tests added to ASTMatchersTest.c. Patch by Dean Sutherland. llvm-svn: 232051
* Reverting r232034, as it broke one of the bots with link errors. Details at: ↵Aaron Ballman2015-03-121-8/+0
| | | | | | http://bb.pgr.jp/builders/ninja-clang-x64-mingw64-RA/builds/6352/steps/build/logs/stdio llvm-svn: 232038
* Added some matchers for objective c selectors and messages to ASTMatchers.h. ↵Aaron Ballman2015-03-121-0/+8
| | | | | | | | Minor mods to ASTMatchersTest.h to allow test files with ".m" extension in addition to ".cpp". New tests added to ASTMatchersTest.c. Patch by Dean Sutherland, reviewed by Manuel Klimek. From http://reviews.llvm.org/D7710 llvm-svn: 232034
OpenPOWER on IntegriCloud