[PDB] Make streams carry their own endianness.

Before the endianness was specified on each call to read
or write of the StreamReader / StreamWriter, but in practice
it's extremely rare for streams to have data encoded in
multiple different endiannesses, so we should optimize for the
99% use case.

This makes the code cleaner and more general, but otherwise
has NFC.

llvm-svn: 296415
diff --git a/lld/COFF/PDB.cpp b/lld/COFF/PDB.cpp
index 8cb4a60..7a60be9 100644
--- a/lld/COFF/PDB.cpp
+++ b/lld/COFF/PDB.cpp
@@ -93,7 +93,7 @@
     if (Data.empty())
       continue;
 
-    BinaryByteStream Stream(Data);
+    BinaryByteStream Stream(Data, llvm::support::little);
     codeview::CVTypeArray Types;
     BinaryStreamReader Reader(Stream);
     // Follow type servers.  If the same type server is encountered more than
@@ -137,7 +137,7 @@
   if (Data.empty())
     return;
 
-  BinaryByteStream Stream(Data);
+  BinaryByteStream Stream(Data, llvm::support::little);
   CVSymbolArray Symbols;
   BinaryStreamReader Reader(Stream);
   if (auto EC = Reader.readArray(Symbols, Reader.getLength()))
@@ -161,7 +161,7 @@
 
 static void addTypeInfo(pdb::TpiStreamBuilder &TpiBuilder,
                         ArrayRef<uint8_t> Data) {
-  BinaryByteStream Stream(Data);
+  BinaryByteStream Stream(Data, llvm::support::little);
   codeview::CVTypeArray Records;
   BinaryStreamReader Reader(Stream);
   if (auto EC = Reader.readArray(Records, Reader.getLength()))