forked from OSchip/llvm-project
clang-format: [Java] Add space between "synchronized" and "(".
Before: synchronized(mData) { // ... } After: synchronized (mData) { // ... } This fixes llvm.org/PR21455. llvm-svn: 221110
This commit is contained in:
parent
7bd618f5aa
commit
b9d3db6b1b
|
@ -1680,6 +1680,9 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line,
|
|||
} else if (Style.Language == FormatStyle::LK_JavaScript) {
|
||||
if (Left.TokenText == "var")
|
||||
return true;
|
||||
} else if (Style.Language == FormatStyle::LK_Java) {
|
||||
if (Left.TokenText == "synchronized" && Right.is(tok::l_paren))
|
||||
return Style.SpaceBeforeParens != FormatStyle::SBPO_Never;
|
||||
}
|
||||
if (Right.Tok.getIdentifierInfo() && Left.Tok.getIdentifierInfo())
|
||||
return true; // Never ever merge two identifiers.
|
||||
|
|
|
@ -157,5 +157,11 @@ TEST_F(FormatTestJava, TryCatchFinally) {
|
|||
"}");
|
||||
}
|
||||
|
||||
TEST_F(FormatTestJava, SynchronizedKeyword) {
|
||||
verifyFormat("synchronized (mData) {\n"
|
||||
" // ...\n"
|
||||
"}");
|
||||
}
|
||||
|
||||
} // end namespace tooling
|
||||
} // end namespace clang
|
||||
|
|
Loading…
Reference in New Issue