From: Daniel Jasper Date: Wed, 28 Aug 2013 07:07:07 +0000 (+0000) Subject: clang-format: Fix space in decltype-constexprs. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=081fc17374baf55cc6a6069a9f5a1596fb378ef3;p=clang clang-format: Fix space in decltype-constexprs. 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 --- diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp index 7f29855507..ee476b952e 100644 --- a/lib/Format/TokenAnnotator.cpp +++ b/lib/Format/TokenAnnotator.cpp @@ -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)) diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index 1cc4389f3a..5002c9ce80 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -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) {