r200073 - clang-format: Fix incorrect space removal.
Daniel Jasper
djasper at google.com
Sat Jan 25 01:16:05 PST 2014
Author: djasper
Date: Sat Jan 25 03:16:02 2014
New Revision: 200073
URL: http://llvm.org/viewvc/llvm-project?rev=200073&view=rev
Log:
clang-format: Fix incorrect space removal.
Before:
Deleted &operator=(const Deleted &)&= default;
Deleted &operator=(const Deleted &)&&= delete;
After:
Deleted &operator=(const Deleted &)& = default;
Deleted &operator=(const Deleted &)&& = delete;
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=200073&r1=200072&r2=200073&view=diff
==============================================================================
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Sat Jan 25 03:16:02 2014
@@ -1403,7 +1403,7 @@ bool TokenAnnotator::spaceRequiredBefore
(Tok.Type != TT_DictLiteral || Style.SpacesInContainerLiterals);
if (Tok.Previous->Type == TT_UnaryOperator ||
Tok.Previous->Type == TT_CastRParen)
- return false;
+ return Tok.Type == TT_BinaryOperator;
if (Tok.Previous->is(tok::greater) && Tok.is(tok::greater)) {
return Tok.Type == TT_TemplateCloser &&
Tok.Previous->Type == TT_TemplateCloser &&
Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=200073&r1=200072&r2=200073&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Sat Jan 25 03:16:02 2014
@@ -4248,6 +4248,11 @@ TEST_F(FormatTest, UnderstandsOverloaded
verifyGoogleFormat("operator ::A();");
verifyFormat("using A::operator+;");
+
+ verifyFormat("Deleted &operator=(const Deleted &)& = default;");
+ verifyFormat("Deleted &operator=(const Deleted &)&& = delete;");
+ verifyGoogleFormat("Deleted& operator=(const Deleted&)& = default;");
+ verifyGoogleFormat("Deleted& operator=(const Deleted&)&& = delete;");
}
TEST_F(FormatTest, UnderstandsNewAndDelete) {
More information about the cfe-commits
mailing list