forked from OSchip/llvm-project
[ASTImporter] Add unittest case for friend decl import
Summary: This change adds a matching test case for the recent bug fix to VisitFriendDecl in ASTImporterLookup.cpp. See https://reviews.llvm.org/D82882 for details. Reviewers: martong, a.sidorin, shafik Reviewed By: martong Subscribers: rnkovacs, teemperor, cfe-commits, dkrupp Tags: #clang Differential Revision: https://reviews.llvm.org/D83006
This commit is contained in:
parent
10a898b3ec
commit
59f1bf46f8
|
@ -3416,6 +3416,26 @@ TEST_P(ASTImporterOptionSpecificTestBase,
|
|||
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 =
|
||||
|
|
Loading…
Reference in New Issue