diff options
| author | Nico Weber <nicolasweber@gmx.de> | 2017-09-25 22:42:49 +0000 |
|---|---|---|
| committer | Nico Weber <nicolasweber@gmx.de> | 2017-09-25 22:42:49 +0000 |
| commit | e8eba3716c00d92ae772426ee4e9412f92e5562c (patch) | |
| tree | 1dd13faed8dbe8df12e411eead8af0538e2af695 /clang | |
| parent | 2eccdab308a33c802ea34873cf49dcab4e38cec6 (diff) | |
| download | bcm5719-llvm-e8eba3716c00d92ae772426ee4e9412f92e5562c.tar.gz bcm5719-llvm-e8eba3716c00d92ae772426ee4e9412f92e5562c.zip | |
clang-format/java: Always put space after `assert` keyword.
Previously, it was missing if the expression after the assert started with a (.
llvm-svn: 314172
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 2 | ||||
| -rw-r--r-- | clang/unittests/Format/FormatTestJava.cpp | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 1b046978575..1c6f6bba75e 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -2185,6 +2185,8 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line, const FormatToken &Right) { if (Left.is(tok::kw_return) && Right.isNot(tok::semi)) return true; + if (Left.is(Keywords.kw_assert) && Style.Language == FormatStyle::LK_Java) + return true; if (Style.ObjCSpaceAfterProperty && Line.Type == LT_ObjCProperty && Left.Tok.getObjCKeywordID() == tok::objc_property) return true; diff --git a/clang/unittests/Format/FormatTestJava.cpp b/clang/unittests/Format/FormatTestJava.cpp index 335c944f68b..408fdaa85ad 100644 --- a/clang/unittests/Format/FormatTestJava.cpp +++ b/clang/unittests/Format/FormatTestJava.cpp @@ -412,6 +412,7 @@ TEST_F(FormatTestJava, SynchronizedKeyword) { TEST_F(FormatTestJava, AssertKeyword) { verifyFormat("assert a && b;"); + verifyFormat("assert (a && b);"); } TEST_F(FormatTestJava, PackageDeclarations) { |

