forked from OSchip/llvm-project
Formatter: Format @ literals better. Array and dictionary literals need more work.
llvm-svn: 171887
This commit is contained in:
parent
90fb75d859
commit
77aa25090a
|
@ -940,7 +940,10 @@ private:
|
||||||
return false;
|
return false;
|
||||||
if (Left.is(tok::exclaim) || Left.is(tok::tilde))
|
if (Left.is(tok::exclaim) || Left.is(tok::tilde))
|
||||||
return false;
|
return false;
|
||||||
if (Left.is(tok::at) && Right.is(tok::identifier))
|
if (Left.is(tok::at) &&
|
||||||
|
(Right.is(tok::identifier) || Right.is(tok::string_literal) ||
|
||||||
|
Right.is(tok::char_constant) || Right.is(tok::numeric_constant) ||
|
||||||
|
Right.is(tok::l_paren) || Right.is(tok::l_brace)))
|
||||||
return false;
|
return false;
|
||||||
if (Left.is(tok::less) || Right.is(tok::greater) || Right.is(tok::less))
|
if (Left.is(tok::less) || Right.is(tok::greater) || Right.is(tok::less))
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1137,6 +1137,20 @@ TEST_F(FormatTest, ObjCAt) {
|
||||||
verifyFormat("@throw");
|
verifyFormat("@throw");
|
||||||
verifyFormat("@try");
|
verifyFormat("@try");
|
||||||
|
|
||||||
|
// FIXME: Make the uncommented lines below pass.
|
||||||
|
verifyFormat("@\"String\"");
|
||||||
|
verifyFormat("@1");
|
||||||
|
//verifyFormat("@+4.8");
|
||||||
|
//verifyFormat("@-4");
|
||||||
|
verifyFormat("@1LL");
|
||||||
|
verifyFormat("@.5");
|
||||||
|
verifyFormat("@'c'");
|
||||||
|
verifyFormat("@true");
|
||||||
|
verifyFormat("NSNumber *smallestInt = @(-INT_MAX - 1);");
|
||||||
|
verifyFormat("@[");
|
||||||
|
verifyFormat("@{");
|
||||||
|
|
||||||
|
|
||||||
EXPECT_EQ("@interface", format("@ interface"));
|
EXPECT_EQ("@interface", format("@ interface"));
|
||||||
|
|
||||||
// The precise formatting of this doesn't matter, nobody writes code like
|
// The precise formatting of this doesn't matter, nobody writes code like
|
||||||
|
|
Loading…
Reference in New Issue