]> granicus.if.org Git - clang/commitdiff
[PR19983] SBPO_Always not covering all the cases.
authorChad Rosier <mcrosier@codeaurora.org>
Tue, 5 Aug 2014 17:58:54 +0000 (17:58 +0000)
committerChad Rosier <mcrosier@codeaurora.org>
Tue, 5 Aug 2014 17:58:54 +0000 (17:58 +0000)
Patch by "Roman Kashitsyn" <romankashicin@gmail.com>.
Phabricator revision: http://reviews.llvm.org/D4788

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@214904 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Format/TokenAnnotator.cpp
unittests/Format/FormatTest.cpp

index ed6938fdbc87f319bbaf902ab0901debfac07148..ca85c10fe5be8cb84a5e2ccd93c3ef6b301a4d56 100644 (file)
@@ -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;
index 74cca4fafbcc7e5163433be2c2bddc835310890c..6bbda9d6e3bd1e8a8405127b86c33baae37806d8 100644 (file)
@@ -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) {