From ba7bde65dcfff543cefc1de9adcda7f503ffffde Mon Sep 17 00:00:00 2001 From: Raphael Isemann Date: Wed, 30 Oct 2019 14:50:35 +0100 Subject: [ASTImporter] Add support for BuiltinTemplateDecl Summary: That decl kind is currently not implemented. BuiltinTemplateDecl is for decls that are hardcoded in the ASTContext, so we can import them like we do other builtin decls by just taking the equivalent decl from the target ASTContext. Reviewers: martong, a.sidorin, shafik Reviewed By: martong, shafik Subscribers: rnkovacs, kristina, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69566 --- clang/lib/AST/ASTImporter.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'clang/lib') diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp index 54acca7dc62..9477e414cf5 100644 --- a/clang/lib/AST/ASTImporter.cpp +++ b/clang/lib/AST/ASTImporter.cpp @@ -44,6 +44,7 @@ #include "clang/AST/TypeLoc.h" #include "clang/AST/TypeVisitor.h" #include "clang/AST/UnresolvedSet.h" +#include "clang/Basic/Builtins.h" #include "clang/Basic/ExceptionSpecificationType.h" #include "clang/Basic/FileManager.h" #include "clang/Basic/IdentifierTable.h" @@ -483,6 +484,7 @@ namespace clang { ExpectedDecl VisitUsingDirectiveDecl(UsingDirectiveDecl *D); ExpectedDecl VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D); ExpectedDecl VisitUnresolvedUsingTypenameDecl(UnresolvedUsingTypenameDecl *D); + ExpectedDecl VisitBuiltinTemplateDecl(BuiltinTemplateDecl *D); Expected ImportObjCTypeParamList(ObjCTypeParamList *list); @@ -4464,6 +4466,20 @@ ExpectedDecl ASTNodeImporter::VisitUnresolvedUsingTypenameDecl( return ToUsing; } +ExpectedDecl ASTNodeImporter::VisitBuiltinTemplateDecl(BuiltinTemplateDecl *D) { + Decl* ToD = nullptr; + switch (D->getBuiltinTemplateKind()) { + case BuiltinTemplateKind::BTK__make_integer_seq: + ToD = Importer.getToContext().getMakeIntegerSeqDecl(); + break; + case BuiltinTemplateKind::BTK__type_pack_element: + ToD = Importer.getToContext().getTypePackElementDecl(); + break; + } + assert(ToD && "BuiltinTemplateDecl of unsupported kind!"); + Importer.MapImported(D, ToD); + return ToD; +} Error ASTNodeImporter::ImportDefinition( ObjCInterfaceDecl *From, ObjCInterfaceDecl *To, ImportDefinitionKind Kind) { -- cgit v1.2.3