[llvm] r283828 - Revert r283824 and r283823: Define DbiStreamBuilder::addDbgStream to add stream.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 10 17:15:50 PDT 2016


Author: ruiu
Date: Mon Oct 10 19:15:50 2016
New Revision: 283828

URL: http://llvm.org/viewvc/llvm-project?rev=283828&view=rev
Log:
Revert r283824 and r283823: Define DbiStreamBuilder::addDbgStream to add stream.

This reverts commit r283824 and r283823 to fix buildbots.

Modified:
    llvm/trunk/include/llvm/DebugInfo/PDB/Raw/DbiStreamBuilder.h
    llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBFileBuilder.h
    llvm/trunk/lib/DebugInfo/PDB/Raw/DbiStreamBuilder.cpp

Modified: llvm/trunk/include/llvm/DebugInfo/PDB/Raw/DbiStreamBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Raw/DbiStreamBuilder.h?rev=283828&r1=283827&r2=283828&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Raw/DbiStreamBuilder.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Raw/DbiStreamBuilder.h Mon Oct 10 19:15:50 2016
@@ -19,7 +19,6 @@
 #include "llvm/DebugInfo/PDB/PDBTypes.h"
 #include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
 #include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
-#include "llvm/Support/Endian.h"
 
 namespace llvm {
 namespace msf {
@@ -45,9 +44,6 @@ public:
   void setFlags(uint16_t F);
   void setMachineType(PDB_Machine M);
 
-  // Add given bytes as a new stream.
-  Error addDbgStream(pdb::DbgHeaderType Type, ArrayRef<uint8_t> Data);
-
   uint32_t calculateSerializedLength() const;
 
   Error addModuleInfo(StringRef ObjFile, StringRef Module);
@@ -61,11 +57,6 @@ public:
                const msf::WritableStream &Buffer);
 
 private:
-  struct DebugStream {
-    ArrayRef<uint8_t> Data;
-    uint16_t StreamNumber = kInvalidStreamIndex;
-  };
-
   Error finalize();
   uint32_t calculateModiSubstreamSize() const;
   uint32_t calculateFileInfoSubstreamSize() const;
@@ -101,8 +92,6 @@ private:
   msf::WritableStreamRef NamesBuffer;
   msf::MutableByteStream ModInfoBuffer;
   msf::MutableByteStream FileInfoBuffer;
-  llvm::SmallVector<DebugStream, (int)DbgHeaderType::Max> DbgStreams{
-      (int)DbgHeaderType::Max};
 };
 }
 }

Modified: llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBFileBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBFileBuilder.h?rev=283828&r1=283827&r2=283828&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBFileBuilder.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBFileBuilder.h Mon Oct 10 19:15:50 2016
@@ -14,7 +14,6 @@
 #include "llvm/ADT/BitVector.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
-#include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
 #include "llvm/Support/Allocator.h"
 #include "llvm/Support/Endian.h"
 #include "llvm/Support/Error.h"

Modified: llvm/trunk/lib/DebugInfo/PDB/Raw/DbiStreamBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Raw/DbiStreamBuilder.cpp?rev=283828&r1=283827&r2=283828&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Raw/DbiStreamBuilder.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Raw/DbiStreamBuilder.cpp Mon Oct 10 19:15:50 2016
@@ -9,7 +9,6 @@
 
 #include "llvm/DebugInfo/PDB/Raw/DbiStreamBuilder.h"
 
-#include "llvm/ADT/ArrayRef.h"
 #include "llvm/DebugInfo/MSF/MSFBuilder.h"
 #include "llvm/DebugInfo/MSF/MappedBlockStream.h"
 #include "llvm/DebugInfo/MSF/StreamWriter.h"
@@ -44,24 +43,10 @@ void DbiStreamBuilder::setFlags(uint16_t
 
 void DbiStreamBuilder::setMachineType(PDB_Machine M) { MachineType = M; }
 
-Error DbiStreamBuilder::addDbgStream(pdb::DbgHeaderType Type,
-                                     ArrayRef<uint8_t> Data) {
-  if (DbgStreams[(int)Type].StreamNumber != kInvalidStreamIndex)
-    return make_error<RawError>(raw_error_code::duplicate_entry,
-                                "The specified stream type already exists");
-  auto ExpectedIndex = Msf.addStream(Data.size());
-  if (!ExpectedIndex)
-    return ExpectedIndex.takeError();
-  uint32_t Index = std::move(*ExpectedIndex);
-  DbgStreams[(int)Type].Data = Data;
-  DbgStreams[(int)Type].StreamNumber = Index;
-  return Error::success();
-}
-
 uint32_t DbiStreamBuilder::calculateSerializedLength() const {
   // For now we only support serializing the header.
   return sizeof(DbiStreamHeader) + calculateFileInfoSubstreamSize() +
-         calculateModiSubstreamSize() + DbgStreams.size() * sizeof(uint16_t);
+         calculateModiSubstreamSize();
 }
 
 Error DbiStreamBuilder::addModuleInfo(StringRef ObjFile, StringRef Module) {
@@ -231,7 +216,7 @@ Error DbiStreamBuilder::finalize() {
   H->ECSubstreamSize = 0;
   H->FileInfoSize = FileInfoBuffer.getLength();
   H->ModiSubstreamSize = ModInfoBuffer.getLength();
-  H->OptionalDbgHdrSize = DbgStreams.size() * sizeof(uint16_t);
+  H->OptionalDbgHdrSize = 0;
   H->SecContrSubstreamSize = 0;
   H->SectionMapSize = 0;
   H->TypeServerSize = 0;
@@ -288,19 +273,6 @@ Error DbiStreamBuilder::commit(const msf
     return EC;
   if (auto EC = Writer.writeStreamRef(FileInfoBuffer))
     return EC;
-  for (auto &Stream : DbgStreams)
-    if (auto EC = Writer.writeInteger(Stream.StreamNumber))
-      return EC;
-
-  for (auto &Stream : DbgStreams) {
-    if (Stream.StreamNumber == kInvalidStreamIndex)
-      continue;
-    auto WritableStream = WritableMappedBlockStream::createIndexedStream(
-        Layout, Buffer, Stream.StreamNumber);
-    StreamWriter DbgStreamWriter(*WritableStream);
-    if (auto EC = DbgStreamWriter.writeArray(Stream.Data))
-      return EC;
-  }
 
   if (Writer.bytesRemaining() > 0)
     return make_error<RawError>(raw_error_code::invalid_format,




More information about the llvm-commits mailing list