diff options
author | Gabor Marton <martongabesz@gmail.com> | 2019-02-15 12:04:05 +0000 |
---|---|---|
committer | Gabor Marton <martongabesz@gmail.com> | 2019-02-15 12:04:05 +0000 |
commit | 849fa7559b4d334e8e887b93a240f1f63f1ca23a (patch) | |
tree | 9bbf37c1bf886e0b60a439e18ade101d04efc0d9 /unittests/AST/ASTImporterTest.cpp | |
parent | 8575c876d62985f4d772038bf7f2ead653b484fa (diff) |
[ASTImporter] Import every Decl in lambda record
Summary:
Previously only the fields were imported. Now every Decl is imported.
This way the destructor decl is not missing after import.
Patch by balazske (Balázs Kéri)
Reviewers: a.sidorin, shafik
Reviewed By: shafik
Subscribers: balazske, cfe-commits, Szelethus, martong, dkrupp
Tags: #clang
Differential Revision: https://reviews.llvm.org/D57740
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@354120 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/AST/ASTImporterTest.cpp')
-rw-r--r-- | unittests/AST/ASTImporterTest.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/unittests/AST/ASTImporterTest.cpp b/unittests/AST/ASTImporterTest.cpp index ece8e6e5bb..6c929b4d56 100644 --- a/unittests/AST/ASTImporterTest.cpp +++ b/unittests/AST/ASTImporterTest.cpp @@ -2709,6 +2709,26 @@ TEST_P(ImportFunctions, ImportFunctionFromUnnamedNamespace) { 2u); } +TEST_P(ImportFunctions, ImportImplicitFunctionsInLambda) { + Decl *FromTU = getTuDecl( + R"( + void foo() { + (void)[]() { ; }; + } + )", + Lang_CXX11); + auto *FromD = FirstDeclMatcher<FunctionDecl>().match( + FromTU, functionDecl(hasName("foo"))); + auto *ToD = Import(FromD, Lang_CXX); + EXPECT_TRUE(ToD); + CXXRecordDecl *LambdaRec = + cast<LambdaExpr>(cast<CStyleCastExpr>( + *cast<CompoundStmt>(ToD->getBody())->body_begin()) + ->getSubExpr()) + ->getLambdaClass(); + EXPECT_TRUE(LambdaRec->getDestructor()); +} + struct ImportFriendFunctions : ImportFunctions {}; TEST_P(ImportFriendFunctions, ImportFriendFunctionRedeclChainProto) { |