aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-11-30 23:21:26 +0000
committerDouglas Gregor <dgregor@apple.com>2011-11-30 23:21:26 +0000
commit1a4761edca58c6b559de825b9abfb66f7f1ba94a (patch)
treebd17d1a3341870f9378db26a09045b3bb2db8426
parent8d39c3ddfc17d9e768a17eb0ce9f11c33bf9d50a (diff)
Promote ModuleMap::Module to a namespace-scope class in the Basic
library, since modules cut across all of the libraries. Rename serialization::Module to serialization::ModuleFile to side-step the annoying naming conflict. Prune a bunch of ModuleMap.h includes that are no longer needed (most files only needed the Module type). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145538 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Basic/Module.h108
-rw-r--r--include/clang/Frontend/ASTUnit.h2
-rw-r--r--include/clang/Frontend/CompilerInstance.h8
-rw-r--r--include/clang/Frontend/FrontendActions.h5
-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
-rw-r--r--include/clang/Serialization/ASTReader.h150
-rw-r--r--include/clang/Serialization/ASTWriter.h14
-rw-r--r--include/clang/Serialization/Module.h16
-rw-r--r--include/clang/Serialization/ModuleManager.h26
-rw-r--r--lib/Basic/CMakeLists.txt1
-rw-r--r--lib/Basic/Module.cpp91
-rw-r--r--lib/CodeGen/CodeGenAction.cpp2
-rw-r--r--lib/Frontend/ASTUnit.cpp2
-rw-r--r--lib/Frontend/CompilerInstance.cpp14
-rw-r--r--lib/Frontend/FrontendActions.cpp4
-rw-r--r--lib/Lex/HeaderSearch.cpp26
-rw-r--r--lib/Lex/ModuleMap.cpp94
-rw-r--r--lib/Lex/PPDirectives.cpp6
-rw-r--r--lib/Sema/SemaDecl.cpp6
-rw-r--r--lib/Serialization/ASTReader.cpp154
-rw-r--r--lib/Serialization/ASTReaderDecl.cpp34
-rw-r--r--lib/Serialization/ASTReaderInternals.h18
-rw-r--r--lib/Serialization/ASTReaderStmt.cpp10
-rw-r--r--lib/Serialization/ASTWriter.cpp12
-rw-r--r--lib/Serialization/GeneratePCH.cpp2
-rw-r--r--lib/Serialization/Module.cpp6
-rw-r--r--lib/Serialization/ModuleManager.cpp50
31 files changed, 507 insertions, 465 deletions
diff --git a/include/clang/Basic/Module.h b/include/clang/Basic/Module.h
new file mode 100644
index 0000000000..4f5280738f
--- /dev/null
+++ b/include/clang/Basic/Module.h
@@ -0,0 +1,108 @@
+//===--- Module.h - Describe a module ---------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines the Module class, which describes a module in the source
+// code.
+//
+//===----------------------------------------------------------------------===//
+#ifndef LLVM_CLANG_BASIC_MODULE_H
+#define LLVM_CLANG_BASIC_MODULE_H
+
+#include "clang/Basic/SourceLocation.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/StringRef.h"
+#include <string>
+
+namespace llvm {
+ class raw_ostream;
+}
+
+namespace clang {
+
+class FileEntry;
+
+/// \brief Describes a module or submodule.
+class Module {
+public:
+ /// \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;
+};
+
+} // end namespace clang
+
+
+#endif // LLVM_CLANG_BASIC_MODULE_H
diff --git a/include/clang/Frontend/ASTUnit.h b/include/clang/Frontend/ASTUnit.h
index c29b07440f..4cab303ba4 100644
--- a/include/clang/Frontend/ASTUnit.h
+++ b/include/clang/Frontend/ASTUnit.h
@@ -781,7 +781,7 @@ public:
/// \returns True if an error occurred, false otherwise.
bool serialize(raw_ostream &OS);
- virtual ModuleKey loadModule(SourceLocation ImportLoc, ModuleIdPath Path) {
+ virtual Module *loadModule(SourceLocation ImportLoc, ModuleIdPath Path) {
// ASTUnit doesn't know how to load modules (not that this matters).
return 0;
}
diff --git a/include/clang/Frontend/CompilerInstance.h b/include/clang/Frontend/CompilerInstance.h
index 90f84ef379..9cd09ee10c 100644
--- a/include/clang/Frontend/CompilerInstance.h
+++ b/include/clang/Frontend/CompilerInstance.h
@@ -12,7 +12,6 @@
#include "clang/Frontend/CompilerInvocation.h"
#include "clang/Lex/ModuleLoader.h"
-#include "clang/Lex/ModuleMap.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/IntrusiveRefCntPtr.h"
@@ -39,6 +38,7 @@ class ExternalASTSource;
class FileEntry;
class FileManager;
class FrontendAction;
+class Module;
class Preprocessor;
class Sema;
class SourceManager;
@@ -101,7 +101,7 @@ class CompilerInstance : public ModuleLoader {
/// \brief The set of top-level modules that has already been loaded,
/// along with the module map
- llvm::DenseMap<const IdentifierInfo *, ModuleMap::Module *> KnownModules;
+ llvm::DenseMap<const IdentifierInfo *, Module *> KnownModules;
/// \brief The location of the module-import keyword for the last module
/// import.
@@ -109,7 +109,7 @@ class CompilerInstance : public ModuleLoader {
/// \brief The result of the last module import.
///
- ModuleMap::Module *LastModuleImportResult;
+ Module *LastModuleImportResult;
/// \brief Holds information about the output file.
///
@@ -641,7 +641,7 @@ public:
/// }
- virtual ModuleKey loadModule(SourceLocation ImportLoc, ModuleIdPath Path);
+ virtual Module *loadModule(SourceLocation ImportLoc, ModuleIdPath Path);
};
} // end namespace clang
diff --git a/include/clang/Frontend/FrontendActions.h b/include/clang/Frontend/FrontendActions.h
index bf071b3a51..c0ed9fa410 100644
--- a/include/clang/Frontend/FrontendActions.h
+++ b/include/clang/Frontend/FrontendActions.h
@@ -11,12 +11,13 @@
#define LLVM_CLANG_FRONTEND_FRONTENDACTIONS_H
#include "clang/Frontend/FrontendAction.h"
-#include "clang/Lex/ModuleMap.h"
#include <string>
#include <vector>
namespace clang {
+class Module;
+
//===----------------------------------------------------------------------===//
// Custom Consumer Actions
//===----------------------------------------------------------------------===//
@@ -93,7 +94,7 @@ public:
};
class GenerateModuleAction : public ASTFrontendAction {
- ModuleMap::Module *Module;
+ Module *Module;
protected:
virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
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
diff --git a/include/clang/Serialization/ASTReader.h b/include/clang/Serialization/ASTReader.h
index 8f7148d296..c38ceb94c5 100644
--- a/include/clang/Serialization/ASTReader.h
+++ b/include/clang/Serialization/ASTReader.h
@@ -206,7 +206,7 @@ public:
friend class ASTUnit; // ASTUnit needs to remap source locations.
friend class serialization::ReadMethodPoolVisitor;
- typedef serialization::Module Module;
+ typedef serialization::ModuleFile ModuleFile;
typedef serialization::ModuleKind ModuleKind;
typedef serialization::ModuleManager ModuleManager;
@@ -243,12 +243,12 @@ private:
/// \brief A map of global bit offsets to the module that stores entities
/// at those bit offsets.
- ContinuousRangeMap<uint64_t, Module*, 4> GlobalBitOffsetsMap;
+ ContinuousRangeMap<uint64_t, ModuleFile*, 4> GlobalBitOffsetsMap;
/// \brief A map of negated SLocEntryIDs to the modules containing them.
- ContinuousRangeMap<unsigned, Module*, 64> GlobalSLocEntryMap;
+ ContinuousRangeMap<unsigned, ModuleFile*, 64> GlobalSLocEntryMap;
- typedef ContinuousRangeMap<unsigned, Module*, 64> GlobalSLocOffsetMapType;
+ typedef ContinuousRangeMap<unsigned, ModuleFile*, 64> GlobalSLocOffsetMapType;
/// \brief A map of reversed (SourceManager::MaxLoadedOffset - SLocOffset)
/// SourceLocation offsets to the modules containing them.
@@ -260,7 +260,7 @@ private:
/// ID = (I + 1) << FastQual::Width has already been loaded
std::vector<QualType> TypesLoaded;
- typedef ContinuousRangeMap<serialization::TypeID, Module *, 4>
+ typedef ContinuousRangeMap<serialization::TypeID, ModuleFile *, 4>
GlobalTypeMapType;
/// \brief Mapping from global type IDs to the module in which the
@@ -274,14 +274,14 @@ private:
/// = I + 1 has already been loaded.
std::vector<Decl *> DeclsLoaded;
- typedef ContinuousRangeMap<serialization::DeclID, Module *, 4>
+ typedef ContinuousRangeMap<serialization::DeclID, ModuleFile *, 4>
GlobalDeclMapType;
/// \brief Mapping from global declaration IDs to the module in which the
/// declaration resides.
GlobalDeclMapType GlobalDeclMap;
- typedef std::pair<Module *, uint64_t> FileOffset;
+ typedef std::pair<ModuleFile *, uint64_t> FileOffset;
typedef SmallVector<FileOffset, 2> FileOffsetsTy;
typedef llvm::DenseMap<serialization::DeclID, FileOffsetsTy>
DeclUpdateOffsetsMap;
@@ -291,12 +291,12 @@ private:
DeclUpdateOffsetsMap DeclUpdateOffsets;
struct ReplacedDeclInfo {
- Module *Mod;
+ ModuleFile *Mod;
uint64_t Offset;
unsigned RawLoc;
ReplacedDeclInfo() : Mod(0), Offset(0), RawLoc(0) {}
- ReplacedDeclInfo(Module *Mod, uint64_t Offset, unsigned RawLoc)
+ ReplacedDeclInfo(ModuleFile *Mod, uint64_t Offset, unsigned RawLoc)
: Mod(Mod), Offset(Offset), RawLoc(RawLoc) {}
};
@@ -306,11 +306,11 @@ private:
DeclReplacementMap ReplacedDecls;
struct FileDeclsInfo {
- Module *Mod;
+ ModuleFile *Mod;
ArrayRef<serialization::LocalDeclID> Decls;
FileDeclsInfo() : Mod(0) {}
- FileDeclsInfo(Module *Mod, ArrayRef<serialization::LocalDeclID> Decls)
+ FileDeclsInfo(ModuleFile *Mod, ArrayRef<serialization::LocalDeclID> Decls)
: Mod(Mod), Decls(Decls) {}
};
@@ -321,7 +321,7 @@ private:
// TU, and when we read those update records, the actual context will not
// be available yet (unless it's the TU), so have this pending map using the
// ID as a key. It will be realized when the context is actually loaded.
- typedef SmallVector<std::pair<void *, Module*>, 1> DeclContextVisibleUpdates;
+ typedef SmallVector<std::pair<void *, ModuleFile*>, 1> DeclContextVisibleUpdates;
typedef llvm::DenseMap<serialization::DeclID, DeclContextVisibleUpdates>
DeclContextVisibleUpdatesPending;
@@ -348,7 +348,7 @@ private:
llvm::DenseSet<serialization::GlobalDeclID> ObjCChainedCategoriesInterfaces;
/// \brief Read the records that describe the contents of declcontexts.
- bool ReadDeclContextStorage(Module &M,
+ bool ReadDeclContextStorage(ModuleFile &M,
llvm::BitstreamCursor &Cursor,
const std::pair<uint64_t, uint64_t> &Offsets,
serialization::DeclContextInfo &Info);
@@ -361,7 +361,7 @@ private:
/// been loaded.
std::vector<IdentifierInfo *> IdentifiersLoaded;
- typedef ContinuousRangeMap<serialization::IdentID, Module *, 4>
+ typedef ContinuousRangeMap<serialization::IdentID, ModuleFile *, 4>
GlobalIdentifierMapType;
/// \brief Mapping from global identifer IDs to the module in which the
@@ -376,7 +376,7 @@ private:
/// been loaded.
SmallVector<Selector, 16> SelectorsLoaded;
- typedef ContinuousRangeMap<serialization::SelectorID, Module *, 4>
+ typedef ContinuousRangeMap<serialization::SelectorID, ModuleFile *, 4>
GlobalSelectorMapType;
/// \brief Mapping from global selector IDs to the module in which the
@@ -389,7 +389,7 @@ private:
/// record resides.
llvm::DenseMap<IdentifierInfo *, uint64_t> UnreadMacroRecordOffsets;
- typedef ContinuousRangeMap<unsigned, Module *, 4>
+ typedef ContinuousRangeMap<unsigned, ModuleFile *, 4>
GlobalPreprocessedEntityMapType;
/// \brief Mapping from global preprocessing entity IDs to the module in
@@ -675,7 +675,7 @@ private:
std::string SuggestedPredefines;
/// \brief Reads a statement from the specified cursor.
- Stmt *ReadStmtFromStream(Module &F);
+ Stmt *ReadStmtFromStream(ModuleFile &F);
/// \brief Get a FileEntry out of stored-in-PCH filename, making sure we take
/// into account all the necessary relocations.
@@ -684,21 +684,21 @@ private:
void MaybeAddSystemRootToFilename(std::string &Filename);
ASTReadResult ReadASTCore(StringRef FileName, ModuleKind Type,
- Module *ImportedBy);
- ASTReadResult ReadASTBlock(Module &F);
+ ModuleFile *ImportedBy);
+ ASTReadResult ReadASTBlock(ModuleFile &F);
bool CheckPredefinesBuffers();
- bool ParseLineTable(Module &F, SmallVectorImpl<uint64_t> &Record);
- ASTReadResult ReadSourceManagerBlock(Module &F);
+ bool ParseLineTable(ModuleFile &F, SmallVectorImpl<uint64_t> &Record);
+ ASTReadResult ReadSourceManagerBlock(ModuleFile &F);
ASTReadResult ReadSLocEntryRecord(int ID);
llvm::BitstreamCursor &SLocCursorForID(int ID);
- SourceLocation getImportLocation(Module *F);
- ASTReadResult ReadSubmoduleBlock(Module &F);
+ SourceLocation getImportLocation(ModuleFile *F);
+ ASTReadResult ReadSubmoduleBlock(ModuleFile &F);
bool ParseLanguageOptions(const SmallVectorImpl<uint64_t> &Record);
struct RecordLocation {
- RecordLocation(Module *M, uint64_t O)
+ RecordLocation(ModuleFile *M, uint64_t O)
: F(M), Offset(O) {}
- Module *F;
+ ModuleFile *F;
uint64_t Offset;
};
@@ -713,7 +713,7 @@ private:
ObjCInterfaceDecl *D);
RecordLocation getLocalBitOffset(uint64_t GlobalOffset);
- uint64_t getGlobalBitOffset(Module &M, uint32_t LocalOffset);
+ uint64_t getGlobalBitOffset(ModuleFile &M, uint32_t LocalOffset);
/// \brief Returns the first preprocessed entity ID that ends after \arg BLoc.
serialization::PreprocessedEntityID
@@ -732,9 +732,9 @@ private:
findNextPreprocessedEntity(
GlobalSLocOffsetMapType::const_iterator SLocMapI) const;
- /// \brief Returns (Module, Local index) pair for \arg GlobalIndex of a
+ /// \brief Returns (ModuleFile, Local index) pair for \arg GlobalIndex of a
/// preprocessed entity.
- std::pair<Module *, unsigned>
+ std::pair<ModuleFile *, unsigned>
getModulePreprocessedEntity(unsigned GlobalIndex);
void PassInterestingDeclsToConsumer();
@@ -787,7 +787,7 @@ public:
/// \brief Checks that no file that is stored in PCH is out-of-sync with
/// the actual file in the file system.
- ASTReadResult validateFileEntries(Module &M);
+ ASTReadResult validateFileEntries(ModuleFile &M);
/// \brief Set the AST callbacks listener.
void setListener(ASTReaderListener *listener) {
@@ -891,16 +891,16 @@ public:
/// \brief Reads a TemplateArgumentLocInfo appropriate for the
/// given TemplateArgument kind.
TemplateArgumentLocInfo
- GetTemplateArgumentLocInfo(Module &F, TemplateArgument::ArgKind Kind,
+ GetTemplateArgumentLocInfo(ModuleFile &F, TemplateArgument::ArgKind Kind,
const RecordData &Record, unsigned &Idx);
/// \brief Reads a TemplateArgumentLoc.
TemplateArgumentLoc
- ReadTemplateArgumentLoc(Module &F,
+ ReadTemplateArgumentLoc(ModuleFile &F,
const RecordData &Record, unsigned &Idx);
/// \brief Reads a declarator info from the given record.
- TypeSourceInfo *GetTypeSourceInfo(Module &F,
+ TypeSourceInfo *GetTypeSourceInfo(ModuleFile &F,
const RecordData &Record, unsigned &Idx);
/// \brief Resolve a type ID into a type, potentially building a new
@@ -908,14 +908,14 @@ public:
QualType GetType(serialization::TypeID ID);
/// \brief Resolve a local type ID within a given AST file into a type.
- QualType getLocalType(Module &F, unsigned LocalID);
+ QualType getLocalType(ModuleFile &F, unsigned LocalID);
/// \brief Map a local type ID within a given AST file into a global type ID.
- serialization::TypeID getGlobalTypeID(Module &F, unsigned LocalID) const;
+ serialization::TypeID getGlobalTypeID(ModuleFile &F, unsigned LocalID) const;
/// \brief Read a type from the current position in the given record, which
/// was read from the given AST file.
- QualType readType(Module &F, const RecordData &Record, unsigned &Idx) {
+ QualType readType(ModuleFile &F, const RecordData &Record, unsigned &Idx) {
if (Idx >= Record.size())
return QualType();
@@ -924,11 +924,11 @@ public:
/// \brief Map from a local declaration ID within a given module to a
/// global declaration ID.
- serialization::DeclID getGlobalDeclID(Module &F, unsigned LocalID) const;
+ serialization::DeclID getGlobalDeclID(ModuleFile &F, unsigned LocalID) const;
/// \brief Returns true if global DeclID \arg ID originated from module
/// \arg M.
- bool isDeclIDFromModule(serialization::GlobalDeclID ID, Module &M) const;
+ bool isDeclIDFromModule(serialization::GlobalDeclID ID, ModuleFile &M) const;
/// \brief Returns the source location for the decl \arg ID.
SourceLocation getSourceLocationForDeclID(serialization::GlobalDeclID ID);
@@ -939,7 +939,7 @@ public:
virtual Decl *GetExternalDecl(uint32_t ID);
/// \brief Reads a declaration with the given local ID in the given module.
- Decl *GetLocalDecl(Module &F, uint32_t LocalID) {
+ Decl *GetLocalDecl(ModuleFile &F, uint32_t LocalID) {
return GetDecl(getGlobalDeclID(F, LocalID));
}
@@ -947,7 +947,7 @@ public:
///
/// \returns The requested declaration, casted to the given return type.
template<typename T>
- T *GetLocalDeclAs(Module &F, uint32_t LocalID) {
+ T *GetLocalDeclAs(ModuleFile &F, uint32_t LocalID) {
return cast_or_null<T>(GetLocalDecl(F, LocalID));
}
@@ -955,12 +955,12 @@ public:
/// given module.
///
/// \returns The declaration ID read from the record, adjusted to a global ID.
- serialization::DeclID ReadDeclID(Module &F, const RecordData &Record,
+ serialization::DeclID ReadDeclID(ModuleFile &F, const RecordData &Record,
unsigned &Idx);
/// \brief Reads a declaration from the given position in a record in the
/// given module.
- Decl *ReadDecl(Module &F, const RecordData &R, unsigned &I) {
+ Decl *ReadDecl(ModuleFile &F, const RecordData &R, unsigned &I) {
return GetDecl(ReadDeclID(F, R, I));
}
<