16aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor//===--- ModuleLoader.h - Module Loader Interface ---------------*- C++ -*-===// 26aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor// 36aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor// The LLVM Compiler Infrastructure 46aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor// 56aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor// This file is distributed under the University of Illinois Open Source 66aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor// License. See LICENSE.TXT for details. 76aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor// 86aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor//===----------------------------------------------------------------------===// 96aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor// 106aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor// This file defines the ModuleLoader interface, which is responsible for 116aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor// loading named modules. 126aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor// 136aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor//===----------------------------------------------------------------------===// 146aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor#ifndef LLVM_CLANG_LEX_MODULE_LOADER_H 156aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor#define LLVM_CLANG_LEX_MODULE_LOADER_H 166aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor 175e35693721364673f8196e4f5a370f56b92e6053Douglas Gregor#include "clang/Basic/Module.h" 186aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor#include "clang/Basic/SourceLocation.h" 193d3589db579f7695667b913c5043dd264ebe546fDouglas Gregor#include "llvm/ADT/ArrayRef.h" 206aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor 216aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregornamespace clang { 226aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor 236aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregorclass IdentifierInfo; 246aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor 253d3589db579f7695667b913c5043dd264ebe546fDouglas Gregor/// \brief A sequence of identifier/location pairs used to describe a particular 263d3589db579f7695667b913c5043dd264ebe546fDouglas Gregor/// module or submodule, e.g., std.vector. 27c5b2e58840748145d1706c1d1481369d1863fabfDouglas Gregortypedef llvm::ArrayRef<std::pair<IdentifierInfo*, SourceLocation> > 28c5b2e58840748145d1706c1d1481369d1863fabfDouglas Gregor ModuleIdPath; 293d3589db579f7695667b913c5043dd264ebe546fDouglas Gregor 306aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor/// \brief Abstract interface for a module loader. 316aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor/// 326aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor/// This abstract interface describes a module loader, which is responsible 336aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor/// for resolving a module name (e.g., "std") to an actual module file, and 346aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor/// then loading that module. 356aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregorclass ModuleLoader { 366aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregorpublic: 376aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor virtual ~ModuleLoader(); 386aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor 396aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor /// \brief Attempt to load the given module. 406aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor /// 416aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor /// This routine attempts to load the module described by the given 426aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor /// parameters. 436aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor /// 446aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor /// \param ImportLoc The location of the 'import' keyword. 455e35693721364673f8196e4f5a370f56b92e6053Douglas Gregor /// 463d3589db579f7695667b913c5043dd264ebe546fDouglas Gregor /// \param Path The identifiers (and their locations) of the module 473d3589db579f7695667b913c5043dd264ebe546fDouglas Gregor /// "path", e.g., "std.vector" would be split into "std" and "vector". 485e35693721364673f8196e4f5a370f56b92e6053Douglas Gregor /// 495e35693721364673f8196e4f5a370f56b92e6053Douglas Gregor /// \param Visibility The visibility provided for the names in the loaded 505e35693721364673f8196e4f5a370f56b92e6053Douglas Gregor /// module. 516aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor /// 5293ebfa6139bbca4d446c7343e3afc8e5ec777484Douglas Gregor /// \param IsInclusionDirective Indicates that this module is being loaded 5393ebfa6139bbca4d446c7343e3afc8e5ec777484Douglas Gregor /// implicitly, due to the presence of an inclusion directive. Otherwise, 5493ebfa6139bbca4d446c7343e3afc8e5ec777484Douglas Gregor /// it is being loaded due to an import declaration. 5593ebfa6139bbca4d446c7343e3afc8e5ec777484Douglas Gregor /// 561a4761edca58c6b559de825b9abfb66f7f1ba94aDouglas Gregor /// \returns If successful, returns the loaded module. Otherwise, returns 571a4761edca58c6b559de825b9abfb66f7f1ba94aDouglas Gregor /// NULL to indicate that the module could not be loaded. 585e35693721364673f8196e4f5a370f56b92e6053Douglas Gregor virtual Module *loadModule(SourceLocation ImportLoc, ModuleIdPath Path, 5993ebfa6139bbca4d446c7343e3afc8e5ec777484Douglas Gregor Module::NameVisibilityKind Visibility, 6093ebfa6139bbca4d446c7343e3afc8e5ec777484Douglas Gregor bool IsInclusionDirective) = 0; 616aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor}; 626aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor 636aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor} 646aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor 656aa52ec6b969faabf3764baf79d89810b8249a7eDouglas Gregor#endif 66