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