[llvm] r276458 - [msf] Create LLVMDebugInfoMsf

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 25 09:54:06 PDT 2016


Yes I'll take a look shortly
On Mon, Jul 25, 2016 at 8:13 AM Adrian Prantl <aprantl at apple.com> wrote:

> Hello Zachary,
>
> it looks like this commit might have broken the -DLLVM_ENABLE_MODULES=1
> build.
> It is probably just a matter of adding a missing #include:
>
> http://lab.llvm.org:8080/green/view/Experimental/job/clang-stage1-cmake-modulesRDA_build/5567/consoleFull#1761697649ba4694-19c4-4d7e-bec5-911270d8a58c
>
> Would you mind taking a quick look?
> thanks,
> Adrian
>
> > On Jul 22, 2016, at 12:56 PM, Zachary Turner via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
> >
> > Author: zturner
> > Date: Fri Jul 22 14:56:05 2016
> > New Revision: 276458
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=276458&view=rev
> > Log:
> > [msf] Create LLVMDebugInfoMsf
> >
> > This provides a better layering of responsibilities among different
> > aspects of PDB writing code.  Some of the MSF related code was
> > contained in CodeView, and some was in PDB prior to this.  Further,
> > we were often saying PDB when we meant MSF, and the two are
> > actually independent of each other since in theory you can have
> > other types of data besides PDB data in an MSF.  So, this patch
> > separates the MSF specific code into its own library, with no
> > dependencies on anything else, and DebugInfoCodeView and
> > DebugInfoPDB take dependencies on DebugInfoMsf.
> >
> > Added:
> >    llvm/trunk/include/llvm/DebugInfo/Msf/
> >    llvm/trunk/include/llvm/DebugInfo/Msf/ByteStream.h
> >      - copied, changed from r276457,
> llvm/trunk/include/llvm/DebugInfo/CodeView/ByteStream.h
> >    llvm/trunk/include/llvm/DebugInfo/Msf/DirectoryStreamData.h
> >      - copied, changed from r276457,
> llvm/trunk/include/llvm/DebugInfo/PDB/Raw/DirectoryStreamData.h
> >    llvm/trunk/include/llvm/DebugInfo/Msf/IMsfFile.h
> >      - copied, changed from r276457,
> llvm/trunk/include/llvm/DebugInfo/PDB/Raw/IPDBFile.h
> >    llvm/trunk/include/llvm/DebugInfo/Msf/IMsfStreamData.h
> >      - copied, changed from r276457,
> llvm/trunk/include/llvm/DebugInfo/PDB/Raw/IPDBStreamData.h
> >    llvm/trunk/include/llvm/DebugInfo/Msf/IndexedStreamData.h
> >      - copied, changed from r276457,
> llvm/trunk/include/llvm/DebugInfo/PDB/Raw/IndexedStreamData.h
> >    llvm/trunk/include/llvm/DebugInfo/Msf/MappedBlockStream.h
> >      - copied, changed from r276457,
> llvm/trunk/include/llvm/DebugInfo/PDB/Raw/MappedBlockStream.h
> >    llvm/trunk/include/llvm/DebugInfo/Msf/MsfBuilder.h
> >      - copied, changed from r276457,
> llvm/trunk/include/llvm/DebugInfo/PDB/Raw/MsfBuilder.h
> >    llvm/trunk/include/llvm/DebugInfo/Msf/MsfCommon.h
> >      - copied, changed from r276457,
> llvm/trunk/include/llvm/DebugInfo/PDB/Raw/MsfCommon.h
> >    llvm/trunk/include/llvm/DebugInfo/Msf/MsfError.h
> >    llvm/trunk/include/llvm/DebugInfo/Msf/StreamArray.h
> >      - copied, changed from r276457,
> llvm/trunk/include/llvm/DebugInfo/CodeView/StreamArray.h
> >    llvm/trunk/include/llvm/DebugInfo/Msf/StreamInterface.h
> >      - copied, changed from r276457,
> llvm/trunk/include/llvm/DebugInfo/CodeView/StreamInterface.h
> >    llvm/trunk/include/llvm/DebugInfo/Msf/StreamReader.h
> >      - copied, changed from r276457,
> llvm/trunk/include/llvm/DebugInfo/CodeView/StreamReader.h
> >    llvm/trunk/include/llvm/DebugInfo/Msf/StreamRef.h
> >      - copied, changed from r276457,
> llvm/trunk/include/llvm/DebugInfo/CodeView/StreamRef.h
> >    llvm/trunk/include/llvm/DebugInfo/Msf/StreamWriter.h
> >      - copied, changed from r276457,
> llvm/trunk/include/llvm/DebugInfo/CodeView/StreamWriter.h
> >    llvm/trunk/lib/DebugInfo/Msf/
> >    llvm/trunk/lib/DebugInfo/Msf/ByteStream.cpp
> >      - copied, changed from r276457,
> llvm/trunk/lib/DebugInfo/CodeView/ByteStream.cpp
> >    llvm/trunk/lib/DebugInfo/Msf/CMakeLists.txt
> >    llvm/trunk/lib/DebugInfo/Msf/IndexedStreamData.cpp
> >      - copied, changed from r276457,
> llvm/trunk/lib/DebugInfo/PDB/Raw/IndexedStreamData.cpp
> >    llvm/trunk/lib/DebugInfo/Msf/LLVMBuild.txt
> >      - copied, changed from r276457,
> llvm/trunk/lib/DebugInfo/CodeView/LLVMBuild.txt
> >    llvm/trunk/lib/DebugInfo/Msf/MappedBlockStream.cpp
> >      - copied, changed from r276457,
> llvm/trunk/lib/DebugInfo/PDB/Raw/MappedBlockStream.cpp
> >    llvm/trunk/lib/DebugInfo/Msf/MsfBuilder.cpp
> >      - copied, changed from r276457,
> llvm/trunk/lib/DebugInfo/PDB/Raw/MsfBuilder.cpp
> >    llvm/trunk/lib/DebugInfo/Msf/MsfCommon.cpp
> >      - copied, changed from r276457,
> llvm/trunk/lib/DebugInfo/PDB/Raw/MsfCommon.cpp
> >    llvm/trunk/lib/DebugInfo/Msf/MsfError.cpp
> >    llvm/trunk/lib/DebugInfo/Msf/StreamReader.cpp
> >      - copied, changed from r276457,
> llvm/trunk/lib/DebugInfo/CodeView/StreamReader.cpp
> >    llvm/trunk/lib/DebugInfo/Msf/StreamWriter.cpp
> >      - copied, changed from r276457,
> llvm/trunk/lib/DebugInfo/CodeView/StreamWriter.cpp
> > Removed:
> >    llvm/trunk/include/llvm/DebugInfo/CodeView/ByteStream.h
> >    llvm/trunk/include/llvm/DebugInfo/CodeView/CodeViewOStream.h
> >    llvm/trunk/include/llvm/DebugInfo/CodeView/StreamArray.h
> >    llvm/trunk/include/llvm/DebugInfo/CodeView/StreamInterface.h
> >    llvm/trunk/include/llvm/DebugInfo/CodeView/StreamReader.h
> >    llvm/trunk/include/llvm/DebugInfo/CodeView/StreamRef.h
> >    llvm/trunk/include/llvm/DebugInfo/CodeView/StreamWriter.h
> >    llvm/trunk/include/llvm/DebugInfo/PDB/Raw/DirectoryStreamData.h
> >    llvm/trunk/include/llvm/DebugInfo/PDB/Raw/IPDBFile.h
> >    llvm/trunk/include/llvm/DebugInfo/PDB/Raw/IPDBStreamData.h
> >    llvm/trunk/include/llvm/DebugInfo/PDB/Raw/IndexedStreamData.h
> >    llvm/trunk/include/llvm/DebugInfo/PDB/Raw/MappedBlockStream.h
> >    llvm/trunk/include/llvm/DebugInfo/PDB/Raw/MsfBuilder.h
> >    llvm/trunk/include/llvm/DebugInfo/PDB/Raw/MsfCommon.h
> >    llvm/trunk/lib/DebugInfo/CodeView/ByteStream.cpp
> >    llvm/trunk/lib/DebugInfo/CodeView/StreamReader.cpp
> >    llvm/trunk/lib/DebugInfo/CodeView/StreamWriter.cpp
> >    llvm/trunk/lib/DebugInfo/PDB/Raw/IndexedStreamData.cpp
> >    llvm/trunk/lib/DebugInfo/PDB/Raw/MappedBlockStream.cpp
> >    llvm/trunk/lib/DebugInfo/PDB/Raw/MsfBuilder.cpp
> >    llvm/trunk/lib/DebugInfo/PDB/Raw/MsfCommon.cpp
> > Modified:
> >    llvm/trunk/include/llvm/DebugInfo/CodeView/CVRecord.h
> >    llvm/trunk/include/llvm/DebugInfo/CodeView/ModuleSubstream.h
> >    llvm/trunk/include/llvm/DebugInfo/CodeView/ModuleSubstreamVisitor.h
> >    llvm/trunk/include/llvm/DebugInfo/CodeView/SymbolRecord.h
> >    llvm/trunk/include/llvm/DebugInfo/CodeView/TypeRecord.h
> >    llvm/trunk/include/llvm/DebugInfo/PDB/Raw/DbiStream.h
> >    llvm/trunk/include/llvm/DebugInfo/PDB/Raw/DbiStreamBuilder.h
> >    llvm/trunk/include/llvm/DebugInfo/PDB/Raw/InfoStream.h
> >    llvm/trunk/include/llvm/DebugInfo/PDB/Raw/ModInfo.h
> >    llvm/trunk/include/llvm/DebugInfo/PDB/Raw/ModStream.h
> >    llvm/trunk/include/llvm/DebugInfo/PDB/Raw/NameHashTable.h
> >    llvm/trunk/include/llvm/DebugInfo/PDB/Raw/NameMap.h
> >    llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBFile.h
> >    llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBFileBuilder.h
> >    llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PublicsStream.h
> >    llvm/trunk/include/llvm/DebugInfo/PDB/Raw/SymbolStream.h
> >    llvm/trunk/include/llvm/DebugInfo/PDB/Raw/TpiStream.h
> >    llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
> >    llvm/trunk/lib/CodeGen/AsmPrinter/LLVMBuild.txt
> >    llvm/trunk/lib/DebugInfo/CMakeLists.txt
> >    llvm/trunk/lib/DebugInfo/CodeView/CMakeLists.txt
> >    llvm/trunk/lib/DebugInfo/CodeView/CVTypeVisitor.cpp
> >    llvm/trunk/lib/DebugInfo/CodeView/LLVMBuild.txt
> >    llvm/trunk/lib/DebugInfo/CodeView/ModuleSubstream.cpp
> >    llvm/trunk/lib/DebugInfo/CodeView/ModuleSubstreamVisitor.cpp
> >    llvm/trunk/lib/DebugInfo/CodeView/TypeDumper.cpp
> >    llvm/trunk/lib/DebugInfo/CodeView/TypeStreamMerger.cpp
> >    llvm/trunk/lib/DebugInfo/LLVMBuild.txt
> >    llvm/trunk/lib/DebugInfo/PDB/CMakeLists.txt
> >    llvm/trunk/lib/DebugInfo/PDB/LLVMBuild.txt
> >    llvm/trunk/lib/DebugInfo/PDB/Raw/DbiStream.cpp
> >    llvm/trunk/lib/DebugInfo/PDB/Raw/DbiStreamBuilder.cpp
> >    llvm/trunk/lib/DebugInfo/PDB/Raw/InfoStream.cpp
> >    llvm/trunk/lib/DebugInfo/PDB/Raw/InfoStreamBuilder.cpp
> >    llvm/trunk/lib/DebugInfo/PDB/Raw/ModInfo.cpp
> >    llvm/trunk/lib/DebugInfo/PDB/Raw/ModStream.cpp
> >    llvm/trunk/lib/DebugInfo/PDB/Raw/NameHashTable.cpp
> >    llvm/trunk/lib/DebugInfo/PDB/Raw/NameMap.cpp
> >    llvm/trunk/lib/DebugInfo/PDB/Raw/PDBFile.cpp
> >    llvm/trunk/lib/DebugInfo/PDB/Raw/PDBFileBuilder.cpp
> >    llvm/trunk/lib/DebugInfo/PDB/Raw/PublicsStream.cpp
> >    llvm/trunk/lib/DebugInfo/PDB/Raw/RawSession.cpp
> >    llvm/trunk/lib/DebugInfo/PDB/Raw/SymbolStream.cpp
> >    llvm/trunk/lib/DebugInfo/PDB/Raw/TpiStream.cpp
> >    llvm/trunk/tools/llvm-pdbdump/CMakeLists.txt
> >    llvm/trunk/tools/llvm-pdbdump/LLVMBuild.txt
> >    llvm/trunk/tools/llvm-pdbdump/LLVMOutputStyle.cpp
> >    llvm/trunk/tools/llvm-pdbdump/PdbYaml.cpp
> >    llvm/trunk/tools/llvm-pdbdump/PdbYaml.h
> >    llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp
> >    llvm/trunk/tools/llvm-readobj/CMakeLists.txt
> >    llvm/trunk/tools/llvm-readobj/COFFDumper.cpp
> >    llvm/trunk/tools/llvm-readobj/LLVMBuild.txt
> >    llvm/trunk/unittests/DebugInfo/PDB/MappedBlockStreamTest.cpp
> >    llvm/trunk/unittests/DebugInfo/PDB/MsfBuilderTest.cpp
> >
> > Removed: llvm/trunk/include/llvm/DebugInfo/CodeView/ByteStream.h
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/ByteStream.h?rev=276457&view=auto
> >
> ==============================================================================
> > --- llvm/trunk/include/llvm/DebugInfo/CodeView/ByteStream.h (original)
> > +++ llvm/trunk/include/llvm/DebugInfo/CodeView/ByteStream.h (removed)
> > @@ -1,58 +0,0 @@
> > -//===- ByteStream.h - Reads stream data from a byte sequence ----*- C++
> -*-===//
> > -//
> > -//                     The LLVM Compiler Infrastructure
> > -//
> > -// This file is distributed under the University of Illinois Open Source
> > -// License. See LICENSE.TXT for details.
> > -//
> >
> -//===----------------------------------------------------------------------===//
> > -
> > -#ifndef LLVM_DEBUGINFO_CODEVIEW_BYTESTREAM_H
> > -#define LLVM_DEBUGINFO_CODEVIEW_BYTESTREAM_H
> > -
> > -#include "llvm/ADT/ArrayRef.h"
> > -#include "llvm/ADT/StringRef.h"
> > -#include "llvm/DebugInfo/CodeView/StreamInterface.h"
> > -#include "llvm/Support/Error.h"
> > -#include <cstdint>
> > -#include <memory>
> > -#include <type_traits>
> > -
> > -namespace llvm {
> > -namespace codeview {
> > -class StreamReader;
> > -
> > -template <bool Writable = false> class ByteStream : public
> StreamInterface {
> > -  typedef typename std::conditional<Writable, MutableArrayRef<uint8_t>,
> > -                                    ArrayRef<uint8_t>>::type ArrayType;
> > -
> > -public:
> > -  ByteStream() {}
> > -  explicit ByteStream(ArrayType Data) : Data(Data) {}
> > -  ~ByteStream() override {}
> > -
> > -  Error readBytes(uint32_t Offset, uint32_t Size,
> > -                  ArrayRef<uint8_t> &Buffer) const override;
> > -  Error readLongestContiguousChunk(uint32_t Offset,
> > -                                   ArrayRef<uint8_t> &Buffer) const
> override;
> > -
> > -  Error writeBytes(uint32_t Offset, ArrayRef<uint8_t> Buffer) const
> override;
> > -
> > -  uint32_t getLength() const override;
> > -
> > -  Error commit() const override;
> > -
> > -  ArrayRef<uint8_t> data() const { return Data; }
> > -  StringRef str() const;
> > -
> > -private:
> > -  ArrayType Data;
> > -};
> > -
> > -extern template class ByteStream<true>;
> > -extern template class ByteStream<false>;
> > -
> > -} // end namespace pdb
> > -} // end namespace llvm
> > -
> > -#endif // LLVM_DEBUGINFO_CODEVIEW_BYTESTREAM_H
> >
> > Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/CVRecord.h
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/CVRecord.h?rev=276458&r1=276457&r2=276458&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/include/llvm/DebugInfo/CodeView/CVRecord.h (original)
> > +++ llvm/trunk/include/llvm/DebugInfo/CodeView/CVRecord.h Fri Jul 22
> 14:56:05 2016
> > @@ -12,9 +12,10 @@
> >
> > #include "llvm/ADT/ArrayRef.h"
> > #include "llvm/ADT/iterator_range.h"
> > +#include "llvm/DebugInfo/CodeView/CodeViewError.h"
> > #include "llvm/DebugInfo/CodeView/RecordSerialization.h"
> > -#include "llvm/DebugInfo/CodeView/StreamInterface.h"
> > -#include "llvm/DebugInfo/CodeView/StreamReader.h"
> > +#include "llvm/DebugInfo/Msf/StreamReader.h"
> > +#include "llvm/DebugInfo/Msf/StreamRef.h"
> > #include "llvm/Support/Endian.h"
> >
> > namespace llvm {
> > @@ -26,10 +27,14 @@ template <typename Kind> struct CVRecord
> >   ArrayRef<uint8_t> Data;
> >   ArrayRef<uint8_t> RawData;
> > };
> > +}
> > +namespace msf {
> >
> > -template <typename Kind> struct VarStreamArrayExtractor<CVRecord<Kind>>
> {
> > +template <typename Kind>
> > +struct VarStreamArrayExtractor<codeview::CVRecord<Kind>> {
> >   Error operator()(StreamRef Stream, uint32_t &Len,
> > -                   CVRecord<Kind> &Item) const {
> > +                   codeview::CVRecord<Kind> &Item) const {
> > +    using namespace codeview;
> >     const RecordPrefix *Prefix = nullptr;
> >     StreamReader Reader(Stream);
> >     uint32_t Offset = Reader.getOffset();
> >
> > Removed: llvm/trunk/include/llvm/DebugInfo/CodeView/CodeViewOStream.h
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/CodeViewOStream.h?rev=276457&view=auto
> >
> ==============================================================================
> > --- llvm/trunk/include/llvm/DebugInfo/CodeView/CodeViewOStream.h
> (original)
> > +++ llvm/trunk/include/llvm/DebugInfo/CodeView/CodeViewOStream.h
> (removed)
> > @@ -1,39 +0,0 @@
> > -//===- CodeViewOStream.h ----------------------------------------*- C++
> -*-===//
> > -//
> > -//                     The LLVM Compiler Infrastructure
> > -//
> > -// This file is distributed under the University of Illinois Open Source
> > -// License. See LICENSE.TXT for details.
> > -//
> >
> -//===----------------------------------------------------------------------===//
> > -
> > -#ifndef LLVM_DEBUGINFO_CODEVIEW_CODEVIEWOSTREAM_H
> > -#define LLVM_DEBUGINFO_CODEVIEW_CODEVIEWOSTREAM_H
> > -
> > -#include "llvm/DebugInfo/CodeView/CodeView.h"
> > -#include "llvm/DebugInfo/CodeView/TypeIndex.h"
> > -
> > -namespace llvm {
> > -namespace codeview {
> > -
> > -template <typename Writer> class CodeViewOStream {
> > -private:
> > -  CodeViewOStream(const CodeViewOStream &) = delete;
> > -  CodeViewOStream &operator=(const CodeViewOStream &) = delete;
> > -
> > -public:
> > -  typedef typename Writer::LabelType LabelType;
> > -
> > -public:
> > -  explicit CodeViewOStream(Writer &W);
> > -
> > -private:
> > -  uint64_t size() const { return W.tell(); }
> > -
> > -private:
> > -  Writer &W;
> > -};
> > -}
> > -}
> > -
> > -#endif
> >
> > Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/ModuleSubstream.h
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/ModuleSubstream.h?rev=276458&r1=276457&r2=276458&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/include/llvm/DebugInfo/CodeView/ModuleSubstream.h
> (original)
> > +++ llvm/trunk/include/llvm/DebugInfo/CodeView/ModuleSubstream.h Fri Jul
> 22 14:56:05 2016
> > @@ -11,8 +11,8 @@
> > #define LLVM_DEBUGINFO_CODEVIEW_MODULESUBSTREAM_H
> >
> > #include "llvm/DebugInfo/CodeView/CodeView.h"
> > -#include "llvm/DebugInfo/CodeView/StreamArray.h"
> > -#include "llvm/DebugInfo/CodeView/StreamRef.h"
> > +#include "llvm/DebugInfo/Msf/StreamArray.h"
> > +#include "llvm/DebugInfo/Msf/StreamRef.h"
> > #include "llvm/Support/Endian.h"
> > #include "llvm/Support/Error.h"
> >
> > @@ -59,29 +59,31 @@ struct ColumnNumberEntry {
> > class ModuleSubstream {
> > public:
> >   ModuleSubstream();
> > -  ModuleSubstream(ModuleSubstreamKind Kind, StreamRef Data);
> > -  static Error initialize(StreamRef Stream, ModuleSubstream &Info);
> > +  ModuleSubstream(ModuleSubstreamKind Kind, msf::StreamRef Data);
> > +  static Error initialize(msf::StreamRef Stream, ModuleSubstream &Info);
> >   uint32_t getRecordLength() const;
> >   ModuleSubstreamKind getSubstreamKind() const;
> > -  StreamRef getRecordData() const;
> > +  msf::StreamRef getRecordData() const;
> >
> > private:
> >   ModuleSubstreamKind Kind;
> > -  StreamRef Data;
> > +  msf::StreamRef Data;
> > };
> >
> > -template <> struct VarStreamArrayExtractor<ModuleSubstream> {
> > +typedef msf::VarStreamArray<ModuleSubstream> ModuleSubstreamArray;
> > +} // namespace codeview
> > +
> > +namespace msf {
> > +template <> struct VarStreamArrayExtractor<codeview::ModuleSubstream> {
> >   Error operator()(StreamRef Stream, uint32_t &Length,
> > -                   ModuleSubstream &Info) const {
> > -    if (auto EC = ModuleSubstream::initialize(Stream, Info))
> > +                   codeview::ModuleSubstream &Info) const {
> > +    if (auto EC = codeview::ModuleSubstream::initialize(Stream, Info))
> >       return EC;
> >     Length = Info.getRecordLength();
> >     return Error::success();
> >   }
> > };
> > -
> > -typedef VarStreamArray<ModuleSubstream> ModuleSubstreamArray;
> > -}
> > -}
> > +} // namespace msf
> > +} // namespace llvm
> >
> > #endif // LLVM_DEBUGINFO_CODEVIEW_MODULESUBSTREAM_H
> >
> > Modified:
> llvm/trunk/include/llvm/DebugInfo/CodeView/ModuleSubstreamVisitor.h
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/ModuleSubstreamVisitor.h?rev=276458&r1=276457&r2=276458&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/include/llvm/DebugInfo/CodeView/ModuleSubstreamVisitor.h
> (original)
> > +++ llvm/trunk/include/llvm/DebugInfo/CodeView/ModuleSubstreamVisitor.h
> Fri Jul 22 14:56:05 2016
> > @@ -14,24 +14,62 @@
> > #include "llvm/DebugInfo/CodeView/CodeViewError.h"
> > #include "llvm/DebugInfo/CodeView/Line.h"
> > #include "llvm/DebugInfo/CodeView/ModuleSubstream.h"
> > -#include "llvm/DebugInfo/CodeView/StreamReader.h"
> > -#include "llvm/DebugInfo/CodeView/StreamRef.h"
> > +#include "llvm/DebugInfo/Msf/StreamReader.h"
> > +#include "llvm/DebugInfo/Msf/StreamRef.h"
> >
> > namespace llvm {
> > namespace codeview {
> > -
> > struct LineColumnEntry {
> >   support::ulittle32_t NameIndex;
> > -  FixedStreamArray<LineNumberEntry> LineNumbers;
> > -  FixedStreamArray<ColumnNumberEntry> Columns;
> > +  msf::FixedStreamArray<LineNumberEntry> LineNumbers;
> > +  msf::FixedStreamArray<ColumnNumberEntry> Columns;
> > +};
> > +
> > +struct FileChecksumEntry {
> > +  uint32_t FileNameOffset;    // Byte offset of filename in global
> stringtable.
> > +  FileChecksumKind Kind;      // The type of checksum.
> > +  ArrayRef<uint8_t> Checksum; // The bytes of the checksum.
> > +};
> > +
> > +typedef msf::VarStreamArray<LineColumnEntry> LineInfoArray;
> > +typedef msf::VarStreamArray<FileChecksumEntry> FileChecksumArray;
> > +
> > +class IModuleSubstreamVisitor {
> > +public:
> > +  virtual ~IModuleSubstreamVisitor() {}
> > +
> > +  virtual Error visitUnknown(ModuleSubstreamKind Kind, msf::StreamRef
> Data) = 0;
> > +  virtual Error visitSymbols(msf::StreamRef Data);
> > +  virtual Error visitLines(msf::StreamRef Data,
> > +                           const LineSubstreamHeader *Header,
> > +                           const LineInfoArray &Lines);
> > +  virtual Error visitStringTable(msf::StreamRef Data);
> > +  virtual Error visitFileChecksums(msf::StreamRef Data,
> > +                                   const FileChecksumArray &Checksums);
> > +  virtual Error visitFrameData(msf::StreamRef Data);
> > +  virtual Error visitInlineeLines(msf::StreamRef Data);
> > +  virtual Error visitCrossScopeImports(msf::StreamRef Data);
> > +  virtual Error visitCrossScopeExports(msf::StreamRef Data);
> > +  virtual Error visitILLines(msf::StreamRef Data);
> > +  virtual Error visitFuncMDTokenMap(msf::StreamRef Data);
> > +  virtual Error visitTypeMDTokenMap(msf::StreamRef Data);
> > +  virtual Error visitMergedAssemblyInput(msf::StreamRef Data);
> > +  virtual Error visitCoffSymbolRVA(msf::StreamRef Data);
> > };
> >
> > -template <> class VarStreamArrayExtractor<LineColumnEntry> {
> > +Error visitModuleSubstream(const ModuleSubstream &R,
> > +                           IModuleSubstreamVisitor &V);
> > +} // namespace codeview
> > +
> > +namespace msf {
> > +template <> class VarStreamArrayExtractor<codeview::LineColumnEntry> {
> > public:
> > -  VarStreamArrayExtractor(const LineSubstreamHeader *Header) :
> Header(Header) {}
> > +  VarStreamArrayExtractor(const codeview::LineSubstreamHeader *Header)
> > +      : Header(Header) {}
> >
> >   Error operator()(StreamRef Stream, uint32_t &Len,
> > -                   LineColumnEntry &Item) const {
> > +                   codeview::LineColumnEntry &Item) const {
> > +    using namespace codeview;
> >     const LineFileBlockHeader *BlockHeader;
> >     StreamReader Reader(Stream);
> >     if (auto EC = Reader.readObject(BlockHeader))
> > @@ -61,19 +99,14 @@ public:
> >   }
> >
> > private:
> > -  const LineSubstreamHeader *Header;
> > +  const codeview::LineSubstreamHeader *Header;
> > };
> >
> > -struct FileChecksumEntry {
> > -  uint32_t FileNameOffset;    // Byte offset of filename in global
> stringtable.
> > -  FileChecksumKind Kind;      // The type of checksum.
> > -  ArrayRef<uint8_t> Checksum; // The bytes of the checksum.
> > -};
> > -
> > -template <> class VarStreamArrayExtractor<FileChecksumEntry> {
> > +template <> class VarStreamArrayExtractor<codeview::FileChecksumEntry> {
> > public:
> >   Error operator()(StreamRef Stream, uint32_t &Len,
> > -                   FileChecksumEntry &Item) const {
> > +                   codeview::FileChecksumEntry &Item) const {
> > +    using namespace codeview;
> >     const FileChecksum *Header;
> >     StreamReader Reader(Stream);
> >     if (auto EC = Reader.readObject(Header))
> > @@ -87,35 +120,7 @@ public:
> >   }
> > };
> >
> > -typedef VarStreamArray<LineColumnEntry> LineInfoArray;
> > -typedef VarStreamArray<FileChecksumEntry> FileChecksumArray;
> > -
> > -class IModuleSubstreamVisitor {
> > -public:
> > -  virtual ~IModuleSubstreamVisitor() {}
> > -
> > -  virtual Error visitUnknown(ModuleSubstreamKind Kind, StreamRef Data)
> = 0;
> > -  virtual Error visitSymbols(StreamRef Data);
> > -  virtual Error visitLines(StreamRef Data, const LineSubstreamHeader
> *Header,
> > -                           const LineInfoArray &Lines);
> > -  virtual Error visitStringTable(StreamRef Data);
> > -  virtual Error visitFileChecksums(StreamRef Data,
> > -                                   const FileChecksumArray &Checksums);
> > -  virtual Error visitFrameData(StreamRef Data);
> > -  virtual Error visitInlineeLines(StreamRef Data);
> > -  virtual Error visitCrossScopeImports(StreamRef Data);
> > -  virtual Error visitCrossScopeExports(StreamRef Data);
> > -  virtual Error visitILLines(StreamRef Data);
> > -  virtual Error visitFuncMDTokenMap(StreamRef Data);
> > -  virtual Error visitTypeMDTokenMap(StreamRef Data);
> > -  virtual Error visitMergedAssemblyInput(StreamRef Data);
> > -  virtual Error visitCoffSymbolRVA(StreamRef Data);
> > -};
> > -
> > -Error visitModuleSubstream(const ModuleSubstream &R,
> > -                           IModuleSubstreamVisitor &V);
> > -
> > -} // namespace codeview
> > +} // namespace msf
> > } // namespace llvm
> >
> > #endif // LLVM_DEBUGINFO_CODEVIEW_MODULESUBSTREAMVISITOR_H
> >
> > Removed: llvm/trunk/include/llvm/DebugInfo/CodeView/StreamArray.h
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/StreamArray.h?rev=276457&view=auto
> >
> ==============================================================================
> > --- llvm/trunk/include/llvm/DebugInfo/CodeView/StreamArray.h (original)
> > +++ llvm/trunk/include/llvm/DebugInfo/CodeView/StreamArray.h (removed)
> > @@ -1,275 +0,0 @@
> > -//===- StreamArray.h - Array backed by an arbitrary stream
> ----------------===//
> > -//
> > -//                     The LLVM Compiler Infrastructure
> > -//
> > -// This file is distributed under the University of Illinois Open Source
> > -// License. See LICENSE.TXT for details.
> > -//
> >
> -//===----------------------------------------------------------------------===//
> > -
> > -#ifndef LLVM_DEBUGINFO_CODEVIEW_STREAMARRAY_H
> > -#define LLVM_DEBUGINFO_CODEVIEW_STREAMARRAY_H
> > -
> > -#include "llvm/DebugInfo/CodeView/StreamRef.h"
> > -#include "llvm/Support/Error.h"
> > -
> > -#include <functional>
> > -#include <type_traits>
> > -
> > -namespace llvm {
> > -namespace codeview {
> > -
> > -/// VarStreamArrayExtractor is intended to be specialized to provide
> customized
> > -/// extraction logic.  On input it receives a StreamRef pointing to the
> > -/// beginning of the next record, but where the length of the record is
> not yet
> > -/// known.  Upon completion, it should return an appropriate Error
> instance if
> > -/// a record could not be extracted, or if one could be extracted it
> should
> > -/// return success and set Len to the number of bytes this record
> occupied in
> > -/// the underlying stream, and it should fill out the fields of the
> value type
> > -/// Item appropriately to represent the current record.
> > -///
> > -/// You can specialize this template for your own custom value types to
> avoid
> > -/// having to specify a second template argument to VarStreamArray
> (documented
> > -/// below).
> > -template <typename T> struct VarStreamArrayExtractor {
> > -  // Method intentionally deleted.  You must provide an explicit
> specialization
> > -  // with the following method implemented.
> > -  Error operator()(StreamRef Stream, uint32_t &Len, T &Item) const =
> delete;
> > -};
> > -
> > -/// VarStreamArray represents an array of variable length records
> backed by a
> > -/// stream.  This could be a contiguous sequence of bytes in memory, it
> could
> > -/// be a file on disk, or it could be a PDB stream where bytes are
> stored as
> > -/// discontiguous blocks in a file.  Usually it is desirable to treat
> arrays
> > -/// as contiguous blocks of memory, but doing so with large PDB files,
> for
> > -/// example, could mean allocating huge amounts of memory just to allow
> > -/// re-ordering of stream data to be contiguous before iterating over
> it.  By
> > -/// abstracting this out, we need not duplicate this memory, and we can
> > -/// iterate over arrays in arbitrarily formatted streams.  Elements are
> parsed
> > -/// lazily on iteration, so there is no upfront cost associated with
> building
> > -/// a VarStreamArray, no matter how large it may be.
> > -///
> > -/// You create a VarStreamArray by specifying a ValueType and an
> Extractor type.
> > -/// If you do not specify an Extractor type, it expects you to
> specialize
> > -/// VarStreamArrayExtractor<T> for your ValueType.
> > -///
> > -/// By default an Extractor is default constructed in the class, but in
> some
> > -/// cases you might find it useful for an Extractor to maintain state
> across
> > -/// extractions.  In this case you can provide your own Extractor
> through a
> > -/// secondary constructor.  The following examples show various ways of
> > -/// creating a VarStreamArray.
> > -///
> > -///       // Will use VarStreamArrayExtractor<MyType> as the extractor.
> > -///       VarStreamArray<MyType> MyTypeArray;
> > -///
> > -///       // Will use a default-constructed MyExtractor as the
> extractor.
> > -///       VarStreamArray<MyType, MyExtractor> MyTypeArray2;
> > -///
> > -///       // Will use the specific instance of MyExtractor provided.
> > -///       // MyExtractor need not be default-constructible in this case.
> > -///       MyExtractor E(SomeContext);
> > -///       VarStreamArray<MyType, MyExtractor> MyTypeArray3(E);
> > -///
> > -template <typename ValueType, typename Extractor> class
> VarStreamArrayIterator;
> > -
> > -template <typename ValueType,
> > -          typename Extractor = VarStreamArrayExtractor<ValueType>>
> > -class VarStreamArray {
> > -  friend class VarStreamArrayIterator<ValueType, Extractor>;
> > -
> > -public:
> > -  typedef VarStreamArrayIterator<ValueType, Extractor> Iterator;
> > -
> > -  VarStreamArray() {}
> > -  explicit VarStreamArray(const Extractor &E) : E(E) {}
> > -
> > -  explicit VarStreamArray(StreamRef Stream) : Stream(Stream) {}
> > -  VarStreamArray(StreamRef Stream, const Extractor &E) :
> Stream(Stream), E(E) {}
> > -
> > -  VarStreamArray(const VarStreamArray<ValueType, Extractor> &Other)
> > -      : Stream(Other.Stream), E(Other.E) {}
> > -
> > -  Iterator begin(bool *HadError = nullptr) const {
> > -    return Iterator(*this, E, HadError);
> > -  }
> > -
> > -  Iterator end() const { return Iterator(E); }
> > -
> > -  const Extractor &getExtractor() const { return E; }
> > -
> > -  StreamRef getUnderlyingStream() const { return Stream; }
> > -
> > -private:
> > -  StreamRef Stream;
> > -  Extractor E;
> > -};
> > -
> > -template <typename ValueType, typename Extractor> class
> VarStreamArrayIterator {
> > -  typedef VarStreamArrayIterator<ValueType, Extractor> IterType;
> > -  typedef VarStreamArray<ValueType, Extractor> ArrayType;
> > -
> > -public:
> > -  VarStreamArrayIterator(const ArrayType &Array, const Extractor &E,
> > -                         bool *HadError = nullptr)
> > -      : IterRef(Array.Stream), Array(&Array), HadError(HadError),
> Extract(E) {
> > -    if (IterRef.getLength() == 0)
> > -      moveToEnd();
> > -    else {
> > -      auto EC = Extract(IterRef, ThisLen, ThisValue);
> > -      if (EC) {
> > -        consumeError(std::move(EC));
> > -        markError();
> > -      }
> > -    }
> > -  }
> > -  VarStreamArrayIterator() {}
> > -  explicit VarStreamArrayIterator(const Extractor &E) : Extract(E) {}
> > -  ~VarStreamArrayIterator() {}
> > -
> > -  bool operator==(const IterType &R) const {
> > -    if (Array && R.Array) {
> > -      // Both have a valid array, make sure they're same.
> > -      assert(Array == R.Array);
> > -      return IterRef == R.IterRef;
> > -    }
> > -
> > -    // Both iterators are at the end.
> > -    if (!Array && !R.Array)
> > -      return true;
> > -
> > -    // One is not at the end and one is.
> > -    return false;
> > -  }
> > -
> > -  bool operator!=(const IterType &R) { return !(*this == R); }
> > -
> > -  const ValueType &operator*() const {
> > -    assert(Array && !HasError);
> > -    return ThisValue;
> > -  }
> > -
> > -  IterType &operator++() {
> > -    // We are done with the current record, discard it so that we are
> > -    // positioned at the next record.
> > -    IterRef = IterRef.drop_front(ThisLen);
> > -    if (IterRef.getLength() == 0) {
> > -      // There is nothing after the current record, we must make this
> an end
> > -      // iterator.
> > -      moveToEnd();
> > -    } else {
> > -      // There is some data after the current record.
> > -      auto EC = Extract(IterRef, ThisLen, ThisValue);
> > -      if (EC) {
> > -        consumeError(std::move(EC));
> > -        markError();
> > -      } else if (ThisLen == 0) {
> > -        // An empty record? Make this an end iterator.
> > -        moveToEnd();
> > -      }
> > -    }
> > -    return *this;
> > -  }
> > -
> > -  IterType operator++(int) {
> > -    IterType Original = *this;
> > -    ++*this;
> > -    return Original;
> > -  }
> > -
> > -private:
> > -  void moveToEnd() {
> > -    Array = nullptr;
> > -    ThisLen = 0;
> > -  }
> > -  void markError() {
> > -    moveToEnd();
> > -    HasError = true;
> > -    if (HadError != nullptr)
> > -      *HadError = true;
> > -  }
> > -
> > -  ValueType ThisValue;
> > -  StreamRef IterRef;
> > -  const ArrayType *Array{nullptr};
> > -  uint32_t ThisLen{0};
> > -  bool HasError{false};
> > -  bool *HadError{nullptr};
> > -  Extractor Extract;
> > -};
> > -
> > -template <typename T> class FixedStreamArrayIterator;
> > -
> > -template <typename T> class FixedStreamArray {
> > -  friend class FixedStreamArrayIterator<T>;
> > -
> > -public:
> > -  FixedStreamArray() : Stream() {}
> > -  FixedStreamArray(StreamRef Stream) : Stream(Stream) {
> > -    assert(Stream.getLength() % sizeof(T) == 0);
> > -  }
> > -
> > -  const T &operator[](uint32_t Index) const {
> > -    assert(Index < size());
> > -    uint32_t Off = Index * sizeof(T);
> > -    ArrayRef<uint8_t> Data;
> > -    if (auto EC = Stream.readBytes(Off, sizeof(T), Data)) {
> > -      assert(false && "Unexpected failure reading from stream");
> > -      // This should never happen since we asserted that the stream
> length was
> > -      // an exact multiple of the element size.
> > -      consumeError(std::move(EC));
> > -    }
> > -    return *reinterpret_cast<const T *>(Data.data());
> > -  }
> > -
> > -  uint32_t size() const { return Stream.getLength() / sizeof(T); }
> > -
> > -  FixedStreamArrayIterator<T> begin() const {
> > -    return FixedStreamArrayIterator<T>(*this, 0);
> > -  }
> > -  FixedStreamArrayIterator<T> end() const {
> > -    return FixedStreamArrayIterator<T>(*this, size());
> > -  }
> > -
> > -  StreamRef getUnderlyingStream() const { return Stream; }
> > -
> > -private:
> > -  StreamRef Stream;
> > -};
> > -
> > -template <typename T> class FixedStreamArrayIterator {
> > -public:
> > -  FixedStreamArrayIterator(const FixedStreamArray<T> &Array, uint32_t
> Index)
> > -      : Array(Array), Index(Index) {}
> > -
> > -  bool operator==(const FixedStreamArrayIterator<T> &R) {
> > -    assert(&Array == &R.Array);
> > -    return Index == R.Index;
> > -  }
> > -
> > -  bool operator!=(const FixedStreamArrayIterator<T> &R) {
> > -    return !(*this == R);
> > -  }
> > -
> > -  const T &operator*() const { return Array[Index]; }
> > -
> > -  FixedStreamArrayIterator<T> &operator++() {
> > -    assert(Index < Array.size());
> > -    ++Index;
> > -    return *this;
> > -  }
> > -
> > -  FixedStreamArrayIterator<T> operator++(int) {
> > -    FixedStreamArrayIterator<T> Original = *this;
> > -    ++*this;
> > -    return Original;
> > -  }
> > -
> > -private:
> > -  const FixedStreamArray<T> &Array;
> > -  uint32_t Index;
> > -};
> > -
> > -} // namespace codeview
> > -} // namespace llvm
> > -
> > -#endif // LLVM_DEBUGINFO_CODEVIEW_STREAMARRAY_H
> >
> > Removed: llvm/trunk/include/llvm/DebugInfo/CodeView/StreamInterface.h
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/StreamInterface.h?rev=276457&view=auto
> >
> ==============================================================================
> > --- llvm/trunk/include/llvm/DebugInfo/CodeView/StreamInterface.h
> (original)
> > +++ llvm/trunk/include/llvm/DebugInfo/CodeView/StreamInterface.h
> (removed)
> > @@ -1,55 +0,0 @@
> > -//===- StreamInterface.h - Base interface for a stream of data --*- C++
> -*-===//
> > -//
> > -//                     The LLVM Compiler Infrastructure
> > -//
> > -// This file is distributed under the University of Illinois Open Source
> > -// License. See LICENSE.TXT for details.
> > -//
> >
> -//===----------------------------------------------------------------------===//
> > -
> > -#ifndef LLVM_DEBUGINFO_CODEVIEW_STREAMINTERFACE_H
> > -#define LLVM_DEBUGINFO_CODEVIEW_STREAMINTERFACE_H
> > -
> > -#include "llvm/ADT/ArrayRef.h"
> > -#include "llvm/Support/Error.h"
> > -#include <cstdint>
> > -
> > -namespace llvm {
> > -namespace codeview {
> > -
> > -/// StreamInterface abstracts the notion of a data stream.  This way, an
> > -/// implementation could implement trivial reading from a contiguous
> memory
> > -/// buffer or, as in the case of PDB files, reading from a set of
> possibly
> > -/// discontiguous blocks.  The implementation is required to return
> references
> > -/// to stable memory, so if this is not possible (for example in the
> case of
> > -/// a PDB file with discontiguous blocks, it must keep its own pool of
> temp
> > -/// storage.
> > -class StreamInterface {
> > -public:
> > -  virtual ~StreamInterface() {}
> > -
> > -  // Given an offset into the stream and a number of bytes, attempt to
> read
> > -  // the bytes and set the output ArrayRef to point to a reference into
> the
> > -  // stream, without copying any data.
> > -  virtual Error readBytes(uint32_t Offset, uint32_t Size,
> > -                          ArrayRef<uint8_t> &Buffer) const = 0;
> > -
> > -  // Given an offset into the stream, read as much as possible without
> copying
> > -  // any data.
> > -  virtual Error readLongestContiguousChunk(uint32_t Offset,
> > -                                           ArrayRef<uint8_t> &Buffer)
> const = 0;
> > -
> > -  // Attempt to write the given bytes into the stream at the desired
> offset.
> > -  // This will always necessitate a copy.  Cannot shrink or grow the
> stream,
> > -  // only writes into existing allocated space.
> > -  virtual Error writeBytes(uint32_t Offset, ArrayRef<uint8_t> Data)
> const = 0;
> > -
> > -  virtual uint32_t getLength() const = 0;
> > -
> > -  virtual Error commit() const = 0;
> > -};
> > -
> > -} // end namespace codeview
> > -} // end namespace llvm
> > -
> > -#endif // LLVM_DEBUGINFO_CODEVIEW_STREAMINTERFACE_H
> >
> > Removed: llvm/trunk/include/llvm/DebugInfo/CodeView/StreamReader.h
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/StreamReader.h?rev=276457&view=auto
> >
> ==============================================================================
> > --- llvm/trunk/include/llvm/DebugInfo/CodeView/StreamReader.h (original)
> > +++ llvm/trunk/include/llvm/DebugInfo/CodeView/StreamReader.h (removed)
> > @@ -1,111 +0,0 @@
> > -//===- StreamReader.h - Reads bytes and objects from a stream ---*- C++
> -*-===//
> > -//
> > -//                     The LLVM Compiler Infrastructure
> > -//
> > -// This file is distributed under the University of Illinois Open Source
> > -// License. See LICENSE.TXT for details.
> > -//
> >
> -//===----------------------------------------------------------------------===//
> > -
> > -#ifndef LLVM_DEBUGINFO_CODEVIEW_STREAMREADER_H
> > -#define LLVM_DEBUGINFO_CODEVIEW_STREAMREADER_H
> > -
> > -#include "llvm/ADT/ArrayRef.h"
> > -#include "llvm/DebugInfo/CodeView/CodeViewError.h"
> > -#include "llvm/DebugInfo/CodeView/StreamArray.h"
> > -#include "llvm/DebugInfo/CodeView/StreamInterface.h"
> > -#include "llvm/Support/Endian.h"
> > -#include "llvm/Support/Error.h"
> > -
> > -#include <string>
> > -
> > -namespace llvm {
> > -namespace codeview {
> > -
> > -class StreamRef;
> > -
> > -class StreamReader {
> > -public:
> > -  StreamReader(StreamRef Stream);
> > -
> > -  Error readLongestContiguousChunk(ArrayRef<uint8_t> &Buffer);
> > -  Error readBytes(ArrayRef<uint8_t> &Buffer, uint32_t Size);
> > -  Error readInteger(uint16_t &Dest);
> > -  Error readInteger(uint32_t &Dest);
> > -  Error readZeroString(StringRef &Dest);
> > -  Error readFixedString(StringRef &Dest, uint32_t Length);
> > -  Error readStreamRef(StreamRef &Ref);
> > -  Error readStreamRef(StreamRef &Ref, uint32_t Length);
> > -
> > -  template <typename T> Error readEnum(T &Dest) {
> > -    typename std::underlying_type<T>::type N;
> > -    if (auto EC = readInteger(N))
> > -      return EC;
> > -    Dest = static_cast<T>(N);
> > -    return Error::success();
> > -  }
> > -
> > -  template <typename T> Error readObject(const T *&Dest) {
> > -    ArrayRef<uint8_t> Buffer;
> > -    if (auto EC = readBytes(Buffer, sizeof(T)))
> > -      return EC;
> > -    Dest = reinterpret_cast<const T *>(Buffer.data());
> > -    return Error::success();
> > -  }
> > -
> > -  template <typename T>
> > -  Error readArray(ArrayRef<T> &Array, uint32_t NumElements) {
> > -    ArrayRef<uint8_t> Bytes;
> > -    if (NumElements == 0) {
> > -      Array = ArrayRef<T>();
> > -      return Error::success();
> > -    }
> > -
> > -    if (NumElements > UINT32_MAX/sizeof(T))
> > -      return
> make_error<CodeViewError>(cv_error_code::insufficient_buffer);
> > -
> > -    if (auto EC = readBytes(Bytes, NumElements * sizeof(T)))
> > -      return EC;
> > -    Array = ArrayRef<T>(reinterpret_cast<const T *>(Bytes.data()),
> NumElements);
> > -    return Error::success();
> > -  }
> > -
> > -  template <typename T, typename U>
> > -  Error readArray(VarStreamArray<T, U> &Array, uint32_t Size) {
> > -    StreamRef S;
> > -    if (auto EC = readStreamRef(S, Size))
> > -      return EC;
> > -    Array = VarStreamArray<T, U>(S, Array.getExtractor());
> > -    return Error::success();
> > -  }
> > -
> > -  template <typename T>
> > -  Error readArray(FixedStreamArray<T> &Array, uint32_t NumItems) {
> > -    if (NumItems == 0) {
> > -      Array = FixedStreamArray<T>();
> > -      return Error::success();
> > -    }
> > -    uint32_t Length = NumItems * sizeof(T);
> > -    if (Length / sizeof(T) != NumItems)
> > -      return make_error<CodeViewError>(cv_error_code::corrupt_record);
> > -    if (Offset + Length > Stream.getLength())
> > -      return
> make_error<CodeViewError>(cv_error_code::insufficient_buffer);
> > -    StreamRef View = Stream.slice(Offset, Length);
> > -    Array = FixedStreamArray<T>(View);
> > -    Offset += Length;
> > -    return Error::success();
> > -  }
> > -
> > -  void setOffset(uint32_t Off) { Offset = Off; }
> > -  uint32_t getOffset() const { return Offset; }
> > -  uint32_t getLength() const { return Stream.getLength(); }
> > -  uint32_t bytesRemaining() const { return getLength() - getOffset(); }
> > -
> > -private:
> > -  StreamRef Stream;
> > -  uint32_t Offset;
> > -};
> > -} // namespace codeview
> > -} // namespace llvm
> > -
> > -#endif // LLVM_DEBUGINFO_CODEVIEW_STREAMREADER_H
> >
> > Removed: llvm/trunk/include/llvm/DebugInfo/CodeView/StreamRef.h
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/StreamRef.h?rev=276457&view=auto
> >
> ==============================================================================
> > --- llvm/trunk/include/llvm/DebugInfo/CodeView/StreamRef.h (original)
> > +++ llvm/trunk/include/llvm/DebugInfo/CodeView/StreamRef.h (removed)
> > @@ -1,104 +0,0 @@
> > -//===- StreamRef.h - A copyable reference to a stream -----------*- C++
> -*-===//
> > -//
> > -//                     The LLVM Compiler Infrastructure
> > -//
> > -// This file is distributed under the University of Illinois Open Source
> > -// License. See LICENSE.TXT for details.
> > -//
> >
> -//===----------------------------------------------------------------------===//
> > -
> > -#ifndef LLVM_DEBUGINFO_CODEVIEW_STREAMREF_H
> > -#define LLVM_DEBUGINFO_CODEVIEW_STREAMREF_H
> > -
> > -#include "llvm/DebugInfo/CodeView/CodeViewError.h"
> > -#include "llvm/DebugInfo/CodeView/StreamInterface.h"
> > -
> > -namespace llvm {
> > -namespace codeview {
> > -
> > -class StreamRef {
> > -public:
> > -  StreamRef() : Stream(nullptr), ViewOffset(0), Length(0) {}
> > -  StreamRef(const StreamInterface &Stream)
> > -      : Stream(&Stream), ViewOffset(0), Length(Stream.getLength()) {}
> > -  StreamRef(const StreamInterface &Stream, uint32_t Offset, uint32_t
> Length)
> > -      : Stream(&Stream), ViewOffset(Offset), Length(Length) {}
> > -
> > -  // Use StreamRef.slice() instead.
> > -  StreamRef(const StreamRef &S, uint32_t Offset, uint32_t Length) =
> delete;
> > -
> > -  Error readBytes(uint32_t Offset, uint32_t Size,
> > -                  ArrayRef<uint8_t> &Buffer) const {
> > -    if (ViewOffset + Offset < Offset)
> > -      return
> make_error<CodeViewError>(cv_error_code::insufficient_buffer);
> > -    if (Size + Offset > Length)
> > -      return
> make_error<CodeViewError>(cv_error_code::insufficient_buffer);
> > -    return Stream->readBytes(ViewOffset + Offset, Size, Buffer);
> > -  }
> > -
> > -  // Given an offset into the stream, read as much as possible without
> copying
> > -  // any data.
> > -  Error readLongestContiguousChunk(uint32_t Offset,
> > -                                   ArrayRef<uint8_t> &Buffer) const {
> > -    if (Offset >= Length)
> > -      return
> make_error<CodeViewError>(cv_error_code::insufficient_buffer);
> > -
> > -    if (auto EC = Stream->readLongestContiguousChunk(Offset, Buffer))
> > -      return EC;
> > -    // This StreamRef might refer to a smaller window over a larger
> stream.  In
> > -    // that case we will have read out more bytes than we should
> return, because
> > -    // we should not read past the end of the current view.
> > -    uint32_t MaxLength = Length - Offset;
> > -    if (Buffer.size() > MaxLength)
> > -      Buffer = Buffer.slice(0, MaxLength);
> > -    return Error::success();
> > -  }
> > -
> > -  Error writeBytes(uint32_t Offset, ArrayRef<uint8_t> Data) const {
> > -    if (Data.size() + Offset > Length)
> > -      return
> make_error<CodeViewError>(cv_error_code::insufficient_buffer);
> > -    return Stream->writeBytes(ViewOffset + Offset, Data);
> > -  }
> > -
> > -  uint32_t getLength() const { return Length; }
> > -
> > -  Error commit() const { return Stream->commit(); }
> > -
> > -  StreamRef drop_front(uint32_t N) const {
> > -    if (!Stream)
> > -      return StreamRef();
> > -
> > -    N = std::min(N, Length);
> > -    return StreamRef(*Stream, ViewOffset + N, Length - N);
> > -  }
> > -
> > -  StreamRef keep_front(uint32_t N) const {
> > -    if (!Stream)
> > -      return StreamRef();
> > -    N = std::min(N, Length);
> > -    return StreamRef(*Stream, ViewOffset, N);
> > -  }
> > -
> > -  StreamRef slice(uint32_t Offset, uint32_t Len) const {
> > -    return drop_front(Offset).keep_front(Len);
> > -  }
> > -
> > -  bool operator==(const StreamRef &Other) const {
> > -    if (Stream != Other.Stream)
> > -      return false;
> > -    if (ViewOffset != Other.ViewOffset)
> > -      return false;
> > -    if (Length != Other.Length)
> > -      return false;
> > -    return true;
> > -  }
> > -
> > -private:
> > -  const StreamInterface *Stream;
> > -  uint32_t ViewOffset;
> > -  uint32_t Length;
> > -};
> > -}
> > -}
> > -
> > -#endif // LLVM_DEBUGINFO_CODEVIEW_STREAMREF_H
> >
> > Removed: llvm/trunk/include/llvm/DebugInfo/CodeView/StreamWriter.h
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/StreamWriter.h?rev=276457&view=auto
> >
> ==============================================================================
> > --- llvm/trunk/include/llvm/DebugInfo/CodeView/StreamWriter.h (original)
> > +++ llvm/trunk/include/llvm/DebugInfo/CodeView/StreamWriter.h (removed)
> > @@ -1,86 +0,0 @@
> > -//===- StreamWriter.h - Writes bytes and objects to a stream ----*- C++
> -*-===//
> > -//
> > -//                     The LLVM Compiler Infrastructure
> > -//
> > -// This file is distributed under the University of Illinois Open Source
> > -// License. See LICENSE.TXT for details.
> > -//
> >
> -//===----------------------------------------------------------------------===//
> > -
> > -#ifndef LLVM_DEBUGINFO_CODEVIEW_STREAMWRITER_H
> > -#define LLVM_DEBUGINFO_CODEVIEW_STREAMWRITER_H
> > -
> > -#include "llvm/ADT/ArrayRef.h"
> > -#include "llvm/DebugInfo/CodeView/CodeViewError.h"
> > -#include "llvm/DebugInfo/CodeView/StreamArray.h"
> > -#include "llvm/DebugInfo/CodeView/StreamInterface.h"
> > -#include "llvm/Support/Endian.h"
> > -#include "llvm/Support/Error.h"
> > -
> > -#include <string>
> > -
> > -namespace llvm {
> > -namespace codeview {
> > -
> > -class StreamRef;
> > -
> > -class StreamWriter {
> > -public:
> > -  StreamWriter(StreamRef Stream);
> > -
> > -  Error writeBytes(ArrayRef<uint8_t> Buffer);
> > -  Error writeInteger(uint16_t Dest);
> > -  Error writeInteger(uint32_t Dest);
> > -  Error writeZeroString(StringRef Str);
> > -  Error writeFixedString(StringRef Str);
> > -  Error writeStreamRef(StreamRef Ref);
> > -  Error writeStreamRef(StreamRef Ref, uint32_t Size);
> > -
> > -  template <typename T> Error writeEnum(T Num) {
> > -    return writeInteger(
> > -        static_cast<typename std::underlying_type<T>::type>(Num));
> > -  }
> > -
> > -  template <typename T> Error writeObject(const T &Obj) {
> > -    static_assert(!std::is_pointer<T>::value,
> > -                  "writeObject should not be used with pointers, to
> write "
> > -                  "the pointed-to value dereference the pointer before
> calling "
> > -                  "writeObject");
> > -    return writeBytes(
> > -        ArrayRef<uint8_t>(reinterpret_cast<const uint8_t *>(&Obj),
> sizeof(T)));
> > -  }
> > -
> > -  template <typename T> Error writeArray(ArrayRef<T> Array) {
> > -    if (Array.size() == 0)
> > -      return Error::success();
> > -
> > -    if (Array.size() > UINT32_MAX / sizeof(T))
> > -      return
> make_error<CodeViewError>(cv_error_code::insufficient_buffer);
> > -
> > -    return writeBytes(
> > -        ArrayRef<uint8_t>(reinterpret_cast<const uint8_t
> *>(Array.data()),
> > -                          Array.size() * sizeof(T)));
> > -  }
> > -
> > -  template <typename T, typename U>
> > -  Error writeArray(VarStreamArray<T, U> Array) {
> > -    return writeStreamRef(Array.getUnderlyingStream());
> > -  }
> > -
> > -  template <typename T> Error writeArray(FixedStreamArray<T> Array) {
> > -    return writeStreamRef(Array.getUnderlyingStream());
> > -  }
> > -
> > -  void setOffset(uint32_t Off) { Offset = Off; }
> > -  uint32_t getOffset() const { return Offset; }
> > -  uint32_t getLength() const { return Stream.getLength(); }
> > -  uint32_t bytesRemaining() const { return getLength() - getOffset(); }
> > -
> > -private:
> > -  StreamRef Stream;
> > -  uint32_t Offset;
> > -};
> > -} // namespace codeview
> > -} // namespace llvm
> > -
> > -#endif // LLVM_DEBUGINFO_CODEVIEW_STREAMREADER_H
> >
> > Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/SymbolRecord.h
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/SymbolRecord.h?rev=276458&r1=276457&r2=276458&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/include/llvm/DebugInfo/CodeView/SymbolRecord.h (original)
> > +++ llvm/trunk/include/llvm/DebugInfo/CodeView/SymbolRecord.h Fri Jul 22
> 14:56:05 2016
> > @@ -15,18 +15,17 @@
> > #include "llvm/DebugInfo/CodeView/CVRecord.h"
> > #include "llvm/DebugInfo/CodeView/CodeView.h"
> > #include "llvm/DebugInfo/CodeView/RecordSerialization.h"
> > -#include "llvm/DebugInfo/CodeView/StreamArray.h"
> > -#include "llvm/DebugInfo/CodeView/StreamInterface.h"
> > #include "llvm/DebugInfo/CodeView/TypeIndex.h"
> > +#include "llvm/DebugInfo/Msf/StreamArray.h"
> > #include "llvm/Support/Endian.h"
> > #include "llvm/Support/Error.h"
> >
> > namespace llvm {
> > namespace codeview {
> >
> > -using llvm::support::ulittle16_t;
> > -using llvm::support::ulittle32_t;
> > -using llvm::support::little32_t;
> > +using support::ulittle16_t;
> > +using support::ulittle32_t;
> > +using support::little32_t;
> >
> > class SymbolRecord {
> > protected:
> > @@ -1444,7 +1443,7 @@ public:
> > };
> >
> > typedef CVRecord<SymbolKind> CVSymbol;
> > -typedef VarStreamArray<CVSymbol> CVSymbolArray;
> > +typedef msf::VarStreamArray<CVSymbol> CVSymbolArray;
> >
> > } // namespace codeview
> > } // namespace llvm
> >
> > Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/TypeRecord.h
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/TypeRecord.h?rev=276458&r1=276457&r2=276458&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/include/llvm/DebugInfo/CodeView/TypeRecord.h (original)
> > +++ llvm/trunk/include/llvm/DebugInfo/CodeView/TypeRecord.h Fri Jul 22
> 14:56:05 2016
> > @@ -1195,7 +1195,7 @@ private:
> > };
> >
> > typedef CVRecord<TypeLeafKind> CVType;
> > -typedef VarStreamArray<CVType> CVTypeArray;
> > +typedef msf::VarStreamArray<CVType> CVTypeArray;
> > }
> > }
> >
> >
> > Copied: llvm/trunk/include/llvm/DebugInfo/Msf/ByteStream.h (from
> r276457, llvm/trunk/include/llvm/DebugInfo/CodeView/ByteStream.h)
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/Msf/ByteStream.h?p2=llvm/trunk/include/llvm/DebugInfo/Msf/ByteStream.h&p1=llvm/trunk/include/llvm/DebugInfo/CodeView/ByteStream.h&r1=276457&r2=276458&rev=276458&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/include/llvm/DebugInfo/CodeView/ByteStream.h (original)
> > +++ llvm/trunk/include/llvm/DebugInfo/Msf/ByteStream.h Fri Jul 22
> 14:56:05 2016
> > @@ -7,19 +7,19 @@
> > //
> >
> //===----------------------------------------------------------------------===//
> >
> > -#ifndef LLVM_DEBUGINFO_CODEVIEW_BYTESTREAM_H
> > -#define LLVM_DEBUGINFO_CODEVIEW_BYTESTREAM_H
> > +#ifndef LLVM_DEBUGINFO_MSF_BYTESTREAM_H
> > +#define LLVM_DEBUGINFO_MSF_BYTESTREAM_H
> >
> > #include "llvm/ADT/ArrayRef.h"
> > #include "llvm/ADT/StringRef.h"
> > -#include "llvm/DebugInfo/CodeView/StreamInterface.h"
> > +#include "llvm/DebugInfo/Msf/StreamInterface.h"
> > #include "llvm/Support/Error.h"
> > #include <cstdint>
> > #include <memory>
> > #include <type_traits>
> >
> > namespace llvm {
> > -namespace codeview {
> > +namespace msf {
> > class StreamReader;
> >
> > template <bool Writable = false> class ByteStream : public
> StreamInterface {
> > @@ -52,7 +52,7 @@ private:
> > extern template class ByteStream<true>;
> > extern template class ByteStream<false>;
> >
> > -} // end namespace pdb
> > +} // end namespace msf
> > } // end namespace llvm
> >
> > -#endif // LLVM_DEBUGINFO_CODEVIEW_BYTESTREAM_H
> > +#endif // LLVM_DEBUGINFO_MSF_BYTESTREAM_H
> >
> > Copied: llvm/trunk/include/llvm/DebugInfo/Msf/DirectoryStreamData.h
> (from r276457,
> llvm/trunk/include/llvm/DebugInfo/PDB/Raw/DirectoryStreamData.h)
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/Msf/DirectoryStreamData.h?p2=llvm/trunk/include/llvm/DebugInfo/Msf/DirectoryStreamData.h&p1=llvm/trunk/include/llvm/DebugInfo/PDB/Raw/DirectoryStreamData.h&r1=276457&r2=276458&rev=276458&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/include/llvm/DebugInfo/PDB/Raw/DirectoryStreamData.h
> (original)
> > +++ llvm/trunk/include/llvm/DebugInfo/Msf/DirectoryStreamData.h Fri Jul
> 22 14:56:05 2016
> > @@ -7,29 +7,31 @@
> > //
> >
> //===----------------------------------------------------------------------===//
> >
> > -#ifndef LLVM_DEBUGINFO_PDB_RAW_DIRECTORYSTREAMDATA_H
> > -#define LLVM_DEBUGINFO_PDB_RAW_DIRECTORYSTREAMDATA_H
> > +#ifndef LLVM_DEBUGINFO_MSF_DIRECTORYSTREAMDATA_H
> > +#define LLVM_DEBUGINFO_MSF_DIRECTORYSTREAMDATA_H
> >
> > #include "llvm/ADT/ArrayRef.h"
> > -#include "llvm/DebugInfo/PDB/Raw/IPDBStreamData.h"
> > -#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
> > +#include "llvm/DebugInfo/Msf/IMsfFile.h"
> > +#include "llvm/DebugInfo/Msf/IMsfStreamData.h"
> > #include "llvm/Support/Endian.h"
> >
> > namespace llvm {
> > -namespace pdb {
> > -class IPDBFile;
> > +namespace msf {
> > +class IMsfFile;
> >
> > -class DirectoryStreamData : public IPDBStreamData {
> > +class DirectoryStreamData : public IMsfStreamData {
> > public:
> > -  DirectoryStreamData(const PDBFile &File) : File(File) {}
> > +  DirectoryStreamData(uint32_t Length, ArrayRef<support::ulittle32_t>
> Blocks)
> > +      : Length(Length), Blocks(Blocks) {}
> >
> > -  virtual uint32_t getLength() { return File.getNumDirectoryBytes(); }
> > +  virtual uint32_t getLength() { return Length; }
> >   virtual llvm::ArrayRef<llvm::support::ulittle32_t> getStreamBlocks() {
> > -    return File.getDirectoryBlockArray();
> > +    return Blocks;
> >   }
> >
> > private:
> > -  const PDBFile &File;
> > +  uint32_t Length;
> > +  ArrayRef<support::ulittle32_t> Blocks;
> > };
> > }
> > }
> >
> > Copied: llvm/trunk/include/llvm/DebugInfo/Msf/IMsfFile.h (from r276457,
> llvm/trunk/include/llvm/DebugInfo/PDB/Raw/IPDBFile.h)
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/Msf/IMsfFile.h?p2=llvm/trunk/include/llvm/DebugInfo/Msf/IMsfFile.h&p1=llvm/trunk/include/llvm/DebugInfo/PDB/Raw/IPDBFile.h&r1=276457&r2=276458&rev=276458&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/include/llvm/DebugInfo/PDB/Raw/IPDBFile.h (original)
> > +++ llvm/trunk/include/llvm/DebugInfo/Msf/IMsfFile.h Fri Jul 22 14:56:05
> 2016
> > @@ -1,4 +1,4 @@
> > -//===- IPDBFile.h - Abstract base class for a PDB file ----------*- C++
> -*-===//
> > +//===- IMsfFile.h - Abstract base class for an MSF file ---------*- C++
> -*-===//
> > //
> > //                     The LLVM Compiler Infrastructure
> > //
> > @@ -7,23 +7,23 @@
> > //
> >
> //===----------------------------------------------------------------------===//
> >
> > -#ifndef LLVM_DEBUGINFO_PDB_RAW_IPDBFILE_H
> > -#define LLVM_DEBUGINFO_PDB_RAW_IPDBFILE_H
> > +#ifndef LLVM_DEBUGINFO_MSF_IMSFFILE_H
> > +#define LLVM_DEBUGINFO_MSF_IMSFFILE_H
> >
> > #include "llvm/ADT/ArrayRef.h"
> > #include "llvm/ADT/StringRef.h"
> > -#include "llvm/DebugInfo/CodeView/StreamArray.h"
> > +#include "llvm/DebugInfo/Msf/StreamArray.h"
> > #include "llvm/Support/Endian.h"
> > #include "llvm/Support/Error.h"
> >
> > #include <stdint.h>
> >
> > namespace llvm {
> > -namespace pdb {
> > +namespace msf {
> >
> > -class IPDBFile {
> > +class IMsfFile {
> > public:
> > -  virtual ~IPDBFile() {}
> > +  virtual ~IMsfFile() {}
> >
> >   virtual uint32_t getBlockSize() const = 0;
> >   virtual uint32_t getBlockCount() const = 0;
> > @@ -41,4 +41,4 @@ public:
> > }
> > }
> >
> > -#endif // LLVM_DEBUGINFO_PDB_RAW_IPDBFILE_H
> > +#endif // LLVM_DEBUGINFO_MSF_IMSFFILE_H
> >
> > Copied: llvm/trunk/include/llvm/DebugInfo/Msf/IMsfStreamData.h (from
> r276457, llvm/trunk/include/llvm/DebugInfo/PDB/Raw/IPDBStreamData.h)
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/Msf/IMsfStreamData.h?p2=llvm/trunk/include/llvm/DebugInfo/Msf/IMsfStreamData.h&p1=llvm/trunk/include/llvm/DebugInfo/PDB/Raw/IPDBStreamData.h&r1=276457&r2=276458&rev=276458&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/include/llvm/DebugInfo/PDB/Raw/IPDBStreamData.h (original)
> > +++ llvm/trunk/include/llvm/DebugInfo/Msf/IMsfStreamData.h Fri Jul 22
> 14:56:05 2016
> > @@ -1,4 +1,4 @@
> > -//===- IPDBStreamData.h - Base interface for PDB Stream Data ----*- C++
> -*-===//
> > +//===- IMsfStreamData.h - Base interface for Msf Stream Data ----*- C++
> -*-===//
> > //
> > //                     The LLVM Compiler Infrastructure
> > //
> > @@ -7,15 +7,17 @@
> > //
> >
> //===----------------------------------------------------------------------===//
> >
> > -#ifndef LLVM_DEBUGINFO_PDB_RAW_IPDBSTREAMDATA_H
> > -#define LLVM_DEBUGINFO_PDB_RAW_IPDBSTREAMDATA_H
> > +#ifndef LLVM_DEBUGINFO_MSF_IMSFSTREAMDATA_H
> > +#define LLVM_DEBUGINFO_MSF_IMSFSTREAMDATA_H
> >
> > #include "llvm/ADT/ArrayRef.h"
> > #include "llvm/Support/Endian.h"
> >
> > +#include <cstdint>
> > +
> > namespace llvm {
> > -namespace pdb {
> > -/// IPDBStream abstracts the notion of PDB stream data.  Although we
> already
> > +namespace msf {
> > +/// IMsfStream abstracts the notion of PDB stream data.  Although we
> already
> > /// have another stream abstraction (namely in the form of
> StreamInterface
> > /// and MappedBlockStream), they assume that the stream data is
> referenced
> > /// the same way.  Namely, by looking in the directory to get the list of
> > @@ -25,14 +27,14 @@ namespace pdb {
> > /// notion of stream data further, we can use a MappedBlockStream to read
> > /// from the directory itself, or from an indexed stream which references
> > /// the directory.
> > -class IPDBStreamData {
> > +class IMsfStreamData {
> > public:
> > -  virtual ~IPDBStreamData() {}
> > +  virtual ~IMsfStreamData() {}
> >
> >   virtual uint32_t getLength() = 0;
> >   virtual ArrayRef<support::ulittle32_t> getStreamBlocks() = 0;
> > };
> > -}
> > -}
> > +} // namespace msf
> > +} // namespace llvm
> >
> > -#endif
> > +#endif // LLVM_DEBUGINFO_MSF_IMSFSTREAMDATA_H
> >
> > Copied: llvm/trunk/include/llvm/DebugInfo/Msf/IndexedStreamData.h (from
> r276457, llvm/trunk/include/llvm/DebugInfo/PDB/Raw/IndexedStreamData.h)
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/Msf/IndexedStreamData.h?p2=llvm/trunk/include/llvm/DebugInfo/Msf/IndexedStreamData.h&p1=llvm/trunk/include/llvm/DebugInfo/PDB/Raw/IndexedStreamData.h&r1=276457&r2=276458&rev=276458&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/include/llvm/DebugInfo/PDB/Raw/IndexedStreamData.h
> (original)
> > +++ llvm/trunk/include/llvm/DebugInfo/Msf/IndexedStreamData.h Fri Jul 22
> 14:56:05 2016
> > @@ -1,4 +1,4 @@
> > -//===- IndexedStreamData.h - Standard PDB Stream Data -----------*- C++
> -*-===//
> > +//===- IndexedStreamData.h - Standard Msf Stream Data -----------*- C++
> -*-===//
> > //
> > //                     The LLVM Compiler Infrastructure
> > //
> > @@ -7,18 +7,18 @@
> > //
> >
> //===----------------------------------------------------------------------===//
> >
> > -#ifndef LLVM_DEBUGINFO_PDB_RAW_INDEXEDSTREAMDATA_H
> > -#define LLVM_DEBUGINFO_PDB_RAW_INDEXEDSTREAMDATA_H
> > +#ifndef LLVM_DEBUGINFO_MSF_INDEXEDSTREAMDATA_H
> > +#define LLVM_DEBUGINFO_MSF_INDEXEDSTREAMDATA_H
> >
> > -#include "llvm/DebugInfo/PDB/Raw/IPDBStreamData.h"
> > +#include "llvm/DebugInfo/Msf/IMsfStreamData.h"
> >
> > namespace llvm {
> > -namespace pdb {
> > -class IPDBFile;
> > +namespace msf {
> > +class IMsfFile;
> >
> > -class IndexedStreamData : public IPDBStreamData {
> > +class IndexedStreamData : public IMsfStreamData {
> > public:
> > -  IndexedStreamData(uint32_t StreamIdx, const IPDBFile &File);
> > +  IndexedStreamData(uint32_t StreamIdx, const IMsfFile &File);
> >   virtual ~IndexedStreamData() {}
> >
> >   uint32_t getLength() override;
> > @@ -26,9 +26,9 @@ public:
> >
> > private:
> >   uint32_t StreamIdx;
> > -  const IPDBFile &File;
> > +  const IMsfFile &File;
> > };
> > -}
> > -}
> > +} // namespace msf
> > +} // namespace llvm
> >
> > -#endif
> > +#endif // LLVM_DEBUGINFO_MSF_INDEXEDSTREAMDATA_H
> >
> > Copied: llvm/trunk/include/llvm/DebugInfo/Msf/MappedBlockStream.h (from
> r276457, llvm/trunk/include/llvm/DebugInfo/PDB/Raw/MappedBlockStream.h)
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/Msf/MappedBlockStream.h?p2=llvm/trunk/include/llvm/DebugInfo/Msf/MappedBlockStream.h&p1=llvm/trunk/include/llvm/DebugInfo/PDB/Raw/MappedBlockStream.h&r1=276457&r2=276458&rev=276458&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/include/llvm/DebugInfo/PDB/Raw/MappedBlockStream.h
> (original)
> > +++ llvm/trunk/include/llvm/DebugInfo/Msf/MappedBlockStream.h Fri Jul 22
> 14:56:05 2016
> > @@ -1,4 +1,5 @@
> > -//===- MappedBlockStream.h - Reads stream data from a PDBFile ---*- C++
> -*-===//
> > +//===- MappedBlockStream.h - Discontiguous stream data in an Msf -*- C++
> > +//-*-===//
> > //
> > //                     The LLVM Compiler Infrastructure
> > //
> > @@ -7,14 +8,14 @@
> > //
> >
> //===----------------------------------------------------------------------===//
> >
> > -#ifndef LLVM_DEBUGINFO_PDB_RAW_MAPPEDBLOCKSTREAM_H
> > -#define LLVM_DEBUGINFO_PDB_RAW_MAPPEDBLOCKSTREAM_H
> > +#ifndef LLVM_DEBUGINFO_MSF_MAPPEDBLOCKSTREAM_H
> > +#define LLVM_DEBUGINFO_MSF_MAPPEDBLOCKSTREAM_H
> >
> > #include "llvm/ADT/ArrayRef.h"
> > #include "llvm/ADT/DenseMap.h"
> > #include "llvm/ADT/STLExtras.h"
> > -#include "llvm/DebugInfo/CodeView/StreamInterface.h"
> > -#include "llvm/DebugInfo/PDB/Raw/IPDBStreamData.h"
> > +#include "llvm/DebugInfo/Msf/IMsfStreamData.h"
> > +#include "llvm/DebugInfo/Msf/StreamInterface.h"
> > #include "llvm/Support/Allocator.h"
> > #include "llvm/Support/Endian.h"
> > #include "llvm/Support/Error.h"
> > @@ -22,12 +23,21 @@
> > #include <vector>
> >
> > namespace llvm {
> > -namespace pdb {
> > +namespace msf {
> >
> > -class IPDBFile;
> > -class PDBFile;
> > +class IMsfFile;
> >
> > -class MappedBlockStream : public codeview::StreamInterface {
> > +/// MappedBlockStream represents data stored in an Msf file into chunks
> of a
> > +/// particular size (called the Block Size), and whose chunks may not be
> > +/// necessarily contiguous.  The arrangement of these chunks within the
> file
> > +/// is described by some other metadata contained within the Msf file.
> In
> > +/// the case of a standard Msf Stream, the layout of the stream's blocks
> > +/// is described by the Msf "directory", but in the case of the
> directory
> > +/// itself, the layout is described by an array at a fixed location
> within
> > +/// the Msf.  MappedBlockStream provides methods for reading from and
> writing
> > +/// to one of these streams transparently, as if it were a contiguous
> sequence
> > +/// of bytes.
> > +class MappedBlockStream : public StreamInterface {
> > public:
> >   Error readBytes(uint32_t Offset, uint32_t Size,
> >                   ArrayRef<uint8_t> &Buffer) const override;
> > @@ -41,21 +51,22 @@ public:
> >   uint32_t getNumBytesCopied() const;
> >
> >   static Expected<std::unique_ptr<MappedBlockStream>>
> > -  createIndexedStream(uint32_t StreamIdx, const IPDBFile &File);
> > +  createIndexedStream(uint32_t StreamIdx, const IMsfFile &File);
> >   static Expected<std::unique_ptr<MappedBlockStream>>
> > -  createDirectoryStream(const PDBFile &File);
> > +  createDirectoryStream(uint32_t Length, ArrayRef<support::ulittle32_t>
> Blocks,
> > +                        const IMsfFile &File);
> >
> >   llvm::BumpPtrAllocator &getAllocator() { return Pool; }
> >
> > protected:
> > -  MappedBlockStream(std::unique_ptr<IPDBStreamData> Data, const
> IPDBFile &File);
> > +  MappedBlockStream(std::unique_ptr<IMsfStreamData> Data, const
> IMsfFile &File);
> >
> >   Error readBytes(uint32_t Offset, MutableArrayRef<uint8_t> Buffer)
> const;
> >   bool tryReadContiguously(uint32_t Offset, uint32_t Size,
> >                            ArrayRef<uint8_t> &Buffer) const;
> >
> > -  const IPDBFile &Pdb;
> > -  std::unique_ptr<IPDBStreamData> Data;
> > +  const IMsfFile &Msf;
> > +  std::unique_ptr<IMsfStreamData> Data;
> >
> >   typedef MutableArrayRef<uint8_t> CacheEntry;
> >   mutable llvm::BumpPtrAllocator Pool;
> > @@ -65,4 +76,4 @@ protected:
> > } // end namespace pdb
> > } // end namespace llvm
> >
> > -#endif // LLVM_DEBUGINFO_PDB_RAW_MAPPEDBLOCKSTREAM_H
> > +#endif // LLVM_DEBUGINFO_MSF_MAPPEDBLOCKSTREAM_H
> >
> > Copied: llvm/trunk/include/llvm/DebugInfo/Msf/MsfBuilder.h (from
> r276457, llvm/trunk/include/llvm/DebugInfo/PDB/Raw/MsfBuilder.h)
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/Msf/MsfBuilder.h?p2=llvm/trunk/include/llvm/DebugInfo/Msf/MsfBuilder.h&p1=llvm/trunk/include/llvm/DebugInfo/PDB/Raw/MsfBuilder.h&r1=276457&r2=276458&rev=276458&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/include/llvm/DebugInfo/PDB/Raw/MsfBuilder.h (original)
> > +++ llvm/trunk/include/llvm/DebugInfo/Msf/MsfBuilder.h Fri Jul 22
> 14:56:05 2016
> > @@ -7,14 +7,13 @@
> > //
> >
> //===----------------------------------------------------------------------===//
> >
> > -#ifndef LLVM_DEBUGINFO_PDB_RAW_MSFBUILDER_H
> > -#define LLVM_DEBUGINFO_PDB_RAW_MSFBUILDER_H
> > +#ifndef LLVM_DEBUGINFO_MSF_MSFBUILDER_H
> > +#define LLVM_DEBUGINFO_MSF_MSFBUILDER_H
> >
> > #include "llvm/ADT/ArrayRef.h"
> > #include "llvm/ADT/BitVector.h"
> >
> > -#include "llvm/DebugInfo/PDB/Raw/MsfCommon.h"
> > -#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
> > +#include "llvm/DebugInfo/Msf/MsfCommon.h"
> >
> > #include "llvm/Support/Allocator.h"
> > #include "llvm/Support/Endian.h"
> > @@ -24,7 +23,7 @@
> > #include <vector>
> >
> > namespace llvm {
> > -namespace pdb {
> > +namespace msf {
> > class MsfBuilder {
> > public:
> >   /// \brief Create a new `MsfBuilder`.
> > @@ -34,9 +33,9 @@ public:
> >   ///
> >   /// \param MinBlockCount Causes the builder to reserve up front space
> for
> >   /// at least `MinBlockCount` blocks.  This is useful when using
> `MsfBuilder`
> > -  /// to read an existing PDB that you want to write back out later.
> The
> > -  /// original PDB file's SuperBlock contains the exact number of
> blocks used
> > -  /// by the file, so is a good hint as to how many blocks the new PDB
> file
> > +  /// to read an existing MSF that you want to write back out later.
> The
> > +  /// original MSF file's SuperBlock contains the exact number of
> blocks used
> > +  /// by the file, so is a good hint as to how many blocks the new MSF
> file
> >   /// will contain.  Furthermore, it is actually necessary in this
> case.  To
> >   /// preserve stability of the file's layout, it is helpful to try to
> keep
> >   /// all streams mapped to their original block numbers.  To ensure
> that this
> > @@ -45,7 +44,7 @@ public:
> >   ///
> >   /// \param CanGrow If true, any operation which results in an attempt
> to
> >   /// locate a free block when all available blocks have been exhausted
> will
> > -  /// allocate a new block, thereby growing the size of the final PDB
> file.
> > +  /// allocate a new block, thereby growing the size of the final MSF
> file.
> >   /// When false, any such attempt will result in an error.  This is
> especially
> >   /// useful in testing scenarios when you know your test isn't going to
> do
> >   /// anything to increase the size of the file, so having an Error
> returned if
> > @@ -61,14 +60,14 @@ public:
> >                                      bool CanGrow = true);
> >
> >   /// Request the block map to be at a specific block address.  This is
> useful
> > -  /// when editing a PDB and you want the layout to be as stable as
> possible.
> > +  /// when editing a MSF and you want the layout to be as stable as
> possible.
> >   Error setBlockMapAddr(uint32_t Addr);
> >   Error setDirectoryBlocksHint(ArrayRef<uint32_t> DirBlocks);
> >   void setFreePageMap(uint32_t Fpm);
> >   void setUnknown1(uint32_t Unk1);
> >
> >   /// Add a stream to the MSF file with the given size, occupying the
> given
> > -  /// list of blocks.  This is useful when reading a PDB file and you
> want a
> > +  /// list of blocks.  This is useful when reading a MSF file and you
> want a
> >   /// particular stream to occupy the original set of blocks.  If the
> given
> >   /// blocks are already allocated, or if the number of blocks specified
> is
> >   /// incorrect for the given stream size, this function will return an
> Error.
> > @@ -112,7 +111,7 @@ public:
> >
> >   /// Finalize the
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160725/2a30c6f1/attachment.html>


More information about the llvm-commits mailing list