summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSean Silva <silvas@purdue.edu>2013-06-05 23:32:31 +0000
committerSean Silva <silvas@purdue.edu>2013-06-05 23:32:31 +0000
commit6acc982e74cd8a10d097c10254d7215028e7f036 (patch)
treef4c4bcfae8c9be135ac29818adc7e35ad5b8f89c /include
parent63958fba58716ed435563321944f7d4663d2ee2d (diff)
downloadllvm-6acc982e74cd8a10d097c10254d7215028e7f036.tar.gz
llvm-6acc982e74cd8a10d097c10254d7215028e7f036.tar.bz2
llvm-6acc982e74cd8a10d097c10254d7215028e7f036.tar.xz
Rename BinaryRef::isBinary to more descriptive DataIsHexString.
And add a doxygen comment. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183350 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Object/YAML.h17
1 files changed, 9 insertions, 8 deletions
diff --git a/include/llvm/Object/YAML.h b/include/llvm/Object/YAML.h
index 92811b04eb..41fe952456 100644
--- a/include/llvm/Object/YAML.h
+++ b/include/llvm/Object/YAML.h
@@ -27,26 +27,27 @@ class BinaryRef {
/// \brief Either raw binary data, or a string of hex bytes (must always
/// be an even number of characters).
ArrayRef<uint8_t> Data;
- bool isBinary;
+ /// \brief Discriminator between the two states of the `Data` member.
+ bool DataIsHexString;
public:
- BinaryRef(ArrayRef<uint8_t> Data) : Data(Data), isBinary(true) {}
+ BinaryRef(ArrayRef<uint8_t> Data) : Data(Data), DataIsHexString(false) {}
BinaryRef(StringRef Data)
: Data(reinterpret_cast<const uint8_t *>(Data.data()), Data.size()),
- isBinary(false) {}
- BinaryRef() : isBinary(false) {}
+ DataIsHexString(true) {}
+ BinaryRef() : DataIsHexString(true) {}
StringRef getHex() const {
- assert(!isBinary);
+ assert(DataIsHexString);
return StringRef(reinterpret_cast<const char *>(Data.data()), Data.size());
}
ArrayRef<uint8_t> getBinary() const {
- assert(isBinary);
+ assert(!DataIsHexString);
return Data;
}
/// \brief The number of bytes that are represented by this BinaryRef.
/// This is the number of bytes that writeAsBinary() will write.
ArrayRef<uint8_t>::size_type binary_size() const {
- if (!isBinary)
+ if (DataIsHexString)
return Data.size() / 2;
return Data.size();
}
@@ -55,7 +56,7 @@ public:
if (Ref.Data.empty() && Data.empty())
return true;
- return Ref.isBinary == isBinary && Ref.Data == Data;
+ return Ref.DataIsHexString == DataIsHexString && Ref.Data == Data;
}
/// \brief Write the contents (regardless of whether it is binary or a
/// hex string) as binary to the given raw_ostream.