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 | 6fb03aeae12e0c4540ec3af6b3d53d0411087a06 (patch) | |
tree | 6020c0c113d56a3bb43c346e5fd8a1bb8f18b0ad /clang/lib/Serialization/ModuleManager.cpp | |
parent | 31e7d2deb31e4956ba507fdb38c3316100e6e06e (diff) | |
download | bcm5719-llvm-6fb03aeae12e0c4540ec3af6b3d53d0411087a06.tar.gz bcm5719-llvm-6fb03aeae12e0c4540ec3af6b3d53d0411087a06.zip |
Actually keep track of the source locations at which particular module
files are loaded.
llvm-svn: 169027
Diffstat (limited to 'clang/lib/Serialization/ModuleManager.cpp')
-rw-r--r-- | clang/lib/Serialization/ModuleManager.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/clang/lib/Serialization/ModuleManager.cpp b/clang/lib/Serialization/ModuleManager.cpp index efe442101bb..d5a0a28bdb0 100644 --- a/clang/lib/Serialization/ModuleManager.cpp +++ b/clang/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; } |