summaryrefslogtreecommitdiffstats
path: root/clang/unittests/ASTMatchers/Dynamic/ParserTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [ParserTest] Move raw string literal out of macroDavid Green2020-01-051-3/+3
| | | | | Some combinations of gcc and ccache do not deal well with raw strings in macros. Moving the string out to attempt to fix the bots.
* Allow newlines in AST Matchers in clang-query filesStephen Kelly2019-12-271-23/+142
| | | | | | | | | | Reviewers: aaron.ballman Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D71842
* Revert "Allow newlines in AST Matchers in clang-query files" + 1Evgenii Stepanov2019-12-261-142/+23
| | | | | | | | | Revert "Fix -Wunused-lambda-capture warnings." This reverts commit 2369560f4a7720b19edfbf9de14ef061307ff773. This reverts commit 522ee29a4fb3814db604b585c8637247477ec057. clang/lib/ASTMatchers/Dynamic/Parser.cpp:610:13: warning: implicit conversion turns string literal into bool: 'const char [35]' to 'bool' [-Wstring-conversion] assert(!"Newline should never be found here");
* Allow newlines in AST Matchers in clang-query filesStephen Kelly2019-12-261-23/+142
| | | | | | | | | | Reviewers: aaron.ballman Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D71842
* Revert "Allow newlines in AST Matchers in clang-query files"Stephen Kelly2019-12-261-142/+23
| | | | This reverts commit 6a3ecf4dc7ec299394e71b3124df2b3a34ed4ac3.
* Allow newlines in AST Matchers in clang-query filesStephen Kelly2019-12-261-23/+142
| | | | | | | | | | Reviewers: aaron.ballman Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D71842
* [Clang] Migrate llvm::make_unique to std::make_uniqueJonas Devlieghere2019-08-141-4/+4
| | | | | | | | | | Now that we've moved to C++14, we no longer need the llvm::make_unique implementation from STLExtras.h. This patch is a mechanical replacement of (hopefully) all the llvm::make_unique instances across the monorepo. Differential revision: https://reviews.llvm.org/D66259 llvm-svn: 368942
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Revert "[ASTMatchers] Fix DynamicASTMatchersTests again"Fangrui Song2018-10-031-0/+1
| | | | | | | | This reverts commit 8a6631a983ec9c1d22cc77c5f55a524a651740f0. The last fix seems good in Debug mode. llvm-svn: 343738
* [ASTMatchers] Fix DynamicASTMatchersTests againFangrui Song2018-10-031-1/+0
| | | | llvm-svn: 343722
* [test] Fix -Wunused-variable in rC343665Fangrui Song2018-10-031-1/+1
| | | | llvm-svn: 343721
* Allow comments with '#' in dynamic AST MatchersStephen Kelly2018-10-031-2/+17
| | | | | | | | | | | | | | Summary: This is necessary for clang-query to be able to handle comments. Reviewers: aaron.ballman Reviewed By: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D52751 llvm-svn: 343665
* Allow binding to NamedValue resulting from let expressionStephen Kelly2018-08-301-0/+38
| | | | | | | | Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D51259 llvm-svn: 341142
* [ASTMatchers] Introduce a matcher for matching any given Objective-C selectorGeorge Karpenkov2018-03-291-0/+11
| | | | | | | | Incudes a tiny related refactoring. Differential Revision: https://reviews.llvm.org/D44858 llvm-svn: 328747
* [ASTMatchers] Extend hasParameter and hasAnyParameter matches to handle ↵George Karpenkov2018-03-291-7/+8
| | | | | | | | Objective-C methods Differential Revision: https://reviews.llvm.org/D44707 llvm-svn: 328746
* Use EXPECT_TRUE rather than EXPECT_EQ(true, ...) to clean up the code and ↵Eric Christopher2017-07-141-2/+2
| | | | | | silence a null conversion warning. llvm-svn: 307989
* [ASTMatchers] Add support for floatLiteralsPeter Wu2017-06-081-2/+17
| | | | | | | | | | | | | 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 llvm-svn: 305021
* [ASTMatchers] Add support for boolean literalsPeter Wu2017-06-081-0/+9
| | | | | | | | | | | | | 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 llvm-svn: 305020
* [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 llvm-svn: 275882
* Reorder ASTNodeKind::AllKindInfo to match NodeKindId.Alexander Kornienko2016-04-141-1/+1
| | | | | | | | | | | | | | Summary: AllKindInfo is being indexed by NodeKindId, so the order must match. Extended ASTTypeTraits tests to cover this. Reviewers: sbenza Subscribers: cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D19059 llvm-svn: 266268
* Add AST matcher support for FunctionDecls with the hasBody matcher.Aaron Ballman2016-01-201-1/+1
| | | | | | Patch by Aleksei Sidorin. llvm-svn: 258322
* [AST] Re-add TypeLocs and NestedNameSpecifierLocs to the ParentMap.Benjamin Kramer2015-10-231-2/+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-2/+1
| | | | | | | | | | | | 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-1/+2
| | | | | | | | | | | | | | | | 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-201-1/+1
| | | | | | | | | | 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-201-1/+1
| | | | | | | | | | | | 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
* Pass SourceRange by value in a test I missed in r249259.Craig Topper2015-10-041-2/+2
| | | | llvm-svn: 249260
* Rename AST node matchers to match the AST node names directly. Part of this ↵Aaron Ballman2015-09-171-2/+2
| | | | | | 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
* Replace some const std::string & with llvm::StringRef or std::stringYaron Keren2015-07-061-1/+1
| | | | | | | | and std::move to avoid implicit std::string construction. Patch by Eugene Kosov. llvm-svn: 241433
* Use 'override/final' instead of 'virtual' for overridden methodsAlexander Kornienko2015-04-111-3/+4
| | | | | | | | | | | | | | | | | | | | 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
* Special case 0 and 1 matcher in makeAllOfComposite().Samuel Benzaquen2014-10-091-1/+4
| | | | | | | | | | | | | | | | | Summary: Remove unnecessary wrapping for the 0 and 1 matcher cases of makeAllOfComposite(). We don't need a variadic wrapper for those cases. Refactor TrueMatcher to take advandage of the new conversions between DynTypedMatcher and Matcher<T>. Also, make it a singleton. This change improves our clang-tidy related benchmarks by ~12%. Reviewers: klimek Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D5675 llvm-svn: 219431
* Refactor Matcher<T> and DynTypedMatcher to reduce overhead of casts.Samuel Benzaquen2014-10-011-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This change introduces DynMatcherInterface and changes the internal representation of DynTypedMatcher and Matcher<T> to use a generic interface instead. It removes unnecessary indirections and virtual function calls when converting matchers by implicit and dynamic casts. DynTypedMatcher now remembers the stricter type in the chain of casts and checks it before calling into DynMatcherInterface. This change improves our clang-tidy related benchmark by ~14%. Also, it opens the door for more optimizations of this kind that are coming in future changes. As a side effect of removing these template instantiations, it also speeds up compilation of Dynamic/Registry.cpp by ~17% and reduces the number of symbols generated by ~30%. Reviewers: klimek Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D5542 llvm-svn: 218769
* Revert r218616, "Refactor Matcher<T> and DynTypedMatcher to reduce overhead ↵NAKAMURA Takumi2014-09-291-8/+4
| | | | | | | | | | | | of casts." MSC17, aka VS2012, cannot compile it. clang/include/clang/ASTMatchers/ASTMatchersInternal.h(387) : error C4519: default template arguments are only allowed on a class template clang/include/clang/ASTMatchers/ASTMatchersInternal.h(443) : see reference to class template instantiation 'clang::ast_matchers::internal::Matcher<T>' being compiled llvm-svn: 218648
* Refactor Matcher<T> and DynTypedMatcher to reduce overhead of casts.Samuel Benzaquen2014-09-291-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This change introduces DynMatcherInterface and changes the internal representation of DynTypedMatcher and Matcher<T> to use a generic interface instead. It removes unnecessary indirections and virtual function calls when converting matchers by implicit and dynamic casts. DynTypedMatcher now remembers the stricter type in the chain of casts and checks it before calling into DynMatcherInterface. This change improves our clang-tidy related benchmark by ~14%. Also, it opens the door for more optimizations of this kind that are coming in future changes. As a side effect of removing these template instantiations, it also speeds up compilation of Dynamic/Registry.cpp by ~17% and reduces the number of symbols generated by ~30%. Reviewers: klimek Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D5485 llvm-svn: 218616
* Support named values in the autocomplete feature.Samuel Benzaquen2014-08-121-14/+44
| | | | | | | | | | | | | | | | | | | 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
* Allow hasBody on CXXForRangeStmt nodes and update the docs.Manuel Klimek2014-05-271-1/+1
| | | | llvm-svn: 209647
* Add support for named values in the parser.Samuel Benzaquen2014-04-141-3/+28
| | | | | | | | | | | | 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-23/+0
| | | | | | | | This was submitted before it was ready. This reverts commit 62060a01e095cf35eb9ca42a333752d12714f35c. llvm-svn: 205533
* Add support for named values in the parser.Samuel Benzaquen2014-04-021-0/+23
| | | | | | | | | | | | | | | | | | | | 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
* Introduce Parser::completeExpression.Peter Collingbourne2014-01-301-0/+14
| | | | | | | | | 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
* Sort all the #include lines with LLVM's utils/sort_includes.py whichChandler Carruth2014-01-071-4/+3
| | | | | | | encodes the canonical rules for LLVM's style. I noticed this had drifted quite a bit when cleaning up LLVM, so wanted to clean up Clang as well. llvm-svn: 198686
* Split registry matcher resolution into a lookup phase and a construction phase.Peter Collingbourne2013-11-231-7/+21
| | | | | | | | The looked-up matchers will be used during code completion. Differential Revision: http://llvm-reviews.chandlerc.com/D2207 llvm-svn: 195534
* Resubmit "Refactor DynTypedMatcher into a value type class, just like ↵Samuel Benzaquen2013-10-291-56/+19
| | | | | | | | | | | | | | Matcher<T>." Summary: This resubmits r193100, plus a fix for a breakage with MSVC. Reviewers: klimek, rnk CC: cfe-commits, revane Differential Revision: http://llvm-reviews.chandlerc.com/D2005 llvm-svn: 193613
* Revert "Refactor DynTypedMatcher into a value type class, just like Matcher<T>."Reid Kleckner2013-10-211-19/+56
| | | | | | | | | This reverts commit r193100. It was failing to compile with MSVC 2012 while instantiating llvm::Optional<DynTypedMatcher>. llvm-svn: 193123
* Refactor DynTypedMatcher into a value type class, just like Matcher<T>.Samuel Benzaquen2013-10-211-56/+19
| | | | | | | | | | | | | | | | Summary: Refactor DynTypedMatcher into a value type class, just like Matcher<T>. This simplifies its usage and removes the virtual hierarchy from Matcher<T>. It also enables planned changes to replace MatcherInteface<T>. Too many instantiaions of this class hierarchy has been causing Registry.cpp.o to bloat in size and number of symbols. Reviewers: klimek CC: cfe-commits, revane Differential Revision: http://llvm-reviews.chandlerc.com/D1661 llvm-svn: 193100
* Add support for eachOf/allOf/anyOf variadic matchers in the dynamic layer.Samuel Benzaquen2013-08-281-2/+2
| | | | | | | | | | | | | | | Summary: Add support for eachOf/allOf/anyOf variadic matchers in the dynamic layer. These function require some late binding behavior for the type conversions, thus changes in VariadicValue's MatcherList. Second try. This time with a fix for C++11 builds. Reviewers: klimek CC: cfe-commits, revane Differential Revision: http://llvm-reviews.chandlerc.com/D1536 llvm-svn: 189500
* Revert "Add support for eachOf/allOf/anyOf variadic matchers in the dynamic ↵Samuel Benzaquen2013-08-271-2/+2
| | | | | | | | | | | | | | | | | layer." Summary: This reverts commit 3b082a3c72324aa3363b5184731740534c6b9a2b. It breaks the build in c++11 mode. Reviewers: klimek CC: cfe-commits, revane Differential Revision: http://llvm-reviews.chandlerc.com/D1533 llvm-svn: 189368
* Add support for eachOf/allOf/anyOf variadic matchers in the dynamic layer.Samuel Benzaquen2013-08-271-2/+2
| | | | | | | | | | | | | | Summary: Add support for eachOf/allOf/anyOf variadic matchers in the dynamic layer. These function require some late binding behavior for the type conversions, thus changes in VariadicValue's MatcherList. Reviewers: klimek CC: cfe-commits, revane Differential Revision: http://llvm-reviews.chandlerc.com/D1531 llvm-svn: 189362
* Refactor "MatcherList" into "VariantMatcher" and abstract the notion of a ↵Samuel Benzaquen2013-08-131-12/+16
| | | | | | | | | | | | | | | | list of matchers for the polymorphic case. Summary: Refactor "MatcherList" into "VariantMatcher" and abstract the notion of a list of matchers for the polymorphic case. This work is to support future changes needed for eachOf/allOf/anyOf matchers. We will add a new type on VariantMatcher. Reviewers: klimek CC: cfe-commits, revane Differential Revision: http://llvm-reviews.chandlerc.com/D1365 llvm-svn: 188272
* Add support for overloaded matchers. ie different matcher function ↵Samuel Benzaquen2013-07-221-0/+9
| | | | | | | | | | | | | | | | signatures with the same name. Summary: Add support for overloaded matchers. This composes with other features, like supporting polymorphic matchers. Reviewers: klimek CC: cfe-commits, revane Differential Revision: http://llvm-reviews.chandlerc.com/D1188 llvm-svn: 186836
OpenPOWER on IntegriCloud