[PATCH] ArrayRef ctor from None

Dmitri Gribenko gribozavr at gmail.com
Fri May 3 08:13:19 PDT 2013


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>*/



More information about the cfe-commits mailing list