llvm-project/clang/unittests/AST
Sam McCall e60151c915 [AST] RecursiveASTVisitor visits lambda classes when implicit visitation is on.
Summary:
This fixes ASTContext's parent map for nodes in such classes (e.g. operator()).
https://bugs.llvm.org/show_bug.cgi?id=39949

This also changes the observed shape of the AST for implicit RAVs.
- this includes AST MatchFinder: cxxRecordDecl() now matches lambda classes,
functionDecl() matches the call operator, and the parent chain is body -> call
operator -> lambda class -> lambdaexpr rather than body -> lambdaexpr.
- this appears not to matter for the ASTImporterLookupTable builder
- this doesn't matter for the other RAVs in-tree.

In order to do this, we remove the TraverseLambdaBody hook. The problem is it's
hard/weird to ensure this hook is called when traversing via the implicit class.
There were just two users of this hook in-tree, who use it to skip bodies.
I replaced these with explicitly traversing the captures only. Another approach
would be recording the bodies when the lambda is visited, and then recognizing
them later.
I'd be open to suggestion on how to preserve this hook, instead.

Reviewers: aaron.ballman, JonasToth

Subscribers: cfe-commits, rsmith, jdennett

Differential Revision: https://reviews.llvm.org/D56444

llvm-svn: 351047
2019-01-14 10:31:42 +00:00
..
ASTContextParentMapTest.cpp [AST] RecursiveASTVisitor visits lambda classes when implicit visitation is on. 2019-01-14 10:31:42 +00:00
ASTImporterTest.cpp [unittests] Remove superfluous semicolon, fixing warnings with GCC. NFC. 2018-12-18 08:36:16 +00:00
ASTTypeTraitsTest.cpp Make output of -ast-print a valid C++ code. 2016-11-10 08:49:37 +00:00
ASTVectorTest.cpp [NFC] Header cleanup 2016-07-18 19:02:11 +00:00
CMakeLists.txt Build ASTImporterTest.cpp with /bigobj on MSVC builds to keep llvm-clang-x86_64-expensive-checks-win buildbot happy 2018-12-17 15:14:08 +00:00
CommentLexer.cpp Added braces to work around gcc warning in googletest: suggest explicit braces to avoid ambiguous 'else'. NFC. 2017-06-15 21:01:24 +00:00
CommentParser.cpp [NFC] Header cleanup 2016-07-18 19:02:11 +00:00
CommentTextTest.cpp Lift VFS from clang to llvm (NFC) 2018-10-10 13:27:25 +00:00
DataCollectionTest.cpp [AST] Add TableGen for StmtDataCollectors 2017-09-06 13:20:51 +00:00
DeclMatcher.h Fix duplicate class template definitions problem 2018-05-23 13:53:36 +00:00
DeclPrinterTest.cpp [DeclPrinter] Allow printing fully qualified name of function declaration 2017-11-23 05:38:20 +00:00
DeclTest.cpp Revert "Lexer: always allow imaginary constants in GNU mode." 2017-08-08 23:17:51 +00:00
EvaluateAsRValueTest.cpp Revert "[Tooling] [0/1] Refactor FrontendActionFactory::create() to return std::unique_ptr<>" 2018-02-27 15:54:55 +00:00
ExternalASTSourceTest.cpp Reapply "IntrusiveRefCntPtr -> std::shared_ptr for CompilerInvocationBase and CodeCompleteConsumer" 2017-01-06 19:49:01 +00:00
Language.cpp [ASTImporter] Add ms compatibility to tests which use the TestBase 2018-06-25 13:04:37 +00:00
Language.h [ASTImporter] Add ms compatibility to tests which use the TestBase 2018-06-25 13:04:37 +00:00
MatchVerifier.h [ASTImporter] Add unit tests for structural equivalence 2018-05-24 08:41:07 +00:00
NamedDeclPrinterTest.cpp [AST] namespace ns { extern "C" { int X; }} prints as "ns::X", not as "X" 2018-02-02 13:34:47 +00:00
SourceLocationTest.cpp Tracking exception specification source locations 2017-01-12 16:11:28 +00:00
StmtPrinterTest.cpp [unittests] Merge the PrintedStmtCXX..Matches functions (NFC) 2018-12-07 12:55:01 +00:00
StructuralEquivalenceTest.cpp [ASTImporter] Fix redecl chain of classes and class templates 2018-12-17 12:42:12 +00:00