aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Lex
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/Lex')
-rw-r--r--include/clang/Lex/DirectoryLookup.h8
-rw-r--r--include/clang/Lex/HeaderSearch.h10
-rw-r--r--include/clang/Lex/ModuleLoader.h12
-rw-r--r--include/clang/Lex/ModuleMap.h79
-rw-r--r--include/clang/Lex/Preprocessor.h2
5 files changed, 16 insertions, 95 deletions
diff --git a/include/clang/Lex/DirectoryLookup.h b/include/clang/Lex/DirectoryLookup.h
index d2764e7edd..47fb7d28e4 100644
--- a/include/clang/Lex/DirectoryLookup.h
+++ b/include/clang/Lex/DirectoryLookup.h
@@ -14,7 +14,6 @@
#ifndef LLVM_CLANG_LEX_DIRECTORYLOOKUP_H
#define LLVM_CLANG_LEX_DIRECTORYLOOKUP_H
-#include "clang/Lex/ModuleMap.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/SourceManager.h"
@@ -23,7 +22,8 @@ class HeaderMap;
class DirectoryEntry;
class FileEntry;
class HeaderSearch;
-
+class Module;
+
/// DirectoryLookup - This class represents one entry in the search list that
/// specifies the search order for directories in #include directives. It
/// represents either a directory, a framework, or a headermap.
@@ -151,7 +151,7 @@ public:
SmallVectorImpl<char> *SearchPath,
SmallVectorImpl<char> *RelativePath,
StringRef BuildingModule,
- ModuleMap::Module **SuggestedModule) const;
+ Module **SuggestedModule) const;
private:
const FileEntry *DoFrameworkLookup(
@@ -159,7 +159,7 @@ private:
SmallVectorImpl<char> *SearchPath,
SmallVectorImpl<char> *RelativePath,
StringRef BuildingModule,
- ModuleMap::Module **SuggestedModule) const;
+ Module **SuggestedModule) const;
};
diff --git a/include/clang/Lex/HeaderSearch.h b/include/clang/Lex/HeaderSearch.h
index 79de453a59..fba3606f44 100644
--- a/include/clang/Lex/HeaderSearch.h
+++ b/include/clang/Lex/HeaderSearch.h
@@ -275,7 +275,7 @@ public:
const FileEntry *CurFileEnt,
SmallVectorImpl<char> *SearchPath,
SmallVectorImpl<char> *RelativePath,
- ModuleMap::Module **SuggestedModule,
+ Module **SuggestedModule,
bool SkipCache = false);
/// LookupSubframeworkHeader - Look up a subframework for the specified
@@ -359,7 +359,7 @@ public:
/// \returns A file describing the named module, if already available in the
/// cases, or NULL to indicate that the module could not be found.
const FileEntry *lookupModule(StringRef ModuleName,
- ModuleMap::Module *&Module,
+ Module *&Module,
std::string *ModuleFileName = 0);
void IncrementFrameworkLookupCount() { ++NumFrameworkLookups; }
@@ -374,7 +374,7 @@ public:
bool hasModuleMap(StringRef Filename, const DirectoryEntry *Root);
/// \brief Retrieve the module that corresponds to the given file, if any.
- ModuleMap::Module *findModuleForHeader(const FileEntry *File);
+ Module *findModuleForHeader(const FileEntry *File);
/// \brief Read the contents of the given module map file.
@@ -394,7 +394,7 @@ public:
/// the header search path. Otherwise, the module must already be known.
///
/// \returns The module, if found; otherwise, null.
- ModuleMap::Module *getModule(StringRef Name, bool AllowSearch = true);
+ Module *getModule(StringRef Name, bool AllowSearch = true);
/// \brief Retrieve a module with the given name, which may be part of the
/// given framework.
@@ -404,7 +404,7 @@ public:
/// \param Dir The framework directory (e.g., ModuleName.framework).
///
/// \returns The module, if found; otherwise, null.
- ModuleMap::Module *getFrameworkModule(StringRef Name,
+ Module *getFrameworkModule(StringRef Name,
const DirectoryEntry *Dir);
/// \brief Retrieve the module map.
diff --git a/include/clang/Lex/ModuleLoader.h b/include/clang/Lex/ModuleLoader.h
index 42071080f7..6a7fe0204f 100644
--- a/include/clang/Lex/ModuleLoader.h
+++ b/include/clang/Lex/ModuleLoader.h
@@ -20,10 +20,7 @@
namespace clang {
class IdentifierInfo;
-
-/// \brief An opaque key that is used to describe the module and can be
-/// interpreted by the module loader itself.
-typedef void *ModuleKey;
+class Module;
/// \brief A sequence of identifier/location pairs used to describe a particular
/// module or submodule, e.g., std.vector.
@@ -47,10 +44,9 @@ public:
/// \param Path The identifiers (and their locations) of the module
/// "path", e.g., "std.vector" would be split into "std" and "vector".
///
- /// \returns If successful, a non-NULL module key describing this module.
- /// Otherwise, returns NULL to indicate that the module could not be
- /// loaded.
- virtual ModuleKey loadModule(SourceLocation ImportLoc, ModuleIdPath Path) = 0;
+ /// \returns If successful, returns the loaded module. Otherwise, returns
+ /// NULL to indicate that the module could not be loaded.
+ virtual Module *loadModule(SourceLocation ImportLoc, ModuleIdPath Path) = 0;
};
}
diff --git a/include/clang/Lex/ModuleMap.h b/include/clang/Lex/ModuleMap.h
index c5727a9c35..b93e65a4a5 100644
--- a/include/clang/Lex/ModuleMap.h
+++ b/include/clang/Lex/ModuleMap.h
@@ -17,6 +17,7 @@
#define LLVM_CLANG_LEX_MODULEMAP_H
#include "clang/Basic/LangOptions.h"
+#include "clang/Basic/Module.h"
#include "clang/Basic/SourceManager.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/IntrusiveRefCntPtr.h"
@@ -35,82 +36,6 @@ class DiagnosticsEngine;
class ModuleMapParser;
class ModuleMap {
-public:
- /// \brief Describes a module or submodule.
- struct Module {
- /// \brief The name of this module.
- std::string Name;
-
- /// \brief The location of the module definition.
- SourceLocation DefinitionLoc;
-
- /// \brief The parent of this module. This will be NULL for the top-level
- /// module.
- Module *Parent;
-
- /// \brief The umbrella header, if any.
- ///
- /// Only the top-level module can have an umbrella header.
- const FileEntry *UmbrellaHeader;
-
- /// \brief The submodules of this module, indexed by name.
- llvm::StringMap<Module *> SubModules;
-
- /// \brief The headers that are part of this module.
- llvm::SmallVector<const FileEntry *, 2> Headers;
-
- /// \brief Whether this is a framework module.
- bool IsFramework;
-
- /// \brief Whether this is an explicit submodule.
- bool IsExplicit;
-
- /// \brief Construct a top-level module.
- explicit Module(StringRef Name, SourceLocation DefinitionLoc,
- bool IsFramework)
- : Name(Name), DefinitionLoc(DefinitionLoc), Parent(0), UmbrellaHeader(0),
- IsFramework(IsFramework), IsExplicit(false) { }
-
- /// \brief Construct a new module or submodule.
- Module(StringRef Name, SourceLocation DefinitionLoc, Module *Parent,
- bool IsFramework, bool IsExplicit)
- : Name(Name), DefinitionLoc(DefinitionLoc), Parent(Parent),
- UmbrellaHeader(0), IsFramework(IsFramework), IsExplicit(IsExplicit) {
- }
-
- ~Module();
-
- /// \brief Determine whether this module is a submodule.
- bool isSubModule() const { return Parent != 0; }
-
- /// \brief Determine whether this module is a part of a framework,
- /// either because it is a framework module or because it is a submodule
- /// of a framework module.
- bool isPartOfFramework() const {
- for (const Module *Mod = this; Mod; Mod = Mod->Parent)
- if (Mod->IsFramework)
- return true;
-
- return false;
- }
-
- /// \brief Retrieve the full name of this module, including the path from
- /// its top-level module.
- std::string getFullModuleName() const;
-
- /// \brief Retrieve the name of the top-level module.
- ///
- StringRef getTopLevelModuleName() const;
-
- /// \brief Print the module map for this module to the given stream.
- ///
- void print(llvm::raw_ostream &OS, unsigned Indent = 0) const;
-
- /// \brief Dump the contents of this module to the given output stream.
- void dump() const;
- };
-
-private:
SourceManager *SourceMgr;
llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags;
LangOptions LangOpts;
@@ -192,7 +117,7 @@ public:
///
/// \returns The file entry for the module map file containing the given
/// module, or NULL if the module definition was inferred.
- const FileEntry *getContainingModuleMapFile(ModuleMap::Module *Module);
+ const FileEntry *getContainingModuleMapFile(Module *Module);
/// \brief Parse the given module map file, and record any modules we
/// encounter.
diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h
index 671d6ae986..0800ef3e45 100644
--- a/include/clang/Lex/Preprocessor.h
+++ b/include/clang/Lex/Preprocessor.h
@@ -1016,7 +1016,7 @@ public:
const DirectoryLookup *&CurDir,
SmallVectorImpl<char> *SearchPath,
SmallVectorImpl<char> *RelativePath,
- ModuleMap::Module **SuggestedModule,
+ Module **SuggestedModule,
bool SkipCache = false);
/// GetCurLookup - The DirectoryLookup structure used to find the current