r174662 - clang-format: Don't put useless space in f( ::g()).

Daniel Jasper djasper at google.com
Thu Feb 7 13:08:37 PST 2013


Author: djasper
Date: Thu Feb  7 15:08:36 2013
New Revision: 174662

URL: http://llvm.org/viewvc/llvm-project?rev=174662&view=rev
Log:
clang-format: Don't put useless space in f( ::g()).

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=174662&r1=174661&r2=174662&view=diff
==============================================================================
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Thu Feb  7 15:08:36 2013
@@ -830,7 +830,8 @@ bool TokenAnnotator::spaceRequiredBetwee
   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))

Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=174662&r1=174661&r2=174662&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Thu Feb  7 15:08:36 2013
@@ -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) {





More information about the cfe-commits mailing list