]> granicus.if.org Git - clang/commitdiff
clang-format: Fix space in decltype-constexprs.
authorDaniel Jasper <djasper@google.com>
Wed, 28 Aug 2013 07:07:07 +0000 (07:07 +0000)
committerDaniel Jasper <djasper@google.com>
Wed, 28 Aug 2013 07:07:07 +0000 (07:07 +0000)
Before:
  static constexpr bool Bar = decltype(bar()) ::value;

After:
  static constexpr bool Bar = decltype(bar())::value;

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

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

index 7f298555079a04f59b9682a3c2ba6833285472ed..ee476b952e07fe1786ca331fd2432919e29fef6c 100644 (file)
@@ -1180,7 +1180,8 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line,
   if (Left.is(tok::coloncolon))
     return false;
   if (Right.is(tok::coloncolon))
-    return !Left.isOneOf(tok::identifier, tok::greater, tok::l_paren);
+    return !Left.isOneOf(tok::identifier, tok::greater, tok::l_paren,
+                         tok::r_paren);
   if (Left.is(tok::less) || Right.isOneOf(tok::greater, tok::less))
     return false;
   if (Right.is(tok::ellipsis))
index 1cc4389f3aa5e3f68e7b8c83fc7ed7bd3063fc60..5002c9ce804f86c977a6fe03d72c3b9149258340 100644 (file)
@@ -138,6 +138,7 @@ TEST_F(FormatTest, FormatsNestedCall) {
 TEST_F(FormatTest, NestedNameSpecifiers) {
   verifyFormat("vector< ::Type> v;");
   verifyFormat("::ns::SomeFunction(::ns::SomeOtherFunction())");
+  verifyFormat("static constexpr bool Bar = decltype(bar())::value;");
 }
 
 TEST_F(FormatTest, OnlyGeneratesNecessaryReplacements) {