summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/UnwrappedLineParser.cpp
diff options
context:
space:
mode:
authorMartin Probst <martin@probst.io>2017-01-16 09:52:40 +0000
committerMartin Probst <martin@probst.io>2017-01-16 09:52:40 +0000
commite6b5b34f6ff0c7021b13daf6d3c052f5de70aa93 (patch)
tree7b76a88ac753d957f63944d445b8d716c80cb5c1 /clang/lib/Format/UnwrappedLineParser.cpp
parent85867727fa904b9590f52e05cc1cec344005b9a7 (diff)
downloadbcm5719-llvm-e6b5b34f6ff0c7021b13daf6d3c052f5de70aa93.tar.gz
bcm5719-llvm-e6b5b34f6ff0c7021b13daf6d3c052f5de70aa93.zip
clang-format: [JS] revert over-eager ASI check.
Summary: Change r291428 introduced ASI detection after closing curly braces. That would generally be correct, however this breaks indentation for structural statements. What happens is that CompoundStatementIndenter increases indentation for the current line, then after reading ASI creates a new line (with the increased line level), and only after the structural parser sees e.g. the if/then/else branch closed, line level is reduced. That leads to the new line started by ASI having a level too high. Reviewers: djasper Subscribers: sammccall, cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D28763 llvm-svn: 292099
Diffstat (limited to 'clang/lib/Format/UnwrappedLineParser.cpp')
-rw-r--r--clang/lib/Format/UnwrappedLineParser.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index 8fc3b78aee0..1dcb866a16b 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -746,8 +746,7 @@ void UnwrappedLineParser::readTokenWithJavaScriptASI() {
Previous->isOneOf(tok::r_square, tok::r_paren, tok::plusplus,
tok::minusminus)))
return addUnwrappedLine();
- if ((PreviousMustBeValue || Previous->is(tok::r_brace)) &&
- isJSDeclOrStmt(Keywords, Next))
+ if (PreviousMustBeValue && isJSDeclOrStmt(Keywords, Next))
return addUnwrappedLine();
}
OpenPOWER on IntegriCloud