r214904 - [PR19983] SBPO_Always not covering all the cases.
Chad Rosier
mcrosier at codeaurora.org
Tue Aug 5 10:58:54 PDT 2014
Author: mcrosier
Date: Tue Aug 5 12:58:54 2014
New Revision: 214904
URL: http://llvm.org/viewvc/llvm-project?rev=214904&view=rev
Log:
[PR19983] SBPO_Always not covering all the cases.
Patch by "Roman Kashitsyn" <romankashicin at gmail.com>.
Phabricator revision: http://reviews.llvm.org/D4788
Modified:
cfe/trunk/lib/Format/TokenAnnotator.cpp
cfe/trunk/unittests/Format/FormatTest.cpp
Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=214904&r1=214903&r2=214904&view=diff
==============================================================================
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Tue Aug 5 12:58:54 2014
@@ -1630,7 +1630,7 @@ bool TokenAnnotator::spaceRequiredBefore
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;
Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=214904&r1=214903&r2=214904&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Tue Aug 5 12:58:54 2014
@@ -7540,6 +7540,7 @@ TEST_F(FormatTest, ConfigurableSpaceBefo
"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, ConfigurableSpaceBefo
verifyFormat("#if defined(x)\n"
"#endif",
Space);
+ verifyFormat("auto i = std::make_unique<int> (5);", Space);
}
TEST_F(FormatTest, ConfigurableSpacesInParentheses) {
More information about the cfe-commits
mailing list