1 //===--- ModuleLoader.h - Module Loader Interface ---------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines the ModuleLoader interface, which is responsible for
11 // loading named modules.
13 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CLANG_LEX_MODULE_LOADER_H
15 #define LLVM_CLANG_LEX_MODULE_LOADER_H
17 #include "clang/Basic/SourceLocation.h"
23 /// \brief An opaque key that is used to describe the module and can be
24 /// interpreted by the module loader itself.
25 typedef void *ModuleKey;
27 /// \brief Abstract interface for a module loader.
29 /// This abstract interface describes a module loader, which is responsible
30 /// for resolving a module name (e.g., "std") to an actual module file, and
31 /// then loading that module.
34 virtual ~ModuleLoader();
36 /// \brief Attempt to load the given module.
38 /// This routine attempts to load the module described by the given
41 /// \param ImportLoc The location of the 'import' keyword.
42 /// \param ModuleName The name of the module to be loaded.
43 /// \param ModuleNameLoc The location of the module name.
45 /// \returns If successful, a non-NULL module key describing this module.
46 /// Otherwise, returns NULL to indicate that the module could not be
48 virtual ModuleKey loadModule(SourceLocation ImportLoc,
49 IdentifierInfo &ModuleName,
50 SourceLocation ModuleNameLoc) = 0;