r192407 - ObjectiveC migrator. When migrating to NS_ENUM/NS_OPTIONS,
Fariborz Jahanian
fjahanian at apple.com
Thu Oct 10 16:57:58 PDT 2013
Author: fjahanian
Date: Thu Oct 10 18:57:58 2013
New Revision: 192407
URL: http://llvm.org/viewvc/llvm-project?rev=192407&view=rev
Log:
ObjectiveC migrator. When migrating to NS_ENUM/NS_OPTIONS,
don't leave a blank line behind replacing the typedef
decl. // rdar://15200949
Modified:
cfe/trunk/lib/ARCMigrate/ObjCMT.cpp
cfe/trunk/test/ARCMT/objcmt-ns-macros.m.result
Modified: cfe/trunk/lib/ARCMigrate/ObjCMT.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/ObjCMT.cpp?rev=192407&r1=192406&r2=192407&view=diff
==============================================================================
--- cfe/trunk/lib/ARCMigrate/ObjCMT.cpp (original)
+++ cfe/trunk/lib/ARCMigrate/ObjCMT.cpp Thu Oct 10 18:57:58 2013
@@ -511,8 +511,12 @@ static bool rewriteToNSEnumDecl(const En
commit.replace(R, ClassString);
SourceLocation EndOfTypedefLoc = TypedefDcl->getLocEnd();
EndOfTypedefLoc = trans::findLocationAfterSemi(EndOfTypedefLoc, NS.getASTContext());
+ SourceLocation BeginOfTypedefLoc = TypedefDcl->getLocStart();
if (!EndOfTypedefLoc.isInvalid()) {
- commit.remove(SourceRange(TypedefDcl->getLocStart(), EndOfTypedefLoc));
+ // FIXME. This assumes that typedef decl; is immediately preceeded by eoln.
+ // It is trying to remove the typedef decl. line entirely.
+ BeginOfTypedefLoc = BeginOfTypedefLoc.getLocWithOffset(-1);
+ commit.remove(SourceRange(BeginOfTypedefLoc, EndOfTypedefLoc));
return true;
}
return false;
Modified: cfe/trunk/test/ARCMT/objcmt-ns-macros.m.result
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/objcmt-ns-macros.m.result?rev=192407&r1=192406&r2=192407&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/objcmt-ns-macros.m.result (original)
+++ cfe/trunk/test/ARCMT/objcmt-ns-macros.m.result Thu Oct 10 18:57:58 2013
@@ -15,7 +15,6 @@ typedef NS_ENUM(NSInteger, wibble) {
blarg
};
-
typedef NS_ENUM(NSUInteger, UITableViewCellStyle) {
UIViewAutoresizingNone = 0,
UIViewAutoresizingFlexibleLeftMargin,
@@ -26,7 +25,6 @@ typedef NS_ENUM(NSUInteger, UITableViewC
UIViewAutoresizingFlexibleBottomMargin
};
-
typedef NS_ENUM(NSInteger, UIViewAnimationTransition) {
UIViewAnimationTransitionNone,
UIViewAnimationTransitionFlipFromLeft,
@@ -52,7 +50,6 @@ typedef NS_OPTIONS(NSUInteger, UI) {
UIFour = 0x100
};
-
typedef NS_OPTIONS(NSUInteger, UIPOWER2) {
UIP2One = 0,
UIP2Two = 0x1,
@@ -71,7 +68,6 @@ typedef NS_ENUM(NSInteger, UIK) {
UIKTwo = 2,
};
-
typedef NS_ENUM(NSInteger, NSTickMarkPosition) {
NSTickMarkBelow = 0,
NSTickMarkAbove = 1,
@@ -87,13 +83,11 @@ typedef NS_OPTIONS(NSUInteger, UITableSt
UIViewBottomMargin = 0xbadbeef
};
-
typedef NS_OPTIONS(NSUInteger, UIStyle) {
UIView0 = 0,
UIView1 = 0XBADBEEF
};
-
typedef NS_ENUM(NSUInteger, NSBitmapImageFileType) {
NSTIFFFileType,
NSBMPFileType,
@@ -103,14 +97,12 @@ typedef NS_ENUM(NSUInteger, NSBitmapImag
NSJPEG2000FileType
};
-
typedef NS_ENUM(NSUInteger, NSAlertStyle) {
NSWarningAlertStyle = 0,
NSInformationalAlertStyle = 1,
NSCriticalAlertStyle = 2
};
-
enum {
D_NSTIFFFileType,
D_NSBMPFileType,
@@ -146,7 +138,6 @@ typedef NS_OPTIONS(NSUInteger, NSFOption
};
-
typedef NS_ENUM(NSInteger, UIP) {
UIP0One = 0,
UIP0Two = 1,
More information about the cfe-commits
mailing list