summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-02-28 00:04:07 +0000
committerZachary Turner <zturner@google.com>2017-02-28 00:04:07 +0000
commit695ed56ba5d3bd3b86c6a4ed6d79b89eb8fbd2f4 (patch)
treecaf35bd7345bb071545ef39b636b40ffafc41504 /llvm/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp
parent59cd89332010b22e82c3110d558ff37948c4df1e (diff)
downloadbcm5719-llvm-695ed56ba5d3bd3b86c6a4ed6d79b89eb8fbd2f4.tar.gz
bcm5719-llvm-695ed56ba5d3bd3b86c6a4ed6d79b89eb8fbd2f4.zip
[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
Diffstat (limited to 'llvm/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp')
-rw-r--r--llvm/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp44
1 files changed, 18 insertions, 26 deletions
diff --git a/llvm/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp b/llvm/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp
index 3b10f8ff120..a204d43ba13 100644
--- a/llvm/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp
+++ b/llvm/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp
@@ -87,14 +87,13 @@ Error CodeViewRecordIO::mapByteVectorTail(std::vector<uint8_t> &Bytes) {
Error CodeViewRecordIO::mapInteger(TypeIndex &TypeInd) {
if (isWriting()) {
- if (auto EC =
- Writer->writeInteger(TypeInd.getIndex(), llvm::support::little))
+ if (auto EC = Writer->writeInteger(TypeInd.getIndex()))
return EC;
return Error::success();
}
uint32_t I;
- if (auto EC = Reader->readInteger(I, llvm::support::little))
+ if (auto EC = Reader->readInteger(I))
return EC;
TypeInd.setIndex(I);
return Error::success();
@@ -177,7 +176,7 @@ Error CodeViewRecordIO::mapStringZVectorZ(std::vector<StringRef> &Value) {
if (auto EC = mapStringZ(V))
return EC;
}
- if (auto EC = Writer->writeInteger<uint8_t>(0, llvm::support::little))
+ if (auto EC = Writer->writeInteger<uint8_t>(0))
return EC;
} else {
StringRef S;
@@ -195,28 +194,24 @@ Error CodeViewRecordIO::mapStringZVectorZ(std::vector<StringRef> &Value) {
Error CodeViewRecordIO::writeEncodedSignedInteger(const int64_t &Value) {
assert(Value < 0 && "Encoded integer is not signed!");
if (Value >= std::numeric_limits<int8_t>::min()) {
- if (auto EC =
- Writer->writeInteger<uint16_t>(LF_CHAR, llvm::support::little))
+ if (auto EC = Writer->writeInteger<uint16_t>(LF_CHAR))
return EC;
- if (auto EC = Writer->writeInteger<int8_t>(Value, llvm::support::little))
+ if (auto EC = Writer->writeInteger<int8_t>(Value))
return EC;
} else if (Value >= std::numeric_limits<int16_t>::min()) {
- if (auto EC =
- Writer->writeInteger<uint16_t>(LF_SHORT, llvm::support::little))
+ if (auto EC = Writer->writeInteger<uint16_t>(LF_SHORT))
return EC;
- if (auto EC = Writer->writeInteger<int16_t>(Value, llvm::support::little))
+ if (auto EC = Writer->writeInteger<int16_t>(Value))
return EC;
} else if (Value >= std::numeric_limits<int32_t>::min()) {
- if (auto EC =
- Writer->writeInteger<uint16_t>(LF_LONG, llvm::support::little))
+ if (auto EC = Writer->writeInteger<uint16_t>(LF_LONG))
return EC;
- if (auto EC = Writer->writeInteger<int32_t>(Value, llvm::support::little))
+ if (auto EC = Writer->writeInteger<int32_t>(Value))
return EC;
} else {
- if (auto EC =
- Writer->writeInteger<uint16_t>(LF_QUADWORD, llvm::support::little))
+ if (auto EC = Writer->writeInteger<uint16_t>(LF_QUADWORD))
return EC;
- if (auto EC = Writer->writeInteger(Value, llvm::support::little))
+ if (auto EC = Writer->writeInteger(Value))
return EC;
}
return Error::success();
@@ -224,25 +219,22 @@ Error CodeViewRecordIO::writeEncodedSignedInteger(const int64_t &Value) {
Error CodeViewRecordIO::writeEncodedUnsignedInteger(const uint64_t &Value) {
if (Value < LF_NUMERIC) {
- if (auto EC = Writer->writeInteger<uint16_t>(Value, llvm::support::little))
+ if (auto EC = Writer->writeInteger<uint16_t>(Value))
return EC;
} else if (Value <= std::numeric_limits<uint16_t>::max()) {
- if (auto EC =
- Writer->writeInteger<uint16_t>(LF_USHORT, llvm::support::little))
+ if (auto EC = Writer->writeInteger<uint16_t>(LF_USHORT))
return EC;
- if (auto EC = Writer->writeInteger<uint16_t>(Value, llvm::support::little))
+ if (auto EC = Writer->writeInteger<uint16_t>(Value))
return EC;
} else if (Value <= std::numeric_limits<uint32_t>::max()) {
- if (auto EC =
- Writer->writeInteger<uint16_t>(LF_ULONG, llvm::support::little))
+ if (auto EC = Writer->writeInteger<uint16_t>(LF_ULONG))
return EC;
- if (auto EC = Writer->writeInteger<uint32_t>(Value, llvm::support::little))
+ if (auto EC = Writer->writeInteger<uint32_t>(Value))
return EC;
} else {
- if (auto EC =
- Writer->writeInteger<uint16_t>(LF_UQUADWORD, llvm::support::little))
+ if (auto EC = Writer->writeInteger<uint16_t>(LF_UQUADWORD))
return EC;
- if (auto EC = Writer->writeInteger(Value, llvm::support::little))
+ if (auto EC = Writer->writeInteger(Value))
return EC;
}
OpenPOWER on IntegriCloud