]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/blob - contrib/llvm/tools/clang/include/clang/Lex/ModuleLoader.h
MFC r234353:
[FreeBSD/stable/9.git] / contrib / llvm / tools / clang / include / clang / Lex / ModuleLoader.h
1 //===--- ModuleLoader.h - Module Loader Interface ---------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 //  This file defines the ModuleLoader interface, which is responsible for 
11 //  loading named modules.
12 //
13 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CLANG_LEX_MODULE_LOADER_H
15 #define LLVM_CLANG_LEX_MODULE_LOADER_H
16
17 #include "clang/Basic/Module.h"
18 #include "clang/Basic/SourceLocation.h"
19 #include "llvm/ADT/ArrayRef.h"
20
21 namespace clang {
22
23 class IdentifierInfo;
24   
25 /// \brief A sequence of identifier/location pairs used to describe a particular
26 /// module or submodule, e.g., std.vector.
27 typedef llvm::ArrayRef<std::pair<IdentifierInfo*, SourceLocation> > 
28   ModuleIdPath;
29   
30 /// \brief Abstract interface for a module loader.
31 ///
32 /// This abstract interface describes a module loader, which is responsible
33 /// for resolving a module name (e.g., "std") to an actual module file, and
34 /// then loading that module.
35 class ModuleLoader {
36 public:
37   virtual ~ModuleLoader();
38   
39   /// \brief Attempt to load the given module.
40   ///
41   /// This routine attempts to load the module described by the given 
42   /// parameters.
43   ///
44   /// \param ImportLoc The location of the 'import' keyword.
45   ///
46   /// \param Path The identifiers (and their locations) of the module
47   /// "path", e.g., "std.vector" would be split into "std" and "vector".
48   /// 
49   /// \param Visibility The visibility provided for the names in the loaded
50   /// module.
51   ///
52   /// \param IsInclusionDirective Indicates that this module is being loaded
53   /// implicitly, due to the presence of an inclusion directive. Otherwise,
54   /// it is being loaded due to an import declaration.
55   ///
56   /// \returns If successful, returns the loaded module. Otherwise, returns 
57   /// NULL to indicate that the module could not be loaded.
58   virtual Module *loadModule(SourceLocation ImportLoc, ModuleIdPath Path,
59                              Module::NameVisibilityKind Visibility,
60                              bool IsInclusionDirective) = 0;
61 };
62   
63 }
64
65 #endif