diff options
author | Balazs Keri <1.int32@gmail.com> | 2019-05-07 10:55:11 +0000 |
---|---|---|
committer | Balazs Keri <1.int32@gmail.com> | 2019-05-07 10:55:11 +0000 |
commit | 1efc97425df3cd79e98434c6ea2ee2b955911ac5 (patch) | |
tree | 6c724b03cf68dc33820f60e73ba3773c1311d3a3 /clang/unittests/AST/ASTImporterTest.cpp | |
parent | 3c975a0ab54fdd420d3f1c84e1c41bc35738cb53 (diff) | |
download | bcm5719-llvm-1efc97425df3cd79e98434c6ea2ee2b955911ac5.tar.gz bcm5719-llvm-1efc97425df3cd79e98434c6ea2ee2b955911ac5.zip |
[ASTImporter] Import TemplateParameterLists in function templates.
Summary: Correct missing import of TemplateParameterList in function decl.
Reviewers: martong, a.sidorin, shafik
Reviewed By: martong
Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D60461
llvm-svn: 360132
Diffstat (limited to 'clang/unittests/AST/ASTImporterTest.cpp')
-rw-r--r-- | clang/unittests/AST/ASTImporterTest.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/unittests/AST/ASTImporterTest.cpp b/clang/unittests/AST/ASTImporterTest.cpp index 7cac2b57036..952e6f92db8 100644 --- a/clang/unittests/AST/ASTImporterTest.cpp +++ b/clang/unittests/AST/ASTImporterTest.cpp @@ -5083,6 +5083,24 @@ TEST_P(ASTImporterOptionSpecificTestBase, EXPECT_FALSE(ImportedD->getUnderlyingType()->isIncompleteType()); } +TEST_P(ASTImporterOptionSpecificTestBase, ImportTemplateParameterLists) { + auto Code = + R"( + template<class T> + int f() { return 0; } + template <> int f<int>() { return 4; } + )"; + + Decl *FromTU = getTuDecl(Code, Lang_CXX); + auto *FromD = FirstDeclMatcher<FunctionDecl>().match(FromTU, + functionDecl(hasName("f"), isExplicitTemplateSpecialization())); + ASSERT_EQ(FromD->getNumTemplateParameterLists(), 1); + + auto *ToD = Import(FromD, Lang_CXX); + // The template parameter list should exist. + EXPECT_EQ(ToD->getNumTemplateParameterLists(), 1); +} + struct ASTImporterLookupTableTest : ASTImporterOptionSpecificTestBase {}; TEST_P(ASTImporterLookupTableTest, OneDecl) { |