diff options
| author | Alex Lorenz <arphaman@gmail.com> | 2015-05-04 20:11:40 +0000 |
|---|---|---|
| committer | Alex Lorenz <arphaman@gmail.com> | 2015-05-04 20:11:40 +0000 |
| commit | b1225085012ad7fc8f45c3683a6220868273c284 (patch) | |
| tree | a84b6034ebcbfd2fe713963e26fcb559f42f1829 /llvm/docs | |
| parent | d71a17710beaa2c95aeaf51f264c7436a69a4b35 (diff) | |
| download | bcm5719-llvm-b1225085012ad7fc8f45c3683a6220868273c284.tar.gz bcm5719-llvm-b1225085012ad7fc8f45c3683a6220868273c284.zip | |
YAML: Add an optional 'flow' field to the mapping trait to allow flow mapping output.
This patch adds an optional 'flow' field to the MappingTrait
class so that yaml IO will be able to output flow mappings.
Reviewers: Justin Bogner
Differential Revision: http://reviews.llvm.org/D9450
llvm-svn: 236456
Diffstat (limited to 'llvm/docs')
| -rw-r--r-- | llvm/docs/YamlIO.rst | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/llvm/docs/YamlIO.rst b/llvm/docs/YamlIO.rst index 8b45b6bb85b..ab8b19ac2a5 100644 --- a/llvm/docs/YamlIO.rst +++ b/llvm/docs/YamlIO.rst @@ -723,6 +723,31 @@ because it is a programming error to have invalid struct values. } }; +Flow Mapping +------------ +A YAML "flow mapping" is a mapping that uses the inline notation +(e.g { x: 1, y: 0 } ) when written to YAML. To specify that a type should be +written in YAML using flow mapping, your MappingTraits specialization should +add "static const bool flow = true;". For instance: + +.. code-block:: c++ + + using llvm::yaml::MappingTraits; + using llvm::yaml::IO; + + struct Stuff { + ... + }; + + template <> + struct MappingTraits<Stuff> { + static void mapping(IO &io, Stuff &stuff) { + ... + } + + static const bool flow = true; + } + Sequence ======== |

