summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/YAMLTraits.cpp
diff options
context:
space:
mode:
authorFrederic Riss <friss@apple.com>2015-05-29 17:56:28 +0000
committerFrederic Riss <friss@apple.com>2015-05-29 17:56:28 +0000
commit4939e6a1b835124a23fb20e001ee0393a810cf54 (patch)
treef0bfa52867d6009babfc0c20e75511bd5ddffaa0 /llvm/lib/Support/YAMLTraits.cpp
parent14672508b10df6492678d525f3768fdf90572cf1 (diff)
downloadbcm5719-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/lib/Support/YAMLTraits.cpp')
-rw-r--r--llvm/lib/Support/YAMLTraits.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Support/YAMLTraits.cpp b/llvm/lib/Support/YAMLTraits.cpp
index 0d47f37edbd..6b59a16514b 100644
--- a/llvm/lib/Support/YAMLTraits.cpp
+++ b/llvm/lib/Support/YAMLTraits.cpp
@@ -404,9 +404,10 @@ bool Input::canElideEmptySequence() {
// Output
//===----------------------------------------------------------------------===//
-Output::Output(raw_ostream &yout, void *context)
+Output::Output(raw_ostream &yout, void *context, int WrapColumn)
: IO(context),
Out(yout),
+ WrapColumn(WrapColumn),
Column(0),
ColumnAtFlowStart(0),
ColumnAtMapFlowStart(0),
@@ -529,7 +530,7 @@ void Output::endFlowSequence() {
bool Output::preflightFlowElement(unsigned, void *&) {
if (NeedFlowSequenceComma)
output(", ");
- if (Column > 70) {
+ if (WrapColumn && Column > WrapColumn) {
output("\n");
for (int i = 0; i < ColumnAtFlowStart; ++i)
output(" ");
@@ -720,7 +721,7 @@ void Output::paddedKey(StringRef key) {
void Output::flowKey(StringRef Key) {
if (StateStack.back() == inFlowMapOtherKey)
output(", ");
- if (Column > 70) {
+ if (WrapColumn && Column > WrapColumn) {
output("\n");
for (int I = 0; I < ColumnAtMapFlowStart; ++I)
output(" ");
OpenPOWER on IntegriCloud