summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
diff options
context:
space:
mode:
authorGabor Marton <martongabesz@gmail.com>2018-05-23 14:24:02 +0000
committerGabor Marton <martongabesz@gmail.com>2018-05-23 14:24:02 +0000
commita3af5672910e06dec7ee4a918fcbdf0a5585107e (patch)
tree865f7477bd17d4f937f88e1751c0a2059d54e1e6 /clang/lib/AST
parent0fb19de0c3ac9057d44ac5a3bbfa9d0d332dfb8c (diff)
downloadbcm5719-llvm-a3af5672910e06dec7ee4a918fcbdf0a5585107e.tar.gz
bcm5719-llvm-a3af5672910e06dec7ee4a918fcbdf0a5585107e.zip
[ASTImporter] Fix missing implict CXXRecordDecl in ClassTemplateSpecializationDecl
Summary: Currently we do not import the implicit CXXRecordDecl of a ClassTemplateSpecializationDecl. This patch fixes it. Reviewers: a.sidorin, xazax.hun, r.stahl Subscribers: rnkovacs, dkrupp, cfe-commits Differential Revision: https://reviews.llvm.org/D47057 llvm-svn: 333086
Diffstat (limited to 'clang/lib/AST')
-rw-r--r--clang/lib/AST/ASTImporter.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp
index 3c698974364..7e402722b19 100644
--- a/clang/lib/AST/ASTImporter.cpp
+++ b/clang/lib/AST/ASTImporter.cpp
@@ -1959,14 +1959,20 @@ Decl *ASTNodeImporter::VisitRecordDecl(RecordDecl *D) {
// but this particular declaration is not that definition, import the
// definition and map to that.
TagDecl *Definition = D->getDefinition();
- if (Definition && Definition != D) {
+ if (Definition && Definition != D &&
+ // In contrast to a normal CXXRecordDecl, the implicit
+ // CXXRecordDecl of ClassTemplateSpecializationDecl is its redeclaration.
+ // The definition of the implicit CXXRecordDecl in this case is the
+ // ClassTemplateSpecializationDecl itself. Thus, we start with an extra
+ // condition in order to be able to import the implict Decl.
+ !D->isImplicit()) {
Decl *ImportedDef = Importer.Import(Definition);
if (!ImportedDef)
return nullptr;
return Importer.Imported(D, ImportedDef);
}
-
+
// Import the major distinguishing characteristics of this record.
DeclContext *DC, *LexicalDC;
DeclarationName Name;
OpenPOWER on IntegriCloud