[PATCH] ArrayRef ctor from None

Robert Wilhelm robert.wilhelm at gmx.net
Sat May 4 01:45:43 PDT 2013


Attached are now patches (llvm and clang) with the requested changes.

llvm::None in DeclObjC.cpp is necessary because of another None in
Header:
DeclObjC.h:  enum ImplementationControl { None, Required, Optional };

I left MultiExprArg cleanup for a future patch.

Robert

On Fri, 2013-05-03 at 18:13 +0300, Dmitri Gribenko wrote:
> On Wed, May 1, 2013 at 10:48 PM, Robert Wilhelm <robert.wilhelm at gmx.net> wrote:
> > Thanks for the the hints. I really appreciate them.
> >
> > I have added ArrayRef ctor from "None" and replaced most  ArrayRef<T>()
> > calls with "None". Attached are two patches, one for llvm and one for
> > clang. I had to change two unrelated enums because of scope.
> 
> +    /// Construct an empty ArrayRef from None.
> +    ArrayRef(NoneType) : Data(0), Length(0) {}
> 
> Please add an /*implicit*/ annotation for consistency with other code nearby.
> 
> I think that MutableArrayRef should get a similar constructor as well.
>  (There are possible cleanups that involve MultiExprArg.)
> 
>      ParagraphComment *Paragraph = S.actOnParagraphComment(
> -                                ArrayRef<InlineContentComment *>());
> +                                None);
> 
> This should fit into a single line.
> 
> -    return setParamsAndSelLocs(C, Params, ArrayRef<SourceLocation>());
> +    return setParamsAndSelLocs(C, Params, llvm::None);
> 
> Why is llvm:: qualification needed here?  Is #include
> clang/Basic/LLVM.h missing?
> 
>                                     bool IsStringLocation, Range StringRange,
> -                            ArrayRef<FixItHint> Fixit = ArrayRef<FixItHint>());
> +                            ArrayRef<FixItHint> Fixit = None);
> 
> After this cleanup, indentation can be fixed.
> 
>      QualType R = Context.getFunctionType(FT->getResultType(),
> -                                         ArrayRef<QualType>(),
> +                                         None,
>                                           EPI);
> 
> This fits into a single line.
> 
> Dmitri
> 
> --
> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ArrayRef_None_clang2.patch
Type: text/x-patch
Size: 20299 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130504/d7c381a9/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ArrayRef_None2.patch
Type: text/x-patch
Size: 11422 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130504/d7c381a9/attachment-0001.bin>


More information about the cfe-commits mailing list