void ASTImportSource::ImportDeclContext(DeclContext *declContextToImport, ASTImporter &importer, DeclarationName &childDeclName, DeclarationName &parentDeclName, const DeclContext *childCurrentDeclContext) { if (DeclContext *importedDeclContext = importer.ImportContext(declContextToImport)) { importedDeclContext->setHasExternalVisibleStorage(true); if (NamedDecl *importedNamedDecl = llvm::dyn_cast<NamedDecl>(importedDeclContext)) { std::vector < NamedDecl * > declVector{importedNamedDecl}; llvm::ArrayRef < NamedDecl * > FoundDecls(declVector); SetExternalVisibleDeclsForName(childCurrentDeclContext, importedNamedDecl->getDeclName(), FoundDecls); } // Put the name of the DeclContext imported with the // DeclarationName coming from the parent, in my map. m_DeclName_map[childDeclName] = parentDeclName; // And also put the declaration context I found from the parent Interpreter // in the map of the child Interpreter to have it for the future. m_DeclContexts_map[importedDeclContext] = declContextToImport; } }
void ASTImportSource::ImportDecl(Decl *declToImport, ASTImporter &importer, DeclarationName &childDeclName, DeclarationName &parentDeclName, const DeclContext *childCurrentDeclContext) { // Don't do the import if we have a Function Template. // Not supported by clang. // FIXME: This is also a temporary check. Will be de-activated // once clang supports the import of function templates. if (declToImport->isFunctionOrFunctionTemplate() && declToImport->isTemplateDecl()) return; if (Decl *importedDecl = importer.Import(declToImport)) { if (NamedDecl *importedNamedDecl = llvm::dyn_cast<NamedDecl>(importedDecl)) { std::vector < NamedDecl * > declVector{importedNamedDecl}; llvm::ArrayRef < NamedDecl * > FoundDecls(declVector); SetExternalVisibleDeclsForName(childCurrentDeclContext, importedNamedDecl->getDeclName(), FoundDecls); } // Put the name of the Decl imported with the // DeclarationName coming from the parent, in my map. m_DeclName_map[childDeclName] = parentDeclName; } }
void UpdateWithNewDeclsFwd(const DeclContext *DC, DeclarationName Name, llvm::ArrayRef<NamedDecl*> Decls) { SetExternalVisibleDeclsForName(DC, Name, Decls); }