[PATCH] D47058: [ASTImporter] Fix ClassTemplateSpecialization in wrong DC
Gabor Marton via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue May 22 02:10:40 PDT 2018
martong updated this revision to Diff 147966.
martong marked an inline comment as done.
martong added a comment.
Use isExplicitInstantiationOrSpecialization
Repository:
rC Clang
https://reviews.llvm.org/D47058
Files:
lib/AST/ASTImporter.cpp
unittests/AST/ASTImporterTest.cpp
Index: unittests/AST/ASTImporterTest.cpp
===================================================================
--- unittests/AST/ASTImporterTest.cpp
+++ unittests/AST/ASTImporterTest.cpp
@@ -1246,7 +1246,7 @@
TEST_P(
ASTImporterTestBase,
- DISABLED_TUshouldNotContainClassTemplateSpecializationOfImplicitInstantiation) {
+ TUshouldNotContainClassTemplateSpecializationOfImplicitInstantiation) {
Decl *From, *To;
std::tie(From, To) = getImportedDecl(
Index: lib/AST/ASTImporter.cpp
===================================================================
--- lib/AST/ASTImporter.cpp
+++ lib/AST/ASTImporter.cpp
@@ -4298,9 +4298,13 @@
D2->setTemplateSpecializationKind(D->getTemplateSpecializationKind());
- // Add the specialization to this context.
+ // Set the context of this specialization/instantiation.
D2->setLexicalDeclContext(LexicalDC);
- LexicalDC->addDeclInternal(D2);
+
+ // Add to the DC only if it was an explicit specialization/instantiation.
+ if (D2->isExplicitInstantiationOrSpecialization()) {
+ LexicalDC->addDeclInternal(D2);
+ }
}
Importer.Imported(D, D2);
if (D->isCompleteDefinition() && ImportDefinition(D, D2))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47058.147966.patch
Type: text/x-patch
Size: 1198 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180522/d231a7a3/attachment.bin>
More information about the cfe-commits
mailing list