forked from OSchip/llvm-project
[PR19983] SBPO_Always not covering all the cases.
Patch by "Roman Kashitsyn" <romankashicin@gmail.com>. Phabricator revision: http://reviews.llvm.org/D4788 llvm-svn: 214904
This commit is contained in:
parent
c04f3f9f73
commit
0a84f17882
|
@ -1630,7 +1630,7 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line,
|
|||
Tok.Previous->Type == TT_ConditionalExpr)
|
||||
return true;
|
||||
if (Tok.Previous->Type == TT_TemplateCloser && Tok.is(tok::l_paren))
|
||||
return false;
|
||||
return Style.SpaceBeforeParens == FormatStyle::SBPO_Always;
|
||||
if (Tok.is(tok::less) && Tok.Previous->isNot(tok::l_paren) &&
|
||||
Line.First->is(tok::hash))
|
||||
return true;
|
||||
|
|
|
@ -7540,6 +7540,7 @@ TEST_F(FormatTest, ConfigurableSpaceBeforeParens) {
|
|||
"default:\n"
|
||||
" break;\n"
|
||||
"}", NoSpace);
|
||||
verifyFormat("auto i = std::make_unique<int>(5);", NoSpace);
|
||||
|
||||
FormatStyle Space = getLLVMStyle();
|
||||
Space.SpaceBeforeParens = FormatStyle::SBPO_Always;
|
||||
|
@ -7576,6 +7577,7 @@ TEST_F(FormatTest, ConfigurableSpaceBeforeParens) {
|
|||
verifyFormat("#if defined(x)\n"
|
||||
"#endif",
|
||||
Space);
|
||||
verifyFormat("auto i = std::make_unique<int> (5);", Space);
|
||||
}
|
||||
|
||||
TEST_F(FormatTest, ConfigurableSpacesInParentheses) {
|
||||
|
|
Loading…
Reference in New Issue