aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/clang/Frontend/CompilerInstance.h10
-rw-r--r--include/clang/Lex/ModuleMap.h18
-rw-r--r--include/clang/Serialization/ASTBitCodes.h17
-rw-r--r--include/clang/Serialization/ASTReader.h3
-rw-r--r--include/clang/Serialization/ASTWriter.h5
-rw-r--r--include/clang/Serialization/Module.h4
6 files changed, 47 insertions, 10 deletions
diff --git a/include/clang/Frontend/CompilerInstance.h b/include/clang/Frontend/CompilerInstance.h
index 09b27e14df..90f84ef379 100644
--- a/include/clang/Frontend/CompilerInstance.h
+++ b/include/clang/Frontend/CompilerInstance.h
@@ -99,15 +99,9 @@ class CompilerInstance : public ModuleLoader {
/// \brief Non-owning reference to the ASTReader, if one exists.
ASTReader *ModuleManager;
- /// \brief A module that we have already attempted to load, which is known
- /// by either a file entry (FIXME: a temporary measure) or via its module
- /// definition.
- typedef llvm::PointerUnion<const FileEntry *, ModuleMap::Module *>
- KnownModule;
-
/// \brief The set of top-level modules that has already been loaded,
/// along with the module map
- llvm::DenseMap<const IdentifierInfo *, KnownModule> KnownModules;
+ llvm::DenseMap<const IdentifierInfo *, ModuleMap::Module *> KnownModules;
/// \brief The location of the module-import keyword for the last module
/// import.
@@ -115,7 +109,7 @@ class CompilerInstance : public ModuleLoader {
/// \brief The result of the last module import.
///
- KnownModule LastModuleImportResult;
+ ModuleMap::Module *LastModuleImportResult;
/// \brief Holds information about the output file.
///
diff --git a/include/clang/Lex/ModuleMap.h b/include/clang/Lex/ModuleMap.h
index 4f89f1e728..c5727a9c35 100644
--- a/include/clang/Lex/ModuleMap.h
+++ b/include/clang/Lex/ModuleMap.h
@@ -162,6 +162,24 @@ public:
/// \returns The named module, if known; otherwise, returns null.
Module *findModule(StringRef Name);
+ /// \brief Find a new module or submodule, or create it if it does not already
+ /// exist.
+ ///
+ /// \param Name The name of the module to find or create.
+ ///
+ /// \param Parent The module that will act as the parent of this submodule,
+ /// or NULL to indicate that this is a top-level module.
+ ///
+ /// \param IsFramework Whether this is a framework module.
+ ///
+ /// \param IsExplicit Whether this is an explicit submodule.
+ ///
+ /// \returns The found or newly-created module, along with a boolean value
+ /// that will be true if the module is newly-created.
+ std::pair<Module *, bool> findOrCreateModule(StringRef Name, Module *Parent,
+ bool IsFramework,
+ bool IsExplicit);
+
/// \brief Infer the contents of a framework module map from the given
/// framework directory.
Module *inferFrameworkModule(StringRef ModuleName,
diff --git a/include/clang/Serialization/ASTBitCodes.h b/include/clang/Serialization/ASTBitCodes.h
index 53d970b684..22dc0b974c 100644
--- a/include/clang/Serialization/ASTBitCodes.h
+++ b/include/clang/Serialization/ASTBitCodes.h
@@ -198,7 +198,10 @@ namespace clang {
DECL_UPDATES_BLOCK_ID,
/// \brief The block containing the detailed preprocessing record.
- PREPROCESSOR_DETAIL_BLOCK_ID
+ PREPROCESSOR_DETAIL_BLOCK_ID,
+
+ /// \brief The block containing the submodule structure.
+ SUBMODULE_BLOCK_ID
};
/// \brief Record types that occur within the AST block itself.
@@ -492,6 +495,18 @@ namespace clang {
PPD_INCLUSION_DIRECTIVE = 2
};
+ /// \brief Record types used within a submodule description block.
+ enum SubmoduleRecordTypes {
+ /// \brief Defines the major attributes of a submodule, including its
+ /// name and parent.
+ SUBMODULE_DEFINITION = 0,
+ /// \brief Specifies the umbrella header used to create this module,
+ /// if any.
+ SUBMODULE_UMBRELLA = 1,
+ /// \brief Specifies a header that falls into this (sub)module.
+ SUBMODULE_HEADER = 2
+ };
+
/// \defgroup ASTAST AST file AST constants
///
/// The constants in this group describe various components of the
diff --git a/include/clang/Serialization/ASTReader.h b/include/clang/Serialization/ASTReader.h
index 7a9a15caf4..a641942fc5 100644
--- a/include/clang/Serialization/ASTReader.h
+++ b/include/clang/Serialization/ASTReader.h
@@ -692,8 +692,9 @@ private:
ASTReadResult ReadSLocEntryRecord(int ID);
llvm::BitstreamCursor &SLocCursorForID(int ID);
SourceLocation getImportLocation(Module *F);
+ ASTReadResult ReadSubmoduleBlock(Module &F);
bool ParseLanguageOptions(const SmallVectorImpl<uint64_t> &Record);
-
+
struct RecordLocation {
RecordLocation(Module *M, uint64_t O)
: F(M), Offset(O) {}
diff --git a/include/clang/Serialization/ASTWriter.h b/include/clang/Serialization/ASTWriter.h
index ac750c9196..5773c77d8f 100644
--- a/include/clang/Serialization/ASTWriter.h
+++ b/include/clang/Serialization/ASTWriter.h
@@ -358,6 +358,10 @@ private:
/// in the order they should be written.
SmallVector<QueuedCXXBaseSpecifiers, 2> CXXBaseSpecifiersToWrite;
+ /// \brief A mapping from each known submodule to its ID number, which will
+ /// be a positive integer.
+ llvm::DenseMap<ModuleMap::Module *, unsigned> SubmoduleIDs;
+
/// \brief Write the given subexpression to the bitstream.
void WriteSubStmt(Stmt *S,
llvm::DenseMap<Stmt *, uint64_t> &SubStmtEntries,
@@ -374,6 +378,7 @@ private:
void WritePreprocessor(const Preprocessor &PP, bool IsModule);
void WriteHeaderSearch(const HeaderSearch &HS, StringRef isysroot);
void WritePreprocessorDetail(PreprocessingRecord &PPRec);
+ void WriteSubmodules(ModuleMap::Module *WritingModule);
void WritePragmaDiagnosticMappings(const DiagnosticsEngine &Diag);
void WriteCXXBaseSpecifiersOffsets();
void WriteType(QualType T);
diff --git a/include/clang/Serialization/Module.h b/include/clang/Serialization/Module.h
index ca2046bf27..92ff8d8920 100644
--- a/include/clang/Serialization/Module.h
+++ b/include/clang/Serialization/Module.h
@@ -17,6 +17,7 @@
#include "clang/Serialization/ASTBitCodes.h"
#include "clang/Serialization/ContinuousRangeMap.h"
+#include "clang/Lex/ModuleMap.h"
#include "clang/Basic/SourceLocation.h"
#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/SetVector.h"
@@ -200,6 +201,9 @@ public:
/// search information.
const char *HeaderFileFrameworkStrings;
+ // === Submodule information ===
+ llvm::SmallVector<ModuleMap::Module *, 2> Submodules;
+
// === Selectors ===
/// \brief The number of selectors new to this file.