[lld] r296415 - [PDB] Make streams carry their own endianness.

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 27 16:04:08 PST 2017


Author: zturner
Date: Mon Feb 27 18:04:07 2017
New Revision: 296415

URL: http://llvm.org/viewvc/llvm-project?rev=296415&view=rev
Log:
[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.

Modified:
    lld/trunk/COFF/PDB.cpp

Modified: lld/trunk/COFF/PDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/PDB.cpp?rev=296415&r1=296414&r2=296415&view=diff
==============================================================================
--- lld/trunk/COFF/PDB.cpp (original)
+++ lld/trunk/COFF/PDB.cpp Mon Feb 27 18:04:07 2017
@@ -93,7 +93,7 @@ static std::vector<uint8_t> mergeDebugT(
     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 @@ static void dumpDebugS(ScopedPrinter &W,
   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 dumpCodeView(SymbolTable *Sy
 
 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()))




More information about the llvm-commits mailing list