clang-format: Tweak -style=Chromium for Java files.

For Java, don't do any of the deviations from Google Style that Chromium style
does for C++.

Chromium's Java follows Android Java style [1], which is roughly Google Java
style with an indent of 4 and a continuation indent of 8.

1: https://source.android.com/source/code-style.html
llvm-svn: 222839
This commit is contained in:
Nico Weber
2014-11-26 16:43:18 +00:00
parent be6992c7d3
commit 450425c980
2 changed files with 26 additions and 6 deletions

View File

@@ -69,6 +69,21 @@ TEST_F(FormatTestJava, FormatsInstanceOfLikeOperators) {
Style);
}
TEST_F(FormatTestJava, Chromium) {
verifyFormat("class SomeClass {\n"
" void f() {}\n"
" int g() {\n"
" return 0;\n"
" }\n"
" void h() {\n"
" while (true) f();\n"
" for (;;) f();\n"
" if (true) f();\n"
" }\n"
"}",
getChromiumStyle(FormatStyle::LK_Java));
}
TEST_F(FormatTestJava, ClassKeyword) {
verifyFormat("SomeClass.class.getName();");
verifyFormat("Class c = SomeClass.class;");