r189449 - clang-format: Fix space in decltype-constexprs.

Daniel Jasper djasper at google.com
Wed Aug 28 00:07:07 PDT 2013


Author: djasper
Date: Wed Aug 28 02:07:07 2013
New Revision: 189449

URL: http://llvm.org/viewvc/llvm-project?rev=189449&view=rev
Log:
clang-format: Fix space in decltype-constexprs.

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

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

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=189449&r1=189448&r2=189449&view=diff
==============================================================================
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Wed Aug 28 02:07:07 2013
@@ -1180,7 +1180,8 @@ bool TokenAnnotator::spaceRequiredBetwee
   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))

Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=189449&r1=189448&r2=189449&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Wed Aug 28 02:07:07 2013
@@ -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) {





More information about the cfe-commits mailing list