From af299ea5d456aa2fc19d7fdb041a0452d209fd4c Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Sat, 25 Feb 2017 00:44:30 +0000 Subject: [PDB] General improvements to Stream library. This adds various new functionality and cleanup surrounding the use of the Stream library. Major changes include: * Renaming of all classes for more consistency / meaningfulness * Addition of some new methods for reading multiple values at once. * Full suite of unit tests for reader / writer functionality. * Full set of doxygen comments for all classes. * Streams now store their own endianness. * Fixed some bugs in a few of the classes that were discovered by the unit tests. llvm-svn: 296215 --- llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp') diff --git a/llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp b/llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp index fde61ddc650..298382fdc7d 100644 --- a/llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp @@ -12,6 +12,8 @@ #include "llvm/ADT/BitVector.h" #include "llvm/DebugInfo/MSF/BinaryStream.h" +#include "llvm/DebugInfo/MSF/BinaryStream.h" +#include "llvm/DebugInfo/MSF/BinaryStreamWriter.h" #include "llvm/DebugInfo/MSF/BinaryStreamWriter.h" #include "llvm/DebugInfo/MSF/MSFBuilder.h" #include "llvm/DebugInfo/PDB/GenericError.h" @@ -118,8 +120,9 @@ Error PDBFileBuilder::commit(StringRef Filename) { if (OutFileOrError.getError()) return llvm::make_error(generic_error_code::invalid_path, Filename); - FileBufferByteStream Buffer(std::move(*OutFileOrError)); - StreamWriter Writer(Buffer); + FileBufferByteStream Buffer(std::move(*OutFileOrError), + llvm::support::little); + BinaryStreamWriter Writer(Buffer); if (auto EC = Writer.writeObject(*Layout.SB)) return EC; @@ -131,9 +134,8 @@ Error PDBFileBuilder::commit(StringRef Filename) { auto DirStream = WritableMappedBlockStream::createDirectoryStream(Layout, Buffer); - StreamWriter DW(*DirStream); - if (auto EC = DW.writeInteger(Layout.StreamSizes.size(), - llvm::support::little)) + BinaryStreamWriter DW(*DirStream); + if (auto EC = DW.writeInteger(Layout.StreamSizes.size())) return EC; if (auto EC = DW.writeArray(Layout.StreamSizes)) @@ -150,7 +152,7 @@ Error PDBFileBuilder::commit(StringRef Filename) { auto NS = WritableMappedBlockStream::createIndexedStream(Layout, Buffer, StringTableStreamNo); - StreamWriter NSWriter(*NS); + BinaryStreamWriter NSWriter(*NS); if (auto EC = Strings.commit(NSWriter)) return EC; -- cgit v1.2.3