diff options
author | Frederic Riss <friss@apple.com> | 2015-05-29 17:56:28 +0000 |
---|---|---|
committer | Frederic Riss <friss@apple.com> | 2015-05-29 17:56:28 +0000 |
commit | 4939e6a1b835124a23fb20e001ee0393a810cf54 (patch) | |
tree | f0bfa52867d6009babfc0c20e75511bd5ddffaa0 /llvm/docs/YamlIO.rst | |
parent | 14672508b10df6492678d525f3768fdf90572cf1 (diff) | |
download | bcm5719-llvm-4939e6a1b835124a23fb20e001ee0393a810cf54.tar.gz bcm5719-llvm-4939e6a1b835124a23fb20e001ee0393a810cf54.zip |
[YAMLIO] Make line-wrapping configurable and test it.
Summary:
We would wrap flow mappings and sequences when they go over a hardcoded 70
characters limit. Make the wrapping column configurable (and default to 70
co the change should be NFC for current users). Passing 0 allows to completely
suppress the wrapping which makes it easier to handle in tools like FileCheck.
Reviewers: bogner
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D10109
llvm-svn: 238584
Diffstat (limited to 'llvm/docs/YamlIO.rst')
-rw-r--r-- | llvm/docs/YamlIO.rst | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/llvm/docs/YamlIO.rst b/llvm/docs/YamlIO.rst index aa4bae35d1a..f0baeb4c69d 100644 --- a/llvm/docs/YamlIO.rst +++ b/llvm/docs/YamlIO.rst @@ -798,6 +798,8 @@ add "static const bool flow = true;". For instance: static const bool flow = true; } +Flow mappings are subject to line wrapping according to the Output object +configuration. Sequence ======== @@ -845,6 +847,8 @@ With the above, if you used MyList as the data type in your native data structures, then when converted to YAML, a flow sequence of integers will be used (e.g. [ 10, -3, 4 ]). +Flow sequences are subject to line wrapping according to the Output object +configuration. Utility Macros -------------- @@ -908,14 +912,14 @@ Output The llvm::yaml::Output class is used to generate a YAML document from your in-memory data structures, using traits defined on your data types. -To instantiate an Output object you need an llvm::raw_ostream, and optionally -a context pointer: +To instantiate an Output object you need an llvm::raw_ostream, an optional +context pointer and an optional wrapping column: .. code-block:: c++ class Output : public IO { public: - Output(llvm::raw_ostream &, void *context=NULL); + Output(llvm::raw_ostream &, void *context = NULL, int WrapColumn = 70); Once you have an Output object, you can use the C++ stream operator on it to write your native data as YAML. One thing to recall is that a YAML file @@ -924,6 +928,10 @@ streaming as YAML is a mapping, scalar, or sequence, then Output assumes you are generating one document and wraps the mapping output with "``---``" and trailing "``...``". +The WrapColumn parameter will cause the flow mappings and sequences to +line-wrap when they go over the supplied column. Pass 0 to completely +suppress the wrapping. + .. code-block:: c++ using llvm::yaml::Output; |