aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSean Silva <silvas@purdue.edu>2013-06-06 00:47:12 +0000
committerSean Silva <silvas@purdue.edu>2013-06-06 00:47:12 +0000
commit272d881234dac8d51bccf90d52550ee4da888c94 (patch)
tree54d4ef1095dc6394d56584c21b0f32124fd5f5a1 /include
parent6a2e7ac0b6647a409394e58b385e579ea62b5cba (diff)
downloadexternal_llvm-272d881234dac8d51bccf90d52550ee4da888c94.zip
external_llvm-272d881234dac8d51bccf90d52550ee4da888c94.tar.gz
external_llvm-272d881234dac8d51bccf90d52550ee4da888c94.tar.bz2
Add some class documentation to BinaryRef.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183362 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Object/YAML.h42
1 files changed, 40 insertions, 2 deletions
diff --git a/include/llvm/Object/YAML.h b/include/llvm/Object/YAML.h
index 44af45c..89cbe42 100644
--- a/include/llvm/Object/YAML.h
+++ b/include/llvm/Object/YAML.h
@@ -21,8 +21,46 @@ namespace llvm {
namespace object {
namespace yaml {
-/// In an object file this is just a binary blob. In an yaml file it is an hex
-/// string. Using this avoid having to allocate temporary strings.
+/// \brief Specialized YAMLIO scalar type for representing a binary blob.
+///
+/// A typical use case would be to represent the content of a section in a
+/// binary file.
+/// This class has custom YAMLIO traits for convenient reading and writing.
+/// It renders as a string of hex digits in a YAML file.
+/// For example, it might render as `DEADBEEFCAFEBABE` (YAML does not
+/// require the quotation marks, so for simplicity when outputting they are
+/// omitted).
+/// When reading, any string whose content is an even number of hex digits
+/// will be accepted.
+/// For example, all of the following are acceptable:
+/// `DEADBEEF`, `"DeADbEeF"`, `"\x44EADBEEF"` (Note: '\x44' == 'D')
+///
+/// A significant advantage of using this class is that it never allocates
+/// temporary strings or buffers for any of its functionality.
+///
+/// Example:
+///
+/// The YAML mapping:
+/// \code
+/// Foo: DEADBEEFCAFEBABE
+/// \endcode
+///
+/// Could be modeled in YAMLIO by the struct:
+/// \code
+/// struct FooHolder {
+/// BinaryRef Foo;
+/// };
+/// namespace llvm {
+/// namespace yaml {
+/// template <>
+/// struct MappingTraits<FooHolder> {
+/// static void mapping(IO &IO, FooHolder &FH) {
+/// IO.mapRequired("Foo", FH.Foo);
+/// }
+/// };
+/// } // end namespace yaml
+/// } // end namespace llvm
+/// \endcode
class BinaryRef {
/// \brief Either raw binary data, or a string of hex bytes (must always
/// be an even number of characters).