diff options
| author | Fariborz Jahanian <fjahanian@apple.com> | 2013-10-10 23:57:58 +0000 |
|---|---|---|
| committer | Fariborz Jahanian <fjahanian@apple.com> | 2013-10-10 23:57:58 +0000 |
| commit | 9218f5178d36e54eda4362e65585e360a88f1aa6 (patch) | |
| tree | 8f4e52bf6b8725da6f52d2aafb0ffafefa31a30c | |
| parent | 1408b602916cb8f05edb9607dac866b24635177d (diff) | |
| download | bcm5719-llvm-9218f5178d36e54eda4362e65585e360a88f1aa6.tar.gz bcm5719-llvm-9218f5178d36e54eda4362e65585e360a88f1aa6.zip | |
ObjectiveC migrator. When migrating to NS_ENUM/NS_OPTIONS,
don't leave a blank line behind replacing the typedef
decl. // rdar://15200949
llvm-svn: 192407
| -rw-r--r-- | clang/lib/ARCMigrate/ObjCMT.cpp | 6 | ||||
| -rw-r--r-- | clang/test/ARCMT/objcmt-ns-macros.m.result | 9 |
2 files changed, 5 insertions, 10 deletions
diff --git a/clang/lib/ARCMigrate/ObjCMT.cpp b/clang/lib/ARCMigrate/ObjCMT.cpp index 21ba06cc2cf..ad00d545b26 100644 --- a/clang/lib/ARCMigrate/ObjCMT.cpp +++ b/clang/lib/ARCMigrate/ObjCMT.cpp @@ -511,8 +511,12 @@ static bool rewriteToNSEnumDecl(const EnumDecl *EnumDcl, 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; diff --git a/clang/test/ARCMT/objcmt-ns-macros.m.result b/clang/test/ARCMT/objcmt-ns-macros.m.result index 2a99d4e13b2..42186036962 100644 --- a/clang/test/ARCMT/objcmt-ns-macros.m.result +++ b/clang/test/ARCMT/objcmt-ns-macros.m.result @@ -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, UITableViewCellStyle) { 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, UITableStyle) { 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, NSBitmapImageFileType) { 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, NSFOptions) { }; - typedef NS_ENUM(NSInteger, UIP) { UIP0One = 0, UIP0Two = 1, |

