aboutsummaryrefslogtreecommitdiff
path: root/lib/Serialization/ASTWriter.cpp
diff options
context:
space:
mode:
authorJonathan D. Turner <jonathan.d.turner@gmail.com>2011-07-26 18:21:30 +0000
committerJonathan D. Turner <jonathan.d.turner@gmail.com>2011-07-26 18:21:30 +0000
commit48d2c3f7c3ca48da05436afdc8426a245294ee65 (patch)
treebfb5e688887a832c3420f1feb6eef8f1c64b5f5a /lib/Serialization/ASTWriter.cpp
parent8eaefdc6aed76e26619caffed030a57438280897 (diff)
This patch extends the previous patch by starting to incorporate more functionality, like lookup-by-name and exporting lookup tables, into the module manager. Methods now have documentation. A few more functions have been switched over to the new iterator style and away from manual/explicit iteration. Ultimately we want to move away from name lookup here, as symlinks make filenames not a safe unique value, but we use it here as a stopgap before better measures are in place (namely instead using FileEntry* from a global FileManager).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136107 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization/ASTWriter.cpp')
-rw-r--r--lib/Serialization/ASTWriter.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp
index c94b96d18c..14824a0810 100644
--- a/lib/Serialization/ASTWriter.cpp
+++ b/lib/Serialization/ASTWriter.cpp
@@ -969,7 +969,8 @@ void ASTWriter::WriteMetadata(ASTContext &Context, StringRef isysroot,
Record.push_back(CLANG_VERSION_MINOR);
Record.push_back(!isysroot.empty());
// FIXME: This writes the absolute path for chained headers.
- const std::string &BlobStr = Chain ? Chain->getFileName() : Target.getTriple().getTriple();
+ const std::string &BlobStr =
+ Chain ? Chain->getFileName() : Target.getTriple().getTriple();
Stream.EmitRecordWithBlob(MetaAbbrevCode, Record, BlobStr);
// Original file name and file ID
@@ -1548,14 +1549,8 @@ void ASTWriter::WriteSourceManagerBlock(SourceManager &SourceMgr,
// Sorted by offset.
typedef std::pair<uint32_t, StringRef> ModuleOffset;
SmallVector<ModuleOffset, 16> Modules;
- Modules.reserve(Chain->Modules.size());
- for (llvm::StringMap<Module*>::const_iterator
- I = Chain->Modules.begin(), E = Chain->Modules.end();
- I != E; ++I) {
- Modules.push_back(ModuleOffset(I->getValue()->SLocEntryBaseOffset,
- I->getKey()));
- }
- std::sort(Modules.begin(), Modules.end());
+
+ Chain->ModuleMgr.exportLookup(Modules);
Abbrev = new BitCodeAbbrev();
Abbrev->Add(BitCodeAbbrevOp(SOURCE_LOCATION_MAP));