summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/Format.cpp
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2017-01-04 02:33:36 +0000
committerNico Weber <nicolasweber@gmx.de>2017-01-04 02:33:36 +0000
commitea64969763a5a9f9c6e381e3494e2b7b16ae82b1 (patch)
tree7f46fac60f365ca050cf9c72696eb3222520aeaf /clang/lib/Format/Format.cpp
parentb5e365c97085151da980e806afca0deee64b0579 (diff)
downloadbcm5719-llvm-ea64969763a5a9f9c6e381e3494e2b7b16ae82b1.tar.gz
bcm5719-llvm-ea64969763a5a9f9c6e381e3494e2b7b16ae82b1.zip
Change clang-format's Chromium JavaScript defaults
Chromium is starting to use clang-format on more JavaScript. In doing this, we discovered that our defaults were not doing a good job differentiating between JS and C++. This change moves some defaults to only apply to C++. https://reviews.llvm.org/D28165 Patch from Dan Beam <dbeam@chromium.org>! llvm-svn: 290930
Diffstat (limited to 'clang/lib/Format/Format.cpp')
-rw-r--r--clang/lib/Format/Format.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 70b90d6fa14..389761d4824 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -638,6 +638,9 @@ FormatStyle getChromiumStyle(FormatStyle::LanguageKind Language) {
ChromiumStyle.BreakAfterJavaFieldAnnotations = true;
ChromiumStyle.ContinuationIndentWidth = 8;
ChromiumStyle.IndentWidth = 4;
+ } else if (Language == FormatStyle::LK_JavaScript) {
+ ChromiumStyle.AllowShortIfStatementsOnASingleLine = false;
+ ChromiumStyle.AllowShortLoopsOnASingleLine = false;
} else {
ChromiumStyle.AllowAllParametersOfDeclarationOnNextLine = false;
ChromiumStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Inline;
OpenPOWER on IntegriCloud