summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Tooling/RecursiveASTVisitorTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [UnitTests] NFC/build-perf: Break up nontrivial compile jobsDavid Zarzycki2018-04-191-305/+0
| | | | | | | | | RecursiveASTVisitorTest.cpp is one of the longest compile jobs and a build bottleneck on many-core machines. This patch breaks that file and some peer files up into smaller files to increase build concurrency and overall rebuild performance. llvm-svn: 330353
* RecursiveASTVisitor should visit the nested name qualifiers inAlex Lorenz2017-07-111-0/+58
| | | | | | | | | | a template specialisation rdar://33123354 Differential Revision: https://reviews.llvm.org/D34981 llvm-svn: 307638
* Make sure TraverseInitListExpr visits InitListExpr exactly twiceStephan Bergmann2017-06-271-0/+86
| | | | | | | | | | | | | | | | | | | | | | | ... once each for the syntactic and semantic form. Without this fix, behavior of the newly added tests would have been InitListExprIsPreOrderVisitedTwice: syntactic: 1 semantic: 2 InitListExprIsPostOrderVisitedTwice: syntactic: 0 semantic: 1 InitListExprIsPreOrderNoQueueVisitedTwice: syntactic: 1 semantic: 2 InitListExprIsPostOrderNoQueueVisitedTwice: syntactic: 0 semantic: 2 llvm-svn: 306374
* [AST] RecursiveASTVisitor should not crash on lambdas with type attributesAlex Lorenz2017-05-101-0/+8
| | | | | | rdar://31960860 llvm-svn: 302689
* Remove custom handling of array copies in lambda by-value array capture andRichard Smith2016-12-141-19/+0
| | | | | | | | | | | copy constructors of classes with array members, instead using ArrayInitLoopExpr to represent the initialization loop. This exposed a bug in the static analyzer where it was unable to differentiate between zero-initialized and unknown array values, which has also been fixed here. llvm-svn: 289618
* [RecursiveASTVisitor] Visit the implicit expression of a CXXDefaultArgExprMalcolm Parsons2016-10-261-0/+17
| | | | | | | | | | | | | | | | | Summary: The matcher varDecl(hasDescendant( callExpr(hasDeclaration(functionDecl(unless(isNoThrow())))))) didn't match calls from default arguments because the expression for a CXXDefaultArgExpr was not visited. Reviewers: klimek, jdennett, alexfh, aaron.ballman Subscribers: aaron.ballman, cfe-commits Differential Revision: https://reviews.llvm.org/D25992 llvm-svn: 285239
* Let RecursiveASTVisitor visit array index VarDeclsNico Weber2016-01-221-0/+19
| | | | | | | | | | | | An implicit copy ctor creates loop VarDecls that hang off CXXCtorInitializer. RecursiveASTVisitor used to not visit them, so that they didn't show up in the parent map used by ASTMatchers, causing asserts() when the implicit DeclRefExpr() in a CXXCtorInitializer referred to one of these VarDecls. Fixes PR26227. http://reviews.llvm.org/D16413 llvm-svn: 258503
* Replace some tabs with spaces.Nico Weber2016-01-221-4/+3
| | | | llvm-svn: 258500
* Separated RecursiveASTVisitorTest into multiple files.Manuel Klimek2014-10-091-513/+12
| | | | | | Patch by Marek Kurdej. llvm-svn: 219410
* RAV: visit copy expressions of captured variables in blocks (ObjC++11)Alp Toker2014-06-261-0/+10
| | | | | | Patch by Mathieu Baudet. llvm-svn: 211758
* Fix RecursiveASTVisitor to visit types in ObjCPropertyDeclAlp Toker2014-06-061-0/+9
| | | | | | Patch by Mathieu Baudet! llvm-svn: 210339
* [modules] Fix ODR violation: there's another clang::TypeLocVisitor elsewhere.Richard Smith2014-05-191-3/+4
| | | | llvm-svn: 209169
* Sort all the #include lines with LLVM's utils/sort_includes.py whichChandler Carruth2014-01-071-1/+0
| | | | | | | 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
* Update RecursiveASTVisitor so that it visits attributes. This is currentlyDeLesley Hutchins2013-12-301-0/+39
| | | | | | | | important for thread safety attributes, which contain expressions that were not being visited, and were thus invisible to various tools. There are now Visit*Attr methods that can be overridden for every attribute. llvm-svn: 198224
* Add a test case to test RAV visits parameters of implicit copy constructor.Michael Han2013-09-121-3/+7
| | | | llvm-svn: 190632
* Teach RAV to visit parameter variable declarations of implicit functions. ↵Michael Han2013-09-111-0/+25
| | | | | | | | | | | | | | | Fixes PR16182. Normally RAV visits parameter variable declarations of a function by traversing the TypeLoc of the parameter declarations. However, for implicit functions, their parameters don't have any TypeLoc, because they are implicit. So for implicit functions, we visit their parameter variable declarations by traversing them through the function declaration, and visit them accordingly. Reviewed by Richard Smith and Manuel Klimek. llvm-svn: 190528
* Mark lambda closure classes as being implicitly-generated.James Dennett2013-09-051-0/+26
| | | | | | | | | | | | | | Summary: Closure classes for C++ lambdas are always compiler-generated. This one-line change calls setImplicit(true) on them at creation time, such that a default RecursiveASTVisitor (or any for which shouldVisitImplicitCode returns false) will skip them. Reviewers: rsmith, dblaikie Reviewed By: dblaikie CC: klimek, revane, cfe-commits, jordan_rose Differential Revision: http://llvm-reviews.chandlerc.com/D1593 llvm-svn: 190073
* Expose LambdaIntroducer::DefaultLoc in the AST's LambdaExpr.James Dennett2013-08-091-1/+20
| | | | | | | | | | | | | | | | | | | | | Summary: Source-centric tools need access to the location of a C++11 lambda expression's capture-default ('&' or '=') when it's present. It's possible for them to find it by re-lexing and re-implementing rules that Clang's parser has already applied, but the cost of storing the SourceLocation and making it available to them is 32 bits per LambdaExpr (a small delta, proportionally), and the simplification in client code is significant. Reviewers: rsmith Reviewed By: rsmith CC: cfe-commits, klimek, revane Differential Revision: http://llvm-reviews.chandlerc.com/D1192 llvm-svn: 188121
* Add a hook RecursiveASTVisitor::TraverseLambdaBody, to enable visitors toJames Dennett2013-07-101-0/+25
| | | | | | | | | | | | | | | | use/maintain additional state from the LambdaExpr while visiting the body of a LambdaExpr. One use for this arises because Clang's AST currently holds lambda bodies in a form prior to their adjustment to refer to captured copies of local variables, and so some clients will need access to the lambda's closure type in order to query how to map VarDecl*s to the FieldDecls of their by-copy captures. This hook is sufficient for at least one such client; to do this without such a hook would require the client to re-implement the whole of TraverseLambdaExpr, which is non-trivial and would likely be more brittle. llvm-svn: 186024
* Bug fix: Make RecursiveASTVisitor<T>::TraverseLambdaExpr callJames Dennett2013-06-301-2/+19
| | | | | | | WalkUpFromLambdaExpr, so that the Visit* functions are called on that AST node. llvm-svn: 185277
* Streamify getNameForDiagnostic and remove the string versions of ↵Benjamin Kramer2013-02-221-2/+3
| | | | | | PrintTemplateArgumentList. llvm-svn: 175894
* Allow RecursiveASTVisitor to visit CXXCtorInitializer objects for whichJames Dennett2012-08-241-0/+60
| | | | | | | | | | | isWritten() returns false, if shouldVisitImplicitCode() returns true. Previously those CXXCtorInitializers were always skipped. In order to make this change easier to test, this patch also extends the test class template ExpectedLocationVisitor to support arbitrary numbers of expected matches and disallowed matches. llvm-svn: 162544
* Part of PR13618: visit the TypeLoc when RecursiveASTVisitor visits a ↵Richard Smith2012-08-171-0/+8
| | | | | | CompoundLiteralExpr. llvm-svn: 162133
* Don't forget to apply #pragma pack to partial and explicit specializations ofRichard Smith2012-08-171-0/+7
| | | | | | | class templates. This fixes misalignment issues in llvm/Support/Endian.h when built by Clang. llvm-svn: 162074
* Add testing for CommentHandler, and fix a bug where trailing comments in #elseRichard Smith2012-06-241-116/+1
| | | | | | | and #endif in non-skipped blocks were not passed to the CommentHandler. Patch by Andy Gibbs! llvm-svn: 159119
* Make the RecursiveASTVisitor visit the body of a range-based for loopDaniel Jasper2012-06-211-1/+2
| | | | | | again. This was broken in r158395. llvm-svn: 158907
* Rename shouldVisitImplicitDeclarations to shouldVisitImplicitCode.Daniel Jasper2012-06-131-1/+25
| | | | | | | | | | Fix RecursiveASTVisitor to visit CXXForRangeStmts accordingly to visit implicit or explicit code. The key bug that inspired this was the Visitor not visiting the range initializer of such a loop, which is explicit code. llvm-svn: 158395
* RecursiveASTVisitor: add ability to visit implicit declarations. Patch byRichard Smith2012-06-051-0/+27
| | | | | | James Dennett! llvm-svn: 158002
* Only visit default arguments for template declarations when visiting the ↵Richard Smith2012-05-301-0/+54
| | | | | | template declaration which introduced them. Patch by Yang Chen! llvm-svn: 157723
* Test commit - Fix typo in comment.Daniel Jasper2012-05-301-1/+1
| | | | llvm-svn: 157674
* RecursiveASTVisitor:Richard Smith2012-05-091-0/+13
| | | | | | | | | | | | | We don't create any declaration to mark the explicit instantiation of function templates other than the instantiation itself, so visit that when traversing the function template decl. This is a temporary fix, pending the creation of a Decl node to represent the explicit instantiation. Patch by Daniel Jasper! llvm-svn: 156522
* Unrevert r155951, reverted in r155962, with two changes:Richard Smith2012-05-021-0/+36
| | | | | | | | | * Work around build failures due to gcc 4.2 bugs. * Remove BodyIndexer::TraverseCXXOperatorCallExpr, which was not being called prior to this change, and whose presence disables a RecursiveASTVisitor stack space optimization after this change. llvm-svn: 155969
* Revert "Fix RecursiveASTVisitor's data recursion to call the Traverse* ↵Andrew Trick2012-05-011-35/+0
| | | | | | | functions if they" FAIL: Clang :: Index/index-many-call-ops.cpp llvm-svn: 155962
* Fix RecursiveASTVisitor's data recursion to call the Traverse* functions if theyRichard Smith2012-05-011-0/+35
| | | | | | | have been overridden in the derived class. Also, remove a non-functional implementation of an incorrect optimization for ParenExprs. llvm-svn: 155951
* Fix file name in comment.David Blaikie2012-04-261-1/+1
| | | | | | Patch by Yang Chen. llvm-svn: 155658
* RecursiveASTVisitor: When in 'shouldVisitTemplateInstantiations' mode, visitRichard Smith2012-04-251-0/+94
| | | | | | | | | | | all instantiations of a template when we visit the canonical declaration of the primary template, rather than trying to match them up to the partial specialization from which they are instantiated. This fixes a bug where we failed to visit instantiations of partial specializations of member templates of class templates, and naturally extends to allow us to visit instantiations where we have instantiated only a declaration. llvm-svn: 155597
* RecursiveASTVisitor: Visit instantiations of member templates of classRichard Smith2012-04-241-4/+19
| | | | | | | | | | | | | | | | | | templates. In an implicit instantiation of a member class, any member templates don't get instantiated, so the existing check which only visited the instantiations of a defined template skipped these templates' instantiations. Since there is only a single declaration of a member template of a class template specialization, just use that to determine whether to visit the instantiations. This introduces a slight inconsistency in that we will visit the instantiations of such templates whether or not they are defined, but we never visit a declared-but-not-defined instantiation, so this turns out to not matter. Patch by Daniel Jasper! llvm-svn: 155487
* Fix PR12608. Patch contributed by Yang Chen.Manuel Klimek2012-04-231-0/+26
| | | | llvm-svn: 155355
* No need to put the SourceManager in with the ASTContext, as the ASTContextManuel Klimek2012-04-201-3/+1
| | | | | | already contains the SourceManager. llvm-svn: 155198
* Adds a unit test for the RecursiveASTVisitor.Manuel Klimek2012-04-191-0/+215
llvm-svn: 155108
OpenPOWER on IntegriCloud