diff options
author | Nico Weber <nicolasweber@gmx.de> | 2017-01-04 02:33:36 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2017-01-04 02:33:36 +0000 |
commit | ea64969763a5a9f9c6e381e3494e2b7b16ae82b1 (patch) | |
tree | 7f46fac60f365ca050cf9c72696eb3222520aeaf /clang/lib/Format/Format.cpp | |
parent | b5e365c97085151da980e806afca0deee64b0579 (diff) | |
download | bcm5719-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.cpp | 3 |
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; |