From: Sean Callanan Date: Thu, 17 Nov 2011 23:20:56 +0000 (+0000) Subject: Added a clause to the ASTImporter allowing it to X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f1b69466146cda83936fae66839c446602e05133;p=clang Added a clause to the ASTImporter allowing it to import TranslationUnitDecls. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144934 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/ASTImporter.cpp b/lib/AST/ASTImporter.cpp index 318f6f2897..981cc5ebd9 100644 --- a/lib/AST/ASTImporter.cpp +++ b/lib/AST/ASTImporter.cpp @@ -100,6 +100,7 @@ namespace clang { bool IsStructuralMatch(EnumDecl *FromEnum, EnumDecl *ToRecord); bool IsStructuralMatch(ClassTemplateDecl *From, ClassTemplateDecl *To); Decl *VisitDecl(Decl *D); + Decl *VisitTranslationUnitDecl(TranslationUnitDecl *D); Decl *VisitNamespaceDecl(NamespaceDecl *D); Decl *VisitTypedefNameDecl(TypedefNameDecl *D, bool IsAlias); Decl *VisitTypedefDecl(TypedefDecl *D); @@ -2030,6 +2031,15 @@ Decl *ASTNodeImporter::VisitDecl(Decl *D) { return 0; } +Decl *ASTNodeImporter::VisitTranslationUnitDecl(TranslationUnitDecl *D) { + TranslationUnitDecl *ToD = + Importer.getToContext().getTranslationUnitDecl(); + + Importer.Imported(D, ToD); + + return ToD; +} + Decl *ASTNodeImporter::VisitNamespaceDecl(NamespaceDecl *D) { // Import the major distinguishing characteristics of this namespace. DeclContext *DC, *LexicalDC;