return false;
if (Left.is(tok::less) || Right.is(tok::greater) || Right.is(tok::less))
return false;
+ if (Right.is(tok::amp) || Right.is(tok::star))
+ return Left.isLiteral() ||
+ (Left.isNot(tok::star) && Left.isNot(tok::amp) &&
+ !Style.PointerAndReferenceBindToType);
if (Left.is(tok::amp) || Left.is(tok::star))
return Right.isLiteral() || Style.PointerAndReferenceBindToType;
if (Right.is(tok::star) && Left.is(tok::l_paren))
return false;
- if (Right.is(tok::amp) || Right.is(tok::star))
- return Left.isLiteral() || !Style.PointerAndReferenceBindToType;
if (Left.is(tok::l_square) || Right.is(tok::l_square) ||
Right.is(tok::r_square))
return false;
- if (Left.is(tok::coloncolon) || Right.is(tok::coloncolon))
+ if (Left.is(tok::coloncolon) ||
+ (Right.is(tok::coloncolon) &&
+ (Left.is(tok::identifier) || Left.is(tok::greater))))
return false;
if (Left.is(tok::period) || Right.is(tok::period))
return false;
TEST_F(FormatTest, FormatsDerivedClass) {
verifyFormat("class A : public B {\n"
"};");
+ verifyFormat("class A : public ::B {\n"
+ "};");
}
TEST_F(FormatTest, FormatsEnum) {
verifyFormat("int a = *b;");
verifyFormat("int a = *b * c;");
verifyFormat("int a = b * *c;");
+ verifyFormat("int main(int argc, char **argv) {\n}");
+
+ verifyGoogleFormat("int main(int argc, char** argv) {\n}");
}
TEST_F(FormatTest, LineStartsWithSpecialCharacter) {