]> CyberLeo.Net >> Repos - FreeBSD/releng/9.0.git/blob - contrib/llvm/tools/clang/include/clang/Lex/ModuleLoader.h
Copy stable/9 to releng/9.0 as part of the FreeBSD 9.0-RELEASE release
[FreeBSD/releng/9.0.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/SourceLocation.h"
18
19 namespace clang {
20
21 class IdentifierInfo;
22   
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;
26   
27 /// \brief Abstract interface for a module loader.
28 ///
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.
32 class ModuleLoader {
33 public:
34   virtual ~ModuleLoader();
35   
36   /// \brief Attempt to load the given module.
37   ///
38   /// This routine attempts to load the module described by the given 
39   /// parameters.
40   ///
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.
44   ///
45   /// \returns If successful, a non-NULL module key describing this module.
46   /// Otherwise, returns NULL to indicate that the module could not be
47   /// loaded.
48   virtual ModuleKey loadModule(SourceLocation ImportLoc, 
49                                IdentifierInfo &ModuleName,
50                                SourceLocation ModuleNameLoc) = 0;
51 };
52   
53 }
54
55 #endif