summaryrefslogtreecommitdiffstats
path: root/clang/unittests/AST/ASTImporterTest.cpp
diff options
context:
space:
mode:
authorGabor Marton <martongabesz@gmail.com>2019-02-18 13:09:27 +0000
committerGabor Marton <martongabesz@gmail.com>2019-02-18 13:09:27 +0000
commite331e63af23c91b4f3103086af7117a8f0c49f76 (patch)
tree6ab1d1311d611459c9f678e9e5f6a2691a0ca0f2 /clang/unittests/AST/ASTImporterTest.cpp
parent958837c6409cc92e8903b467024c2df721089240 (diff)
downloadbcm5719-llvm-e331e63af23c91b4f3103086af7117a8f0c49f76.tar.gz
bcm5719-llvm-e331e63af23c91b4f3103086af7117a8f0c49f76.zip
[ASTImporter] Find previous friend function template
Reviewers: a_sidorin, shafik, a.sidorin Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D57910 llvm-svn: 354267
Diffstat (limited to 'clang/unittests/AST/ASTImporterTest.cpp')
-rw-r--r--clang/unittests/AST/ASTImporterTest.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/clang/unittests/AST/ASTImporterTest.cpp b/clang/unittests/AST/ASTImporterTest.cpp
index 30bc9dc73ca..fa5384503df 100644
--- a/clang/unittests/AST/ASTImporterTest.cpp
+++ b/clang/unittests/AST/ASTImporterTest.cpp
@@ -5390,6 +5390,33 @@ TEST_P(ASTImporterOptionSpecificTestBase,
EXPECT_EQ(0u, ToTU->getASTContext().getDiagnostics().getNumWarnings());
}
+struct ImportFriendFunctionTemplates : ASTImporterOptionSpecificTestBase {};
+
+TEST_P(ImportFriendFunctionTemplates, LookupShouldFindPreviousFriend) {
+ Decl *ToTU = getToTuDecl(
+ R"(
+ class X {
+ template <typename T> friend void foo();
+ };
+ )",
+ Lang_CXX);
+ auto *Friend = FirstDeclMatcher<FunctionTemplateDecl>().match(
+ ToTU, functionTemplateDecl(hasName("foo")));
+
+ Decl *FromTU = getTuDecl(
+ R"(
+ template <typename T> void foo();
+ )",
+ Lang_CXX);
+ auto *FromFoo = FirstDeclMatcher<FunctionTemplateDecl>().match(
+ FromTU, functionTemplateDecl(hasName("foo")));
+ auto *Imported = Import(FromFoo, Lang_CXX);
+
+ // FIXME Currently chains of FunctionTemplateDecls are not implemented.
+ //EXPECT_EQ(Imported->getPreviousDecl(), Friend);
+ EXPECT_EQ(Imported, Friend);
+}
+
INSTANTIATE_TEST_CASE_P(ParameterizedTests, ASTImporterLookupTableTest,
DefaultTestValuesForRunOptions, );
@@ -5408,6 +5435,9 @@ INSTANTIATE_TEST_CASE_P(ParameterizedTests, ASTImporterOptionSpecificTestBase,
INSTANTIATE_TEST_CASE_P(ParameterizedTests, ImportFunctions,
DefaultTestValuesForRunOptions, );
+INSTANTIATE_TEST_CASE_P(ParameterizedTests, ImportFriendFunctionTemplates,
+ DefaultTestValuesForRunOptions, );
+
INSTANTIATE_TEST_CASE_P(ParameterizedTests, ImportClasses,
DefaultTestValuesForRunOptions, );
OpenPOWER on IntegriCloud