[cfe-commits] r171753 - in /cfe/trunk: lib/Format/Format.cpp unittests/Format/FormatTest.cpp
Nico Weber
nicolasweber at gmx.de
Mon Jan 7 08:14:28 PST 2013
Author: nico
Date: Mon Jan 7 10:14:28 2013
New Revision: 171753
URL: http://llvm.org/viewvc/llvm-project?rev=171753&view=rev
Log:
Formatter: Don't put spaces betwen @ and objc keywords.
Modified:
cfe/trunk/lib/Format/Format.cpp
cfe/trunk/unittests/Format/FormatTest.cpp
Modified: cfe/trunk/lib/Format/Format.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=171753&r1=171752&r2=171753&view=diff
==============================================================================
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Mon Jan 7 10:14:28 2013
@@ -946,6 +946,8 @@
(Left.isNot(tok::identifier) && Left.isNot(tok::kw_sizeof) &&
Left.isNot(tok::kw_typeof) && Left.isNot(tok::kw_alignof));
}
+ if (Left.is(tok::at) && Right.getObjCKeywordID() != tok::objc_not_keyword)
+ return false;
return true;
}
Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=171753&r1=171752&r2=171753&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Mon Jan 7 10:14:28 2013
@@ -1022,10 +1022,9 @@
}
TEST_F(FormatTest, ObjCAt) {
- // FIXME: Make the uncommented lines pass.
verifyFormat("@autoreleasepool");
- //verifyFormat("@catch");
- //verifyFormat("@class");
+ verifyFormat("@catch");
+ verifyFormat("@class");
verifyFormat("@compatibility_alias");
verifyFormat("@defs");
verifyFormat("@dynamic");
@@ -1037,17 +1036,17 @@
verifyFormat("@interface");
verifyFormat("@optional");
verifyFormat("@package");
- //verifyFormat("@private");
+ verifyFormat("@private");
verifyFormat("@property");
- //verifyFormat("@protected");
+ verifyFormat("@protected");
verifyFormat("@protocol");
- //verifyFormat("@public");
+ verifyFormat("@public");
verifyFormat("@required");
verifyFormat("@selector");
verifyFormat("@synchronized");
verifyFormat("@synthesize");
- //verifyFormat("@throw");
- //verifyFormat("@try");
+ verifyFormat("@throw");
+ verifyFormat("@try");
EXPECT_EQ("@interface", format("@ interface"));
More information about the cfe-commits
mailing list