clang-format: Fix overloaded operator for global-scoped conversions.
Before:
operator::A();
After:
operator ::A();
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193605 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp
index 621581c..eeecdce 100644
--- a/lib/Format/TokenAnnotator.cpp
+++ b/lib/Format/TokenAnnotator.cpp
@@ -1337,7 +1337,7 @@
if (Tok.Type == TT_CtorInitializerColon || Tok.Type == TT_ObjCBlockLParen)
return true;
if (Tok.Previous->Tok.is(tok::kw_operator))
- return false;
+ return Tok.is(tok::coloncolon);
if (Tok.Type == TT_OverloadedOperatorLParen)
return false;
if (Tok.is(tok::colon))
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index cbac133..83035f7 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -3902,6 +3902,7 @@
verifyGoogleFormat("operator void*();");
verifyGoogleFormat("operator SomeType<SomeType<int>>();");
+ verifyGoogleFormat("operator ::A();");
verifyFormat("using A::operator+;");
}