r190890 - ObjectiveC migrator. Ignore migrating 'deprecated'
Fariborz Jahanian
fjahanian at apple.com
Tue Sep 17 14:56:04 PDT 2013
Author: fjahanian
Date: Tue Sep 17 16:56:04 2013
New Revision: 190890
URL: http://llvm.org/viewvc/llvm-project?rev=190890&view=rev
Log:
ObjectiveC migrator. Ignore migrating 'deprecated'
entities. // rdar://14989365
Modified:
cfe/trunk/lib/ARCMigrate/ObjCMT.cpp
cfe/trunk/test/ARCMT/objcmt-arc-cf-annotations.m.result
cfe/trunk/test/ARCMT/objcmt-instancetype-2.m
cfe/trunk/test/ARCMT/objcmt-instancetype-2.m.result
cfe/trunk/test/ARCMT/objcmt-ns-macros.m
cfe/trunk/test/ARCMT/objcmt-ns-macros.m.result
cfe/trunk/test/ARCMT/objcmt-property.m
cfe/trunk/test/ARCMT/objcmt-property.m.result
Modified: cfe/trunk/lib/ARCMigrate/ObjCMT.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/ObjCMT.cpp?rev=190890&r1=190889&r2=190890&view=diff
==============================================================================
--- cfe/trunk/lib/ARCMigrate/ObjCMT.cpp (original)
+++ cfe/trunk/lib/ARCMigrate/ObjCMT.cpp Tue Sep 17 16:56:04 2013
@@ -340,9 +340,14 @@ static bool rewriteToObjCProperty(const
void ObjCMigrateASTConsumer::migrateObjCInterfaceDecl(ASTContext &Ctx,
ObjCContainerDecl *D) {
+ if (D->isDeprecated())
+ return;
+
for (ObjCContainerDecl::method_iterator M = D->meth_begin(), MEnd = D->meth_end();
M != MEnd; ++M) {
ObjCMethodDecl *Method = (*M);
+ if (Method->isDeprecated())
+ continue;
if (!migrateProperty(Ctx, D, Method))
migrateNsReturnsInnerPointer(Ctx, Method);
}
@@ -532,7 +537,7 @@ static bool UseNSOptionsMacro(Preprocess
void ObjCMigrateASTConsumer::migrateProtocolConformance(ASTContext &Ctx,
const ObjCImplementationDecl *ImpDecl) {
const ObjCInterfaceDecl *IDecl = ImpDecl->getClassInterface();
- if (!IDecl || ObjCProtocolDecls.empty())
+ if (!IDecl || ObjCProtocolDecls.empty() || IDecl->isDeprecated())
return;
// Find all implicit conforming protocols for this class
// and make them explicit.
@@ -590,7 +595,8 @@ void ObjCMigrateASTConsumer::migrateNSEn
const EnumDecl *EnumDcl,
const TypedefDecl *TypedefDcl) {
if (!EnumDcl->isCompleteDefinition() || EnumDcl->getIdentifier() ||
- !TypedefDcl->getIdentifier())
+ !TypedefDcl->getIdentifier() ||
+ EnumDcl->isDeprecated() || TypedefDcl->isDeprecated())
return;
QualType qt = TypedefDcl->getTypeSourceInfo()->getType();
@@ -813,6 +819,8 @@ void ObjCMigrateASTConsumer::migrateMeth
MEnd = CDecl->meth_end();
M != MEnd; ++M) {
ObjCMethodDecl *Method = (*M);
+ if (Method->isDeprecated())
+ continue;
migrateMethodInstanceType(Ctx, CDecl, Method);
}
}
@@ -944,6 +952,9 @@ void ObjCMigrateASTConsumer::AnnotateImp
}
void ObjCMigrateASTConsumer::migrateCFAnnotation(ASTContext &Ctx, const Decl *Decl) {
+ if (Decl->isDeprecated())
+ return;
+
if (Decl->hasAttr<CFAuditedTransferAttr>()) {
assert(CFFunctionIBCandidates.empty() &&
"Cannot have audited functions/methods inside user "
@@ -1084,7 +1095,7 @@ ObjCMigrateASTConsumer::CF_BRIDGING_KIND
void ObjCMigrateASTConsumer::migrateARCSafeAnnotation(ASTContext &Ctx,
ObjCContainerDecl *CDecl) {
- if (!isa<ObjCInterfaceDecl>(CDecl))
+ if (!isa<ObjCInterfaceDecl>(CDecl) || CDecl->isDeprecated())
return;
// migrate methods which can have instancetype as their result type.
@@ -1234,10 +1245,8 @@ void ObjCMigrateASTConsumer::HandleTrans
D != DEnd; ++D) {
if (unsigned FID =
PP.getSourceManager().getFileID((*D)->getLocation()).getHashValue())
- if (FileId && FileId != FID) {
- assert(!CFFunctionIBCandidates.empty());
+ if (FileId && FileId != FID)
AnnotateImplicitBridging(Ctx);
- }
if (ObjCInterfaceDecl *CDecl = dyn_cast<ObjCInterfaceDecl>(*D))
migrateObjCInterfaceDecl(Ctx, CDecl);
Modified: cfe/trunk/test/ARCMT/objcmt-arc-cf-annotations.m.result
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/objcmt-arc-cf-annotations.m.result?rev=190890&r1=190889&r2=190890&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/objcmt-arc-cf-annotations.m.result (original)
+++ cfe/trunk/test/ARCMT/objcmt-arc-cf-annotations.m.result Tue Sep 17 16:56:04 2013
@@ -231,10 +231,10 @@ CF_IMPLICIT_BRIDGING_ENABLED
io_service_t IOServiceGetMatchingService( mach_port_t masterPort, CFDictionaryRef matching );
kern_return_t IOServiceGetMatchingServices( mach_port_t masterPort, CFDictionaryRef matching, io_iterator_t * existing );
-kern_return_t IOServiceAddNotification( mach_port_t masterPort, const io_name_t notificationType, CFDictionaryRef matching, mach_port_t wakePort, uintptr_t reference, io_iterator_t * notification ) __attribute__((deprecated));
CF_IMPLICIT_BRIDGING_DISABLED
- // expected-note {{'IOServiceAddNotification' declared here}}
+
+kern_return_t IOServiceAddNotification( mach_port_t masterPort, const io_name_t notificationType, CFDictionaryRef matching, mach_port_t wakePort, uintptr_t reference, io_iterator_t * notification ) __attribute__((deprecated)); // expected-note {{'IOServiceAddNotification' declared here}}
kern_return_t IOServiceAddMatchingNotification( IONotificationPortRef notifyPort, const io_name_t notificationType, CFDictionaryRef CF_CONSUMED matching, IOServiceMatchingCallback callback, void * refCon, io_iterator_t * notification );
CF_IMPLICIT_BRIDGING_ENABLED
Modified: cfe/trunk/test/ARCMT/objcmt-instancetype-2.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/objcmt-instancetype-2.m?rev=190890&r1=190889&r2=190890&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/objcmt-instancetype-2.m (original)
+++ cfe/trunk/test/ARCMT/objcmt-instancetype-2.m Tue Sep 17 16:56:04 2013
@@ -16,10 +16,10 @@ typedef char BOOL;
@class NSString, NSURL;
@interface NSString (NSStringDeprecated)
-+ (id)stringWithContentsOfFile:(NSString *)path __attribute__((availability(macosx,introduced=10.0 ,deprecated=10.4,message="" )));
-+ (id)stringWithContentsOfURL:(NSURL *)url __attribute__((availability(macosx,introduced=10.0 ,deprecated=10.4,message="" )));
-+ (id)stringWithCString:(const char *)bytes length:(NSUInteger)length __attribute__((availability(macosx,introduced=10.0 ,deprecated=10.4,message="" )));
-+ (id)stringWithCString:(const char *)bytes __attribute__((availability(macosx,introduced=10.0 ,deprecated=10.4,message="" )));
++ (id)stringWithContentsOfFile:(NSString *)path __attribute__((availability(macosx,introduced=10.0 ,message="" )));
++ (id)stringWithContentsOfURL:(NSURL *)url __attribute__((availability(macosx,introduced=10.0 ,message="" )));
++ (id)stringWithCString:(const char *)bytes length:(NSUInteger)length __attribute__((availability(macosx,introduced=10.0 ,message="" )));
++ (id)stringWithCString:(const char *)bytes __attribute__((availability(macosx,introduced=10.0 ,message="" )));
@end
Modified: cfe/trunk/test/ARCMT/objcmt-instancetype-2.m.result
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/objcmt-instancetype-2.m.result?rev=190890&r1=190889&r2=190890&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/objcmt-instancetype-2.m.result (original)
+++ cfe/trunk/test/ARCMT/objcmt-instancetype-2.m.result Tue Sep 17 16:56:04 2013
@@ -16,10 +16,10 @@ typedef char BOOL;
@class NSString, NSURL;
@interface NSString (NSStringDeprecated)
-+ (instancetype)stringWithContentsOfFile:(NSString *)path __attribute__((availability(macosx,introduced=10.0 ,deprecated=10.4,message="" )));
-+ (instancetype)stringWithContentsOfURL:(NSURL *)url __attribute__((availability(macosx,introduced=10.0 ,deprecated=10.4,message="" )));
-+ (instancetype)stringWithCString:(const char *)bytes length:(NSUInteger)length __attribute__((availability(macosx,introduced=10.0 ,deprecated=10.4,message="" )));
-+ (instancetype)stringWithCString:(const char *)bytes __attribute__((availability(macosx,introduced=10.0 ,deprecated=10.4,message="" )));
++ (instancetype)stringWithContentsOfFile:(NSString *)path __attribute__((availability(macosx,introduced=10.0 ,message="" )));
++ (instancetype)stringWithContentsOfURL:(NSURL *)url __attribute__((availability(macosx,introduced=10.0 ,message="" )));
++ (instancetype)stringWithCString:(const char *)bytes length:(NSUInteger)length __attribute__((availability(macosx,introduced=10.0 ,message="" )));
++ (instancetype)stringWithCString:(const char *)bytes __attribute__((availability(macosx,introduced=10.0 ,message="" )));
@end
Modified: cfe/trunk/test/ARCMT/objcmt-ns-macros.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/objcmt-ns-macros.m?rev=190890&r1=190889&r2=190890&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/objcmt-ns-macros.m (original)
+++ cfe/trunk/test/ARCMT/objcmt-ns-macros.m Tue Sep 17 16:56:04 2013
@@ -8,6 +8,7 @@ typedef unsigned long NSUInteger;
#define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type
#define NS_OPTIONS(_type, _name) enum _name : _type _name; enum _name : _type
+#define DEPRECATED __attribute__((deprecated))
enum {
blah,
@@ -110,3 +111,18 @@ enum {
};
typedef NSUInteger NSAlertStyle;
+enum {
+ D_NSTIFFFileType,
+ D_NSBMPFileType,
+ D_NSGIFFileType,
+ D_NSJPEGFileType,
+ D_NSPNGFileType,
+ D_NSJPEG2000FileType
+};
+typedef NSUInteger D_NSBitmapImageFileType DEPRECATED;
+
+typedef enum {
+ D_NSTickMarkBelow = 0,
+ D_NSTickMarkAbove = 1
+} D_NSTickMarkPosition DEPRECATED;
+
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=190890&r1=190889&r2=190890&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/objcmt-ns-macros.m.result (original)
+++ cfe/trunk/test/ARCMT/objcmt-ns-macros.m.result Tue Sep 17 16:56:04 2013
@@ -8,6 +8,7 @@ typedef unsigned long NSUInteger;
#define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type
#define NS_OPTIONS(_type, _name) enum _name : _type _name; enum _name : _type
+#define DEPRECATED __attribute__((deprecated))
typedef NS_ENUM(NSInteger, wibble) {
blah,
@@ -110,3 +111,18 @@ typedef NS_ENUM(NSUInteger, NSAlertStyle
};
+enum {
+ D_NSTIFFFileType,
+ D_NSBMPFileType,
+ D_NSGIFFileType,
+ D_NSJPEGFileType,
+ D_NSPNGFileType,
+ D_NSJPEG2000FileType
+};
+typedef NSUInteger D_NSBitmapImageFileType DEPRECATED;
+
+typedef enum {
+ D_NSTickMarkBelow = 0,
+ D_NSTickMarkAbove = 1
+} D_NSTickMarkPosition DEPRECATED;
+
Modified: cfe/trunk/test/ARCMT/objcmt-property.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/objcmt-property.m?rev=190890&r1=190889&r2=190890&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/objcmt-property.m (original)
+++ cfe/trunk/test/ARCMT/objcmt-property.m Tue Sep 17 16:56:04 2013
@@ -6,6 +6,7 @@
#define WEBKIT_OBJC_METHOD_ANNOTATION(ANNOTATION) ANNOTATION
#define WEAK_IMPORT_ATTRIBUTE __attribute__((objc_arc_weak_reference_unavailable))
#define AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER
+#define DEPRECATED __attribute__((deprecated))
typedef char BOOL;
@class NSString;
@@ -158,3 +159,20 @@ typedef char BOOL;
- (BOOL) getMANY;
- (BOOL) getSome;
@end
+
+DEPRECATED
+ at interface I_DEP
+- (BOOL) isinValid;
+- (void) setInValid : (BOOL) arg;
+ at end
+
+ at interface AnotherOne
+- (BOOL) isinValid DEPRECATED;
+- (void) setInValid : (BOOL) arg;
+- (id)MYtarget;
+- (void)setMYtarget: (id)target DEPRECATED;
+- (BOOL) getM DEPRECATED;
+
+- (id)xxxdelegateYYY DEPRECATED;
+- (void)setXxxdelegateYYY:(id)delegate DEPRECATED;
+ at end
Modified: cfe/trunk/test/ARCMT/objcmt-property.m.result
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/objcmt-property.m.result?rev=190890&r1=190889&r2=190890&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/objcmt-property.m.result (original)
+++ cfe/trunk/test/ARCMT/objcmt-property.m.result Tue Sep 17 16:56:04 2013
@@ -6,6 +6,7 @@
#define WEBKIT_OBJC_METHOD_ANNOTATION(ANNOTATION) ANNOTATION
#define WEAK_IMPORT_ATTRIBUTE __attribute__((objc_arc_weak_reference_unavailable))
#define AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER
+#define DEPRECATED __attribute__((deprecated))
typedef char BOOL;
@class NSString;
@@ -158,3 +159,20 @@ typedef char BOOL;
@property(nonatomic, getter=getMANY, readonly) BOOL MANY;
@property(nonatomic, getter=getSome, readonly) BOOL some;
@end
+
+DEPRECATED
+ at interface I_DEP
+- (BOOL) isinValid;
+- (void) setInValid : (BOOL) arg;
+ at end
+
+ at interface AnotherOne
+- (BOOL) isinValid DEPRECATED;
+- (void) setInValid : (BOOL) arg;
+- (id)MYtarget;
+- (void)setMYtarget: (id)target DEPRECATED;
+- (BOOL) getM DEPRECATED;
+
+- (id)xxxdelegateYYY DEPRECATED;
+- (void)setXxxdelegateYYY:(id)delegate DEPRECATED;
+ at end
More information about the cfe-commits
mailing list