summaryrefslogtreecommitdiffstats
path: root/clang/lib/ASTMatchers/Dynamic
Commit message (Collapse)AuthorAgeFilesLines
...
* 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-291-3/+3
| | | | | | | | | | | | | | | | | | | | 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-111-24/+29
| | | | | | | | | | | | | | | | | | | | 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
* 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
* Roll functions back into namespaces, msvc has problems with name lookup ↵Benjamin Kramer2015-03-091-4/+8
| | | | | | outside of it. llvm-svn: 231671
* Make helper functions static. NFC.Benjamin Kramer2015-03-091-13/+9
| | | | | | Found by -Wmissing-prototypes. llvm-svn: 231668
* Add translationUnitDecl matcher.Samuel Benzaquen2015-02-101-0/+1
| | | | | | | | | | | | Summary: Add translationUnitDecl matcher. Reviewers: alexfh Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D7512 llvm-svn: 228694
* Add voidType() matcher.Samuel Benzaquen2014-12-151-0/+1
| | | | | | | | | | | | Summary: Add voidType() matcher. Reviewers: klimek Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D6656 llvm-svn: 224250
* Re-apply r222646 (was reverted in r222667). Adding 4 ASTMatchers: ↵Manuel Klimek2014-11-251-0/+4
| | | | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 222765
* Reverting r222646; the tests do not pass on Windows. Also reverts r222664, ↵Aaron Ballman2014-11-241-4/+0
| | | | | | which was required for r222646 to compile with Visual Studio 2012. llvm-svn: 222667
* Adding 4 ASTMatchers: typedefDecl, isInMainFile, isInSystemFile, ↵Manuel Klimek2014-11-241-0/+4
| | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 222646
* Replace variadic operator function pointer with an enum value.Samuel Benzaquen2014-11-202-14/+14
| | | | | | | | | | | | | | | Summary: Replace variadic operator function pointer with an enum value. Hiding the implementation of the variadic matcher will allow to specialize them for the operation performed. In particular, it will allow for a more efficient allOf() matcher. Reviewers: klimek Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D6293 llvm-svn: 222432
* Remove VariadicOperatorMatcherInterface as it is redundant with logic from ↵Samuel Benzaquen2014-11-172-5/+5
| | | | | | | | | | | | | | | | | | | DynTypedMatcher. Summary: The generic variadic matcher is faster (one less virtual function call per match) and doesn't require template instantiations which reduces compile time and binary size. Registry.cpp.o generates ~14% less symbols and compiles ~7.5% faster. The change also speeds up our clang-tidy benchmark by ~2%. Reviewers: klimek Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D6278 llvm-svn: 222131
* Add valueDecl() matcher.Samuel Benzaquen2014-10-281-0/+1
| | | | | | | | | | | | Summary: Add valueDecl() matcher. Reviewers: klimek Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D6005 llvm-svn: 220776
* Fix completion logic to allow for heterogeneous argument types in matcher ↵Samuel Benzaquen2014-10-091-10/+15
| | | | | | | | | | | | | | | | | | | | overloads. Summary: There was an assumption that there were no matchers that were overloaded on matchers and other types of arguments. This assumption was broken recently with the addition of new matcher overloads. Fixes http://llvm.org/PR21226 Reviewers: pcc Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D5711 llvm-svn: 219450
* Implement various matchers around template argument handling.Manuel Klimek2014-10-091-13/+18
| | | | llvm-svn: 219408
* Adds 'override' to overriding methods. NFC.Fariborz Jahanian2014-10-011-5/+5
| | | | | | These were uncoveredby my yet undelivered patch. llvm-svn: 218774
* Refactor VariantMatcher::MatcherOps to reduce the amount of generated code.Samuel Benzaquen2014-09-041-7/+37
| | | | | | | | | | | | | | | | | | Summary: Refactor VariantMatcher::MatcherOps to reduce the amount of generated code. - Make some code type agnostic and move it to the cpp file. - Return a DynTypedMatcher instead of storing the object in MatcherOps. This change reduces the number of symbols generated in Registry.cpp by ~19%, the object byte size by ~17% and the compilation time (in non-release mode) by ~20%. Reviewers: klimek Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D5124 llvm-svn: 217152
* ASTMatchers: Add a matcher to detect whether a decl or stmt is inside a ↵Benjamin Kramer2014-09-031-0/+2
| | | | | | | | | | | template instantiation. This is hoisted from clang-tidy where it's used everywhere. The implementation is not particularly efficient right now, but there is no easy fix for that. Differential Revision: http://reviews.llvm.org/D5085 llvm-svn: 217029
* Fix some cases where StringRef was being passed by const reference. Remove ↵Craig Topper2014-08-301-1/+1
| | | | | | const from some other StringRefs since its implicitly const already. llvm-svn: 216825
* Use llvm::makeArrayRef instead of explicitly calling ArrayRef constructor ↵Craig Topper2014-08-301-2/+2
| | | | | | and mentioning the type. This works now that we have a conversion from ArrayRef<T*> to ArrayRef<const T*>. llvm-svn: 216824
* Add hasAttr matcher for declarations.Manuel Klimek2014-08-252-3/+22
| | | | | | | | Delete special-case CUDA attribute matchers. Patch by Jacques Pienaar. llvm-svn: 216379
* Add missing matchers to the dynamic registry.Samuel Benzaquen2014-08-151-0/+11
| | | | | | | | | | Reviewers: klimek Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D4910 llvm-svn: 215757
* Add isDeleted() matcher for FunctionDecl nodes.Samuel Benzaquen2014-08-151-0/+1
| | | | | | | | | | Reviewers: klimek Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D4911 llvm-svn: 215714
* Header guard canonicalization, clang part.Benjamin Kramer2014-08-131-2/+2
| | | | | | Modifications made by clang-tidy with minor tweaks. llvm-svn: 215557
* Support named values in the autocomplete feature.Samuel Benzaquen2014-08-124-160/+224
| | | | | | | | | | | | | | | | | | | Summary: This includes: - Passing a Sema to completeExpression to allow for named values in the expression. - Passing a map of names to values to the parser. - Update the Sema interface to include completion for matchers. - Change the parser to use the Sema for completion, instead of going directly to Registry. Reviewers: pcc Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D3509 llvm-svn: 215472
* Remove llvm:: from uses of ArrayRef.Craig Topper2014-06-282-8/+8
| | | | llvm-svn: 211987
* Add hasLocalStorage/hasGlobalStorage matchers.Samuel Benzaquen2014-06-051-0/+2
| | | | | | | | | | | | | | Summary: Add hasLocalStorage/hasGlobalStorage matchers for VarDecl nodes. Update the doc. Also add them to the dynamic registry. Reviewers: klimek Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D4034 llvm-svn: 210278
* [C++11] Use 'nullptr'. ASTMatchers edition.Craig Topper2014-05-173-7/+7
| | | | llvm-svn: 209070
* Add support for named values in the parser.Samuel Benzaquen2014-04-143-35/+69
| | | | | | | | | | | | Summary: Add support for named values in the parser. Reviewers: pcc CC: cfe-commits, klimek Differential Revision: http://llvm-reviews.chandlerc.com/D3276 llvm-svn: 206176
* Revert "Add support for named values in the parser."Samuel Benzaquen2014-04-031-27/+21
| | | | | | | | This was submitted before it was ready. This reverts commit 62060a01e095cf35eb9ca42a333752d12714f35c. llvm-svn: 205533
* Add matcher for ExprWithCleanups.Samuel Benzaquen2014-04-021-0/+1
| | | | | | | | | | | | Summary: Add matcher for ExprWithCleanups. Reviewers: klimek CC: cfe-commits, klimek Differential Revision: http://llvm-reviews.chandlerc.com/D3248 llvm-svn: 205420
* Add support for named values in the parser.Samuel Benzaquen2014-04-021-21/+27
| | | | | | | | | | | | | | | | | | | | Summary: Add support for named values in the parser. This allows injection of arbitrary constants using a custom Sema object. Completions are not supported right now. Will be used by clang_query to support the 'let' command. Usage example: clang_query> let unique_ptr recordDecl(hasName("unique_ptr")) clang_query> match varDecl(hasType(unique_ptr)) Reviewers: klimek, pcc CC: cfe-commits, klimek Differential Revision: http://llvm-reviews.chandlerc.com/D3229 llvm-svn: 205419
* [C++11] Avoid implicit conversion of ArrayRef to std::vector and use move ↵Benjamin Kramer2014-03-102-10/+10
| | | | | | semantics where appropriate. llvm-svn: 203477
* Add loc() to the dynamic registry.Samuel Benzaquen2014-03-102-6/+17
| | | | | | | | | | | | | | | | | | Summary: Add loc() to the dynamic registry. Other fixes: - Fix the polymorphic variant value to accept an exact match, even if there are other possible conversions. - Fix specifiesTypeLoc() to not crash on an empty NestedNameSpecifierLoc. Reviewers: klimek CC: cfe-commits, klimek Differential Revision: http://llvm-reviews.chandlerc.com/D2928 llvm-svn: 203467
* [C++11] Use std::unique_ptr for ownership in a vector.Ahmed Charles2014-03-091-24/+14
| | | | | | Also change to using range-based for loops. No functional change intended. llvm-svn: 203396
* [C++11] Replace LLVM-style type traits with C++11 standard ones.Benjamin Kramer2014-03-071-1/+0
| | | | | | No functionality change. llvm-svn: 203241
* [C++11] Remove an LLVM_OVERRIDE use that I missed in my previous commit.Craig Topper2014-03-021-1/+1
| | | | llvm-svn: 202630
* Switch all uses of LLVM_OVERRIDE to just use 'override' directly.Craig Topper2014-03-021-3/+3
| | | | llvm-svn: 202625
* [CMake] Use LINK_LIBS instead of target_link_libraries().NAKAMURA Takumi2014-02-261-2/+1
| | | | llvm-svn: 202238
* Add TemplateSpecializationType polymorphism for hasTemplateArgument andPeter Collingbourne2014-02-201-0/+1
| | | | | | | | | | | hasAnyTemplateArgument, and (out of necessity) an isExpr matcher. Also updates the TemplateArgument doxygen to reflect reality for non-canonical template arguments. Differential Revision: http://llvm-reviews.chandlerc.com/D2810 llvm-svn: 201804
* Add isListInitialization matcher.Peter Collingbourne2014-02-061-0/+1
| | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D2708 llvm-svn: 200949
* clang/lib/ASTMatchers/Dynamic/CMakeLists.txt: redundantNAKAMURA Takumi2014-02-021-4/+0
| | | | llvm-svn: 200642
* Introduce Parser::completeExpression.Peter Collingbourne2014-01-301-33/+141
| | | | | | | | | This function returns a list of completions for a given expression and completion position. Differential Revision: http://llvm-reviews.chandlerc.com/D2261 llvm-svn: 200497
* Fix -Wreturn-type build failure on ASTMatchers, plus an intended assertAlp Toker2014-01-261-0/+1
| | | | llvm-svn: 200140
* Fix debug build.Peter Collingbourne2014-01-231-4/+4
| | | | llvm-svn: 199956
OpenPOWER on IntegriCloud