diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-11-30 19:28:05 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-11-30 19:28:05 +0000 |
commit | 87e2cfcec7231daaa3f367dc32df74b411251e46 (patch) | |
tree | b8514feffbc2cd5b8f300f9d20b6757926d82ef3 /lib/Serialization | |
parent | 830ea5b7c75413526c19531f0180fa6e45b98919 (diff) |
Actually keep track of the source locations at which particular module
files are loaded.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169027 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization')
-rw-r--r-- | lib/Serialization/ASTReader.cpp | 5 | ||||
-rw-r--r-- | lib/Serialization/ModuleManager.cpp | 12 |
2 files changed, 11 insertions, 6 deletions
diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp index ffed8356c9..c1428d5c68 100644 --- a/lib/Serialization/ASTReader.cpp +++ b/lib/Serialization/ASTReader.cpp @@ -2818,8 +2818,9 @@ ASTReader::ReadASTCore(StringRef FileName, ModuleFile *M; bool NewModule; std::string ErrorStr; - llvm::tie(M, NewModule) = ModuleMgr.addModule(FileName, Type, ImportedBy, - CurrentGeneration, ErrorStr); + llvm::tie(M, NewModule) = ModuleMgr.addModule(FileName, Type, ImportLoc, + ImportedBy, CurrentGeneration, + ErrorStr); if (!M) { // We couldn't load the module. diff --git a/lib/Serialization/ModuleManager.cpp b/lib/Serialization/ModuleManager.cpp index efe442101b..d5a0a28bdb 100644 --- a/lib/Serialization/ModuleManager.cpp +++ b/lib/Serialization/ModuleManager.cpp @@ -34,9 +34,9 @@ llvm::MemoryBuffer *ModuleManager::lookupBuffer(StringRef Name) { } std::pair<ModuleFile *, bool> -ModuleManager::addModule(StringRef FileName, ModuleKind Type, - ModuleFile *ImportedBy, unsigned Generation, - std::string &ErrorStr) { +ModuleManager::addModule(StringRef FileName, ModuleKind Type, + SourceLocation ImportLoc, ModuleFile *ImportedBy, + unsigned Generation, std::string &ErrorStr) { const FileEntry *Entry = FileMgr.getFile(FileName); if (!Entry && FileName != "-") { ErrorStr = "file not found"; @@ -51,10 +51,11 @@ ModuleManager::addModule(StringRef FileName, ModuleKind Type, ModuleFile *New = new ModuleFile(Type, Generation); New->FileName = FileName.str(); New->File = Entry; + New->ImportLoc = ImportLoc; Chain.push_back(New); NewModule = true; ModuleEntry = New; - + // Load the contents of the module if (llvm::MemoryBuffer *Buffer = lookupBuffer(FileName)) { // The buffer was already provided for us. @@ -82,6 +83,9 @@ ModuleManager::addModule(StringRef FileName, ModuleKind Type, ModuleEntry->ImportedBy.insert(ImportedBy); ImportedBy->Imports.insert(ModuleEntry); } else { + if (!ModuleEntry->DirectlyImported) + ModuleEntry->ImportLoc = ImportLoc; + ModuleEntry->DirectlyImported = true; } |