diff options
author | Jonathan D. Turner <jonathan.d.turner@gmail.com> | 2011-07-26 18:21:30 +0000 |
---|---|---|
committer | Jonathan D. Turner <jonathan.d.turner@gmail.com> | 2011-07-26 18:21:30 +0000 |
commit | b2b0823d002e541b4364409f8fd488daf7d5bf0b (patch) | |
tree | 921cbf32dd5f72543aac668bbabfb5deaf78bf55 /clang/lib/Serialization/ASTWriter.cpp | |
parent | 613958c82c09f550797631b558e50d191cdbfe7d (diff) | |
download | bcm5719-llvm-b2b0823d002e541b4364409f8fd488daf7d5bf0b.tar.gz bcm5719-llvm-b2b0823d002e541b4364409f8fd488daf7d5bf0b.zip |
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).
llvm-svn: 136107
Diffstat (limited to 'clang/lib/Serialization/ASTWriter.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTWriter.cpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index c94b96d18cb..14824a0810f 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/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)); |