clang API Documentation
00001 //===--- ModuleLoader.h - Module Loader Interface ---------------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file defines the ModuleLoader interface, which is responsible for 00011 // loading named modules. 00012 // 00013 //===----------------------------------------------------------------------===// 00014 #ifndef LLVM_CLANG_LEX_MODULE_LOADER_H 00015 #define LLVM_CLANG_LEX_MODULE_LOADER_H 00016 00017 #include "clang/Basic/Module.h" 00018 #include "clang/Basic/SourceLocation.h" 00019 #include "llvm/ADT/ArrayRef.h" 00020 00021 namespace clang { 00022 00023 class IdentifierInfo; 00024 00025 /// \brief A sequence of identifier/location pairs used to describe a particular 00026 /// module or submodule, e.g., std.vector. 00027 typedef llvm::ArrayRef<std::pair<IdentifierInfo*, SourceLocation> > 00028 ModuleIdPath; 00029 00030 /// \brief Abstract interface for a module loader. 00031 /// 00032 /// This abstract interface describes a module loader, which is responsible 00033 /// for resolving a module name (e.g., "std") to an actual module file, and 00034 /// then loading that module. 00035 class ModuleLoader { 00036 public: 00037 virtual ~ModuleLoader(); 00038 00039 /// \brief Attempt to load the given module. 00040 /// 00041 /// This routine attempts to load the module described by the given 00042 /// parameters. 00043 /// 00044 /// \param ImportLoc The location of the 'import' keyword. 00045 /// 00046 /// \param Path The identifiers (and their locations) of the module 00047 /// "path", e.g., "std.vector" would be split into "std" and "vector". 00048 /// 00049 /// \param Visibility The visibility provided for the names in the loaded 00050 /// module. 00051 /// 00052 /// \param IsInclusionDirective Indicates that this module is being loaded 00053 /// implicitly, due to the presence of an inclusion directive. Otherwise, 00054 /// it is being loaded due to an import declaration. 00055 /// 00056 /// \returns If successful, returns the loaded module. Otherwise, returns 00057 /// NULL to indicate that the module could not be loaded. 00058 virtual Module *loadModule(SourceLocation ImportLoc, ModuleIdPath Path, 00059 Module::NameVisibilityKind Visibility, 00060 bool IsInclusionDirective) = 0; 00061 }; 00062 00063 } 00064 00065 #endif