aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-10-03 01:58:42 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-10-03 01:58:42 +0000
commitd64c26f6676eef69d1713f353ca8a3c2fe963f17 (patch)
tree005dcf62e4d364865a2cf0009061cd567a1113a6
parent50e71f1040a4cbc13245f897f9056e846345688d (diff)
Set the file entry for a Module* that was created during deserialization
of a module file. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165086 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Serialization/Module.h4
-rw-r--r--include/clang/Serialization/ModuleManager.h4
-rw-r--r--lib/Serialization/ASTReader.cpp3
-rw-r--r--lib/Serialization/Module.cpp3
-rw-r--r--lib/Serialization/ModuleManager.cpp3
5 files changed, 12 insertions, 5 deletions
diff --git a/include/clang/Serialization/Module.h b/include/clang/Serialization/Module.h
index 653fe222b6..87a0e40e9e 100644
--- a/include/clang/Serialization/Module.h
+++ b/include/clang/Serialization/Module.h
@@ -25,6 +25,7 @@
namespace clang {
+class FileEntry;
class DeclContext;
class Module;
template<typename Info> class OnDiskChainedHashTable;
@@ -74,6 +75,9 @@ public:
/// \brief The file name of the module file.
std::string FileName;
+ /// \brief The file entry for the module file.
+ const FileEntry *File;
+
/// \brief Whether this module has been directly imported by the
/// user.
bool DirectlyImported;
diff --git a/include/clang/Serialization/ModuleManager.h b/include/clang/Serialization/ModuleManager.h
index 6ff0640b64..2233eaf828 100644
--- a/include/clang/Serialization/ModuleManager.h
+++ b/include/clang/Serialization/ModuleManager.h
@@ -34,7 +34,7 @@ class ModuleManager {
/// \brief FileManager that handles translating between filenames and
/// FileEntry *.
- FileManager FileMgr;
+ FileManager &FileMgr;
/// \brief A lookup of in-memory (virtual file) buffers
llvm::DenseMap<const FileEntry *, llvm::MemoryBuffer *> InMemoryBuffers;
@@ -45,7 +45,7 @@ public:
typedef SmallVector<ModuleFile*, 2>::reverse_iterator ModuleReverseIterator;
typedef std::pair<uint32_t, StringRef> ModuleOffset;
- ModuleManager(const FileSystemOptions &FSO);
+ explicit ModuleManager(FileManager &FileMgr);
~ModuleManager();
/// \brief Forward iterator to traverse all loaded modules. This is reverse
diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp
index 3960fa29ce..cc6d073b10 100644
--- a/lib/Serialization/ASTReader.cpp
+++ b/lib/Serialization/ASTReader.cpp
@@ -3177,6 +3177,7 @@ ASTReader::ASTReadResult ASTReader::ReadSubmoduleBlock(ModuleFile &F) {
return Failure;
}
+ CurrentModule->setASTFile(F.File);
CurrentModule->IsFromModuleFile = true;
CurrentModule->IsSystem = IsSystem || CurrentModule->IsSystem;
CurrentModule->InferSubmodules = InferSubmodules;
@@ -6497,7 +6498,7 @@ ASTReader::ASTReader(Preprocessor &PP, ASTContext &Context,
: Listener(new PCHValidator(PP, *this)), DeserializationListener(0),
SourceMgr(PP.getSourceManager()), FileMgr(PP.getFileManager()),
Diags(PP.getDiagnostics()), SemaObj(0), PP(PP), Context(Context),
- Consumer(0), ModuleMgr(FileMgr.getFileSystemOptions()),
+ Consumer(0), ModuleMgr(PP.getFileManager()),
RelocatablePCH(false), isysroot(isysroot),
DisableValidation(DisableValidation),
DisableStatCache(DisableStatCache),
diff --git a/lib/Serialization/Module.cpp b/lib/Serialization/Module.cpp
index 5fab02b1fb..a5f709153c 100644
--- a/lib/Serialization/Module.cpp
+++ b/lib/Serialization/Module.cpp
@@ -21,7 +21,8 @@ using namespace serialization;
using namespace reader;
ModuleFile::ModuleFile(ModuleKind Kind, unsigned Generation)
- : Kind(Kind), DirectlyImported(false), Generation(Generation), SizeInBits(0),
+ : Kind(Kind), File(0), DirectlyImported(false),
+ Generation(Generation), SizeInBits(0),
LocalNumSLocEntries(0), SLocEntryBaseID(0),
SLocEntryBaseOffset(0), SLocEntryOffsets(0),
SLocFileOffsets(0), LocalNumIdentifiers(0),
diff --git a/lib/Serialization/ModuleManager.cpp b/lib/Serialization/ModuleManager.cpp
index ab364b7ebd..c46e9f0608 100644
--- a/lib/Serialization/ModuleManager.cpp
+++ b/lib/Serialization/ModuleManager.cpp
@@ -50,6 +50,7 @@ ModuleManager::addModule(StringRef FileName, ModuleKind Type,
// Allocate a new module.
ModuleFile *New = new ModuleFile(Type, Generation);
New->FileName = FileName.str();
+ New->File = Entry;
Chain.push_back(New);
NewModule = true;
ModuleEntry = New;
@@ -95,7 +96,7 @@ void ModuleManager::addInMemoryBuffer(StringRef FileName,
InMemoryBuffers[Entry] = Buffer;
}
-ModuleManager::ModuleManager(const FileSystemOptions &FSO) : FileMgr(FSO) { }
+ModuleManager::ModuleManager(FileManager &FileMgr) : FileMgr(FileMgr) { }
ModuleManager::~ModuleManager() {
for (unsigned i = 0, e = Chain.size(); i != e; ++i)