From 145567474148d5fc2ef0b4d5ee609cf20ab12827 Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Thu, 7 Feb 2013 21:08:36 +0000 Subject: [PATCH] clang-format: Don't put useless space in f( ::g()). llvm-svn: 174662 --- clang/lib/Format/TokenAnnotator.cpp | 3 ++- clang/unittests/Format/FormatTest.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index ad3baae..8a38454 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -830,7 +830,8 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line, if (Left.is(tok::coloncolon)) return false; if (Right.is(tok::coloncolon)) - return Left.isNot(tok::identifier) && Left.isNot(tok::greater); + return Left.isNot(tok::identifier) && Left.isNot(tok::greater) && + Left.isNot(tok::l_paren); if (Left.is(tok::less) || Right.is(tok::greater) || Right.is(tok::less)) return false; if (Right.is(tok::amp) || Right.is(tok::star)) diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 6924e45..8ea0ff1 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -147,8 +147,9 @@ TEST_F(FormatTest, FormatsNestedCall) { verifyFormat("Method(f1(f2, (f3())));"); } -TEST_F(FormatTest, ImportantSpaces) { +TEST_F(FormatTest, NestedNameSpecifiers) { verifyFormat("vector< ::Type> v;"); + verifyFormat("::ns::SomeFunction(::ns::SomeOtherFunction())"); } TEST_F(FormatTest, OnlyGeneratesNecessaryReplacements) { -- 2.7.4