summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-02-18 01:35:33 +0000
committerZachary Turner <zturner@google.com>2017-02-18 01:35:33 +0000
commit181fe17b6f0f434d39b32b90b12844f7a9b55a3b (patch)
treea9c68cad05c7c6c643e75369b57019c314dce048 /llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp
parent0aef305f352235fe66d44e8f253b3b09d27a1b10 (diff)
downloadbcm5719-llvm-181fe17b6f0f434d39b32b90b12844f7a9b55a3b.tar.gz
bcm5719-llvm-181fe17b6f0f434d39b32b90b12844f7a9b55a3b.zip
Don't assume little endian in StreamReader / StreamWriter.
In an effort to generalize this so it can be used by more than just PDB code, we shouldn't assume little endian. llvm-svn: 295525
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp')
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp b/llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp
index df6e9b060df..0b56d05b468 100644
--- a/llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp
@@ -187,17 +187,21 @@ Error DbiStreamBuilder::generateFileInfoSubstream() {
uint16_t ModiCount = std::min<uint32_t>(UINT16_MAX, ModuleInfos.size());
uint16_t FileCount = std::min<uint32_t>(UINT16_MAX, SourceFileNames.size());
- if (auto EC = MetadataWriter.writeInteger(ModiCount)) // NumModules
+ if (auto EC = MetadataWriter.writeInteger(
+ ModiCount, llvm::support::little)) // NumModules
return EC;
- if (auto EC = MetadataWriter.writeInteger(FileCount)) // NumSourceFiles
+ if (auto EC = MetadataWriter.writeInteger(
+ FileCount, llvm::support::little)) // NumSourceFiles
return EC;
for (uint16_t I = 0; I < ModiCount; ++I) {
- if (auto EC = MetadataWriter.writeInteger(I)) // Mod Indices
+ if (auto EC = MetadataWriter.writeInteger(
+ I, llvm::support::little)) // Mod Indices
return EC;
}
for (const auto MI : ModuleInfoList) {
FileCount = static_cast<uint16_t>(MI->SourceFiles.size());
- if (auto EC = MetadataWriter.writeInteger(FileCount)) // Mod File Counts
+ if (auto EC = MetadataWriter.writeInteger(
+ FileCount, llvm::support::little)) // Mod File Counts
return EC;
}
@@ -219,7 +223,8 @@ Error DbiStreamBuilder::generateFileInfoSubstream() {
if (Result == SourceFileNames.end())
return make_error<RawError>(raw_error_code::no_entry,
"The source file was not found.");
- if (auto EC = MetadataWriter.writeInteger(Result->second))
+ if (auto EC = MetadataWriter.writeInteger(Result->second,
+ llvm::support::little))
return EC;
}
}
@@ -373,7 +378,7 @@ Error DbiStreamBuilder::commit(const msf::MSFLayout &Layout,
return EC;
if (!SectionContribs.empty()) {
- if (auto EC = Writer.writeEnum(DbiSecContribVer60))
+ if (auto EC = Writer.writeEnum(DbiSecContribVer60, llvm::support::little))
return EC;
if (auto EC = Writer.writeArray(SectionContribs))
return EC;
@@ -392,7 +397,8 @@ Error DbiStreamBuilder::commit(const msf::MSFLayout &Layout,
return EC;
for (auto &Stream : DbgStreams)
- if (auto EC = Writer.writeInteger(Stream.StreamNumber))
+ if (auto EC =
+ Writer.writeInteger(Stream.StreamNumber, llvm::support::little))
return EC;
for (auto &Stream : DbgStreams) {
OpenPOWER on IntegriCloud