r221933 - Objective-C. Fixes a regression caused by implementation

Argyrios Kyrtzidis kyrtzidis at apple.com
Thu Nov 13 15:37:01 PST 2014


> On Nov 13, 2014, at 2:27 PM, Fariborz Jahanian <fjahanian at apple.com> wrote:
> 
> /// ObjCMethodList - a linked list of methods with different signatures.
> struct ObjCMethodList {
>   ObjCMethodDecl *Method;
> +  /// \brief count of methods with same signature.
> +  unsigned Count;
>   /// \brief The next list object and 2 bits for extra info.
>   llvm::PointerIntPair<ObjCMethodList *, 2> NextAndExtraBits;
> 
> -  ObjCMethodList() : Method(nullptr) { }
> -  ObjCMethodList(ObjCMethodDecl *M, ObjCMethodList *C)
> -    : Method(M), NextAndExtraBits(C, 0) { }
> +  ObjCMethodList() : Method(nullptr), Count(0) { }
> +  ObjCMethodList(ObjCMethodDecl *M, unsigned count, ObjCMethodList *C)
> +    : Method(M), Count(count), NextAndExtraBits(C, 0) { }
> 
>   ObjCMethodList *getNext() const { return NextAndExtraBits.getPointer(); }
>   unsigned getBits() const { return NextAndExtraBits.getInt(); }

Since we only care about whether there are multiple methods or a single method, and don’t care about the exact count, how about use a bit from ‘NextAndExtraBits' to indicate if it is a single method or not, and save space ?

So something like:

  llvm::PointerIntPair<ObjCMethodList *, 3> NextAndExtraBits;
  bool isSingle() const { <bit stuff> }

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141113/3d813185/attachment.html>


More information about the cfe-commits mailing list