r187657 - revert patch I added in r187655. It still breaks public

Renato Golin renato.golin at linaro.org
Fri Aug 2 13:53:37 PDT 2013


Is it possible to make that test to use FileCheck?

Getting a diff to be perfect across all architectures is not an easy feat...

--renato


On 2 August 2013 17:25, Fariborz Jahanian <fjahanian at apple.com> wrote:

> Author: fjahanian
> Date: Fri Aug  2 11:25:41 2013
> New Revision: 187657
>
> URL: http://llvm.org/viewvc/llvm-project?rev=187657&view=rev
> Log:
> revert patch I added in r187655. It still breaks public
> buildbot.
>
> Removed:
>     cfe/trunk/test/ARCMT/objcmt-instancetype-2.m
>     cfe/trunk/test/ARCMT/objcmt-instancetype-2.m.result
> Modified:
>     cfe/trunk/include/clang/Basic/IdentifierTable.h
>     cfe/trunk/lib/ARCMigrate/ObjCMT.cpp
>     cfe/trunk/lib/Basic/IdentifierTable.cpp
>     cfe/trunk/test/ARCMT/objcmt-instancetype.m.result
>
> Modified: cfe/trunk/include/clang/Basic/IdentifierTable.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/IdentifierTable.h?rev=187657&r1=187656&r2=187657&view=diff
>
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/IdentifierTable.h (original)
> +++ cfe/trunk/include/clang/Basic/IdentifierTable.h Fri Aug  2 11:25:41
> 2013
> @@ -586,7 +586,10 @@ enum ObjCInstanceTypeFamily {
>    OIT_None,
>    OIT_Array,
>    OIT_Dictionary,
> -  OIT_MemManage
> +  OIT_MemManage,
> +  OIT_NSString,
> +  OIT_NSSet,
> +  OIT_NSURL
>  };
>
>  /// \brief Smart pointer class that efficiently represents Objective-C
> method
>
> Modified: cfe/trunk/lib/ARCMigrate/ObjCMT.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/ObjCMT.cpp?rev=187657&r1=187656&r2=187657&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/ARCMigrate/ObjCMT.cpp (original)
> +++ cfe/trunk/lib/ARCMigrate/ObjCMT.cpp Fri Aug  2 11:25:41 2013
> @@ -41,8 +41,6 @@ class ObjCMigrateASTConsumer : public AS
>    void migrateInstanceType(ASTContext &Ctx, ObjCContainerDecl *CDecl);
>    void migrateMethodInstanceType(ASTContext &Ctx, ObjCContainerDecl
> *CDecl,
>                                   ObjCMethodDecl *OM);
> -  void migrateFactoryMethod(ASTContext &Ctx, ObjCContainerDecl *CDecl,
> -                            ObjCMethodDecl *OM);
>
>  public:
>    std::string MigrateDir;
> @@ -551,34 +549,13 @@ void ObjCMigrateASTConsumer::migrateNSEn
>    Editor->commit(commit);
>  }
>
> -static void ReplaceWithInstancetype(const ObjCMigrateASTConsumer &ASTC,
> -                                    ObjCMethodDecl *OM) {
> -  SourceRange R;
> -  std::string ClassString;
> -  if (TypeSourceInfo *TSInfo =  OM->getResultTypeSourceInfo()) {
> -    TypeLoc TL = TSInfo->getTypeLoc();
> -    R = SourceRange(TL.getBeginLoc(), TL.getEndLoc());
> -    ClassString = "instancetype";
> -  }
> -  else {
> -    R = SourceRange(OM->getLocStart(), OM->getLocStart());
> -    ClassString = OM->isInstanceMethod() ? '-' : '+';
> -    ClassString += " (instancetype)";
> -  }
> -  edit::Commit commit(*ASTC.Editor);
> -  commit.replace(R, ClassString);
> -  ASTC.Editor->commit(commit);
> -}
> -
>  void ObjCMigrateASTConsumer::migrateMethodInstanceType(ASTContext &Ctx,
>                                                         ObjCContainerDecl
> *CDecl,
>                                                         ObjCMethodDecl
> *OM) {
>    ObjCInstanceTypeFamily OIT_Family =
>      Selector::getInstTypeMethodFamily(OM->getSelector());
> -  if (OIT_Family == OIT_None) {
> -    migrateFactoryMethod(Ctx, CDecl, OM);
> +  if (OIT_Family == OIT_None)
>      return;
> -  }
>    std::string ClassName;
>    switch (OIT_Family) {
>      case OIT_Array:
> @@ -604,11 +581,24 @@ void ObjCMigrateASTConsumer::migrateMeth
>        IDecl = ImpDecl->getClassInterface();
>    }
>    if (!IDecl ||
> -      !IDecl->lookupInheritedClass(&Ctx.Idents.get(ClassName))) {
> -    migrateFactoryMethod(Ctx, CDecl, OM);
> +      !IDecl->lookupInheritedClass(&Ctx.Idents.get(ClassName)))
>      return;
> +
> +  SourceRange R;
> +  std::string ClassString;
> +  if (TypeSourceInfo *TSInfo =  OM->getResultTypeSourceInfo()) {
> +    TypeLoc TL = TSInfo->getTypeLoc();
> +    R = SourceRange(TL.getBeginLoc(), TL.getEndLoc());
> +    ClassString = "instancetype";
>    }
> -  ReplaceWithInstancetype(*this, OM);
> +  else {
> +    R = SourceRange(OM->getLocStart(), OM->getLocStart());
> +    ClassString = OM->isInstanceMethod() ? '-' : '+';
> +    ClassString += " (instancetype)";
> +  }
> +  edit::Commit commit(*Editor);
> +  commit.replace(R, ClassString);
> +  Editor->commit(commit);
>  }
>
>  void ObjCMigrateASTConsumer::migrateInstanceType(ASTContext &Ctx,
> @@ -622,43 +612,6 @@ void ObjCMigrateASTConsumer::migrateInst
>    }
>  }
>
> -void ObjCMigrateASTConsumer::migrateFactoryMethod(ASTContext &Ctx,
> -                                                  ObjCContainerDecl
> *CDecl,
> -                                                  ObjCMethodDecl *OM) {
> -  if (OM->isInstanceMethod() || !OM->getResultType()->isObjCIdType())
> -    return;
> -
> -  // Candidate factory methods are + (id) NaMeXXX : ... which belong to a
> class
> -  // NSYYYNamE with matching names be at least 3 characters long.
> -  ObjCInterfaceDecl *IDecl = dyn_cast<ObjCInterfaceDecl>(CDecl);
> -  if (!IDecl) {
> -    if (ObjCCategoryDecl *CatDecl = dyn_cast<ObjCCategoryDecl>(CDecl))
> -      IDecl = CatDecl->getClassInterface();
> -    else if (ObjCImplDecl *ImpDecl = dyn_cast<ObjCImplDecl>(CDecl))
> -      IDecl = ImpDecl->getClassInterface();
> -  }
> -  if (!IDecl)
> -    return;
> -
> -  std::string StringClassName = IDecl->getName();
> -  StringRef LoweredClassName(StringClassName);
> -  LoweredClassName = LoweredClassName.lower();
> -  IdentifierInfo *MethodIdName =
> OM->getSelector().getIdentifierInfoForSlot(0);
> -  std::string MethodName = MethodIdName->getName();
> -  std::string MethodNameSubStr = MethodName.substr(0, 3);
> -  StringRef MethodNamePrefix(MethodNameSubStr);
> -  MethodNamePrefix = MethodNamePrefix.lower();
> -  size_t Ix = LoweredClassName.rfind(MethodNamePrefix);
> -  if (Ix == StringRef::npos)
> -    return;
> -  std::string ClassNamePostfix = LoweredClassName.substr(Ix);
> -  StringRef LoweredMethodName(MethodName);
> -  LoweredMethodName = LoweredMethodName.lower();
> -  if (!LoweredMethodName.startswith(ClassNamePostfix))
> -    return;
> -  ReplaceWithInstancetype(*this, OM);
> -}
> -
>  namespace {
>
>  class RewritesReceiver : public edit::EditsReceiver {
>
> Modified: cfe/trunk/lib/Basic/IdentifierTable.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/IdentifierTable.cpp?rev=187657&r1=187656&r2=187657&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Basic/IdentifierTable.cpp (original)
> +++ cfe/trunk/lib/Basic/IdentifierTable.cpp Fri Aug  2 11:25:41 2013
> @@ -474,6 +474,14 @@ ObjCInstanceTypeFamily Selector::getInst
>      case 'r':
>        if (startsWithWord(name, "retain")) return OIT_MemManage;
>        break;
> +    case 's':
> +      if (startsWithWord(name, "string")) return OIT_NSString;
> +      else
> +        if (startsWithWord(name, "set")) return OIT_NSSet;
> +      break;
> +    case 'U':
> +      if (startsWithWord(name, "URL")) return OIT_NSURL;
> +      break;
>      default:
>        break;
>    }
>
> Removed: cfe/trunk/test/ARCMT/objcmt-instancetype-2.m
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/objcmt-instancetype-2.m?rev=187656&view=auto
>
> ==============================================================================
> --- cfe/trunk/test/ARCMT/objcmt-instancetype-2.m (original)
> +++ cfe/trunk/test/ARCMT/objcmt-instancetype-2.m (removed)
> @@ -1,76 +0,0 @@
> -// RUN: rm -rf %t
> -// RUN: %clang_cc1 -objcmt-migrate-property -mt-migrate-directory %t %s
> -x objective-c -fobjc-runtime-has-weak -fobjc-arc
> -fobjc-default-synthesize-properties -triple x86_64-apple-darwin11
> -// RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test
> -verify-transformed-files %s.result
> -// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -x
> objective-c -fobjc-runtime-has-weak -fobjc-arc
> -fobjc-default-synthesize-properties %s.result
> -
> -typedef unsigned int NSUInteger;
> -typedef int NSInteger;
> -typedef char BOOL;
> - at class NSData, NSError, NSProtocolChecker, NSObject;
> - at class NSPortNameServer, NSTimeZone;
> -
> - at interface NSMutableString
> - at end
> -
> - at interface NSString @end
> -
> - at class NSString, NSURL;
> - at 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="" )));
> - at end
> -
> -
> -typedef enum NSURLBookmarkResolutionOptions {
> -                Bookmark
> -} NSURLBookmarkResolutionOptions;
> -
> - at interface NSURL
> -+ (id)URLWithString:(NSString *)URLString;
> -+ (id)URLWithString:(NSString *)URLString relativeToURL:(NSURL *)baseURL;
> -+ (id)URLByResolvingBookmarkData:(NSData *)bookmarkData
> options:(NSURLBookmarkResolutionOptions)options relativeToURL:(NSURL
> *)relativeURL bookmarkDataIsStale:(BOOL *)isStale error:(NSError **)error
> __attribute__((availability(macosx,introduced=10.6)));
> - at end
> -
> - at class NSDictionary;
> - at interface NSError
> -+ (id)errorWithDomain:(NSString *)domain code:(NSInteger)code
> userInfo:(NSDictionary *)dict;
> - at end
> -
> -
> - at interface NSMutableString (NSMutableStringExtensionMethods)
> -+ (id)stringWithCapacity:(NSUInteger)capacity;
> - at end
> -
> - at interface NSMutableData
> -+ (id)dataWithCapacity:(NSUInteger)aNumItems;
> -+ (id)dataWithLength:(NSUInteger)length;
> - at end
> -
> - at interface NSMutableDictionary @end
> -
> - at interface NSMutableDictionary (NSSharedKeySetDictionary)
> -+ (id )dictionaryWithSharedKeySet:(id)keyset
> __attribute__((availability(macosx,introduced=10.8)));
> - at end
> -
> - at interface NSProtocolChecker
> -+ (id)protocolCheckerWithTarget:(NSObject *)anObject protocol:(Protocol
> *)aProtocol;
> - at end
> -
> - at interface NSConnection
> -+ (id)connectionWithRegisteredName:(NSString *)name host:(NSString
> *)hostName;
> -+ (id)connectionWithRegisteredName:(NSString *)name host:(NSString
> *)hostName usingNameServer:(NSPortNameServer *)server;
> - at end
> -
> - at interface NSDate
> -+ (id)dateWithString:(NSString *)aString
> __attribute__((availability(macosx,introduced=10.4)));
> - at end
> -
> - at interface NSCalendarDate : NSDate
> -+ (id)calendarDate __attribute__((availability(macosx,introduced=10.4)));
> -+ (id)dateWithString:(NSString *)description calendarFormat:(NSString
> *)format locale:(id)locale
> __attribute__((availability(macosx,introduced=10.4)));
> -+ (id)dateWithString:(NSString *)description calendarFormat:(NSString
> *)format __attribute__((availability(macosx,introduced=10.4)));
> -+ (id)dateWithYear:(NSInteger)year month:(NSUInteger)month
> day:(NSUInteger)day hour:(NSUInteger)hour minute:(NSUInteger)minute
> second:(NSUInteger)second timeZone:(NSTimeZone *)aTimeZone
> __attribute__((availability(macosx,introduced=10.4)));
> - at end
> -
>
> Removed: 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=187656&view=auto
>
> ==============================================================================
> --- cfe/trunk/test/ARCMT/objcmt-instancetype-2.m.result (original)
> +++ cfe/trunk/test/ARCMT/objcmt-instancetype-2.m.result (removed)
> @@ -1,76 +0,0 @@
> -// RUN: rm -rf %t
> -// RUN: %clang_cc1 -objcmt-migrate-property -mt-migrate-directory %t %s
> -x objective-c -fobjc-runtime-has-weak -fobjc-arc
> -fobjc-default-synthesize-properties -triple x86_64-apple-darwin11
> -// RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test
> -verify-transformed-files %s.result
> -// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -x
> objective-c -fobjc-runtime-has-weak -fobjc-arc
> -fobjc-default-synthesize-properties %s.result
> -
> -typedef unsigned int NSUInteger;
> -typedef int NSInteger;
> -typedef char BOOL;
> - at class NSData, NSError, NSProtocolChecker, NSObject;
> - at class NSPortNameServer, NSTimeZone;
> -
> - at interface NSMutableString
> - at end
> -
> - at interface NSString @end
> -
> - at class NSString, NSURL;
> - at 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="" )));
> - at end
> -
> -
> -typedef enum NSURLBookmarkResolutionOptions {
> -                Bookmark
> -} NSURLBookmarkResolutionOptions;
> -
> - at interface NSURL
> -+ (instancetype)URLWithString:(NSString *)URLString;
> -+ (instancetype)URLWithString:(NSString *)URLString relativeToURL:(NSURL
> *)baseURL;
> -+ (instancetype)URLByResolvingBookmarkData:(NSData *)bookmarkData
> options:(NSURLBookmarkResolutionOptions)options relativeToURL:(NSURL
> *)relativeURL bookmarkDataIsStale:(BOOL *)isStale error:(NSError **)error
> __attribute__((availability(macosx,introduced=10.6)));
> - at end
> -
> - at class NSDictionary;
> - at interface NSError
> -+ (instancetype)errorWithDomain:(NSString *)domain code:(NSInteger)code
> userInfo:(NSDictionary *)dict;
> - at end
> -
> -
> - at interface NSMutableString (NSMutableStringExtensionMethods)
> -+ (instancetype)stringWithCapacity:(NSUInteger)capacity;
> - at end
> -
> - at interface NSMutableData
> -+ (instancetype)dataWithCapacity:(NSUInteger)aNumItems;
> -+ (instancetype)dataWithLength:(NSUInteger)length;
> - at end
> -
> - at interface NSMutableDictionary @end
> -
> - at interface NSMutableDictionary (NSSharedKeySetDictionary)
> -+ (instancetype )dictionaryWithSharedKeySet:(id)keyset
> __attribute__((availability(macosx,introduced=10.8)));
> - at end
> -
> - at interface NSProtocolChecker
> -+ (instancetype)protocolCheckerWithTarget:(NSObject *)anObject
> protocol:(Protocol *)aProtocol;
> - at end
> -
> - at interface NSConnection
> -+ (instancetype)connectionWithRegisteredName:(NSString *)name
> host:(NSString *)hostName;
> -+ (instancetype)connectionWithRegisteredName:(NSString *)name
> host:(NSString *)hostName usingNameServer:(NSPortNameServer *)server;
> - at end
> -
> - at interface NSDate
> -+ (instancetype)dateWithString:(NSString *)aString
> __attribute__((availability(macosx,introduced=10.4)));
> - at end
> -
> - at interface NSCalendarDate : NSDate
> -+ (instancetype)calendarDate
> __attribute__((availability(macosx,introduced=10.4)));
> -+ (instancetype)dateWithString:(NSString *)description
> calendarFormat:(NSString *)format locale:(id)locale
> __attribute__((availability(macosx,introduced=10.4)));
> -+ (instancetype)dateWithString:(NSString *)description
> calendarFormat:(NSString *)format
> __attribute__((availability(macosx,introduced=10.4)));
> -+ (instancetype)dateWithYear:(NSInteger)year month:(NSUInteger)month
> day:(NSUInteger)day hour:(NSUInteger)hour minute:(NSUInteger)minute
> second:(NSUInteger)second timeZone:(NSTimeZone *)aTimeZone
> __attribute__((availability(macosx,introduced=10.4)));
> - at end
> -
>
> Modified: cfe/trunk/test/ARCMT/objcmt-instancetype.m.result
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/objcmt-instancetype.m.result?rev=187657&r1=187656&r2=187657&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/ARCMT/objcmt-instancetype.m.result (original)
> +++ cfe/trunk/test/ARCMT/objcmt-instancetype.m.result Fri Aug  2 11:25:41
> 2013
> @@ -11,7 +11,7 @@ typedef signed char BOOL;
>  @end
>
>  @interface NSString : NSObject
> -+ (instancetype)stringWithString:(NSString *)string;
> ++ (id)stringWithString:(NSString *)string;
>  - (instancetype)initWithString:(NSString *)aString;
>  @end
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130802/0deddf88/attachment.html>


More information about the cfe-commits mailing list