[PATCH] D83006: [ASTImporter] Add unittest case for friend decl import
Vince Bridgers via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 2 07:33:37 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG59f1bf46f8c2: [ASTImporter] Add unittest case for friend decl import (authored by vabridgers, committed by einvbri <vince.a.bridgers at ericsson.com>).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D83006/new/
https://reviews.llvm.org/D83006
Files:
clang/unittests/AST/ASTImporterTest.cpp
Index: clang/unittests/AST/ASTImporterTest.cpp
===================================================================
--- clang/unittests/AST/ASTImporterTest.cpp
+++ clang/unittests/AST/ASTImporterTest.cpp
@@ -3416,6 +3416,26 @@
EXPECT_TRUE(ToCtor->hasBody());
}
+TEST_P(ASTImporterOptionSpecificTestBase, ClassTemplateFriendDecl) {
+ const auto *Code =
+ R"(
+ template <class T> class X { friend T; };
+ struct Y {};
+ template class X<Y>;
+ )";
+ Decl *ToTU = getToTuDecl(Code, Lang_CXX11);
+ Decl *FromTU = getTuDecl(Code, Lang_CXX11);
+ auto *FromSpec = FirstDeclMatcher<ClassTemplateSpecializationDecl>().match(
+ FromTU, classTemplateSpecializationDecl());
+ auto *ToSpec = FirstDeclMatcher<ClassTemplateSpecializationDecl>().match(
+ ToTU, classTemplateSpecializationDecl());
+
+ auto *ImportedSpec = Import(FromSpec, Lang_CXX11);
+ EXPECT_EQ(ImportedSpec, ToSpec);
+ EXPECT_EQ(1u, DeclCounter<ClassTemplateSpecializationDecl>().match(
+ ToTU, classTemplateSpecializationDecl()));
+}
+
TEST_P(ASTImporterOptionSpecificTestBase,
ClassTemplatePartialSpecializationsShouldNotBeDuplicated) {
auto Code =
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83006.275118.patch
Type: text/x-patch
Size: 1184 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200702/1a9db90c/attachment-0001.bin>
More information about the cfe-commits
mailing list