From 2b6b257f4e5503a7a2675bdb8735693db769f75c Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 23 Jul 2016 20:44:14 +0000 Subject: Vendor import of clang release_39 branch r276489: https://llvm.org/svn/llvm-project/cfe/branches/release_39@276489 --- lib/Format/UnwrappedLineFormatter.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib/Format/UnwrappedLineFormatter.cpp') diff --git a/lib/Format/UnwrappedLineFormatter.cpp b/lib/Format/UnwrappedLineFormatter.cpp index f65056907963e..35035ea8afba1 100644 --- a/lib/Format/UnwrappedLineFormatter.cpp +++ b/lib/Format/UnwrappedLineFormatter.cpp @@ -847,7 +847,9 @@ UnwrappedLineFormatter::format(const SmallVectorImpl &Lines, unsigned ColumnLimit = getColumnLimit(TheLine.InPPDirective, NextLine); bool FitsIntoOneLine = TheLine.Last->TotalLength + Indent <= ColumnLimit || - TheLine.Type == LT_ImportStatement; + (TheLine.Type == LT_ImportStatement && + (Style.Language != FormatStyle::LK_JavaScript || + !Style.JavaScriptWrapImports)); if (Style.ColumnLimit == 0) NoColumnLimitLineFormatter(Indenter, Whitespaces, Style, this) @@ -863,7 +865,9 @@ UnwrappedLineFormatter::format(const SmallVectorImpl &Lines, // If no token in the current line is affected, we still need to format // affected children. if (TheLine.ChildrenAffected) - format(TheLine.Children, DryRun); + for (const FormatToken *Tok = TheLine.First; Tok; Tok = Tok->Next) + if (!Tok->Children.empty()) + format(Tok->Children, DryRun); // Adapt following lines on the current indent level to the same level // unless the current \c AnnotatedLine is not at the beginning of a line. -- cgit v1.2.3