summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2016-07-12 15:45:53 +0000
committerDaniel Jasper <djasper@google.com>2016-07-12 15:45:53 +0000
commitd9d8da2821c11654de4f7c1ea33e51c5f68e37c7 (patch)
treedd46c513dc55280be3e4fde1d59334377d48e3f3 /clang/lib/Format
parent9880bfda07f946e76b892bec298c295a71033417 (diff)
downloadbcm5719-llvm-d9d8da2821c11654de4f7c1ea33e51c5f68e37c7.tar.gz
bcm5719-llvm-d9d8da2821c11654de4f7c1ea33e51c5f68e37c7.zip
clang-format: [JS] Allow top-level conditionals again.
I am not sure exactly which test breakage Martin was trying to fix in r273694. For now, fix the behavior for top-level conditionals, which (surprisingly) are actually used somewhat commonly. llvm-svn: 275183
Diffstat (limited to 'clang/lib/Format')
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index db8a3d62441..4a90522e6e3 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -639,7 +639,7 @@ private:
}
// Declarations cannot be conditional expressions, this can only be part
// of a type declaration.
- if (!Contexts.back().IsExpression &&
+ if (Line.MustBeDeclaration && !Contexts.back().IsExpression &&
Style.Language == FormatStyle::LK_JavaScript)
break;
parseConditional();
OpenPOWER on IntegriCloud