[PATCH] Use ArrayRef in SemaInit.cpp.

David Blaikie dblaikie at gmail.com
Tue Apr 30 13:00:53 PDT 2013


On Tue, Apr 30, 2013 at 12:45 PM, Sean Silva <silvas at purdue.edu> wrote:
>
> On Tue, Apr 30, 2013 at 1:55 PM, David Blaikie <dblaikie at gmail.com> wrote:
>>
>> * should we consider adding an ArrayRef implicit ctor from "None"?
>> (see llvm/ADT/None.h and its use in llvm/ADT/Optional.h) Then you
>> could replace all the "ArrayRef<T>()" calls with "None" (you might
>> even want to do a sed replace on existing instances of this as a
>> separate patch (a purely mechanical patch is easy to review/apply)).
>
>
> What's wrong with `ArrayRef<T>()`? It's explicit and clear. What is the
> benefit of writing `None` instead? IMHO if I saw "None" that would just
> confuse me and send me on a wild goose chase that would eventually terminate
> on finding the implicit ArrayRef ctor and then saying to myself "why the
> heck didn't they just write `ArrayRef<T>`"?

Less verbose & avoids repeating the element type (same reason as
makeArrayRef). Alternatively, I suppose we could have a simple
"makeArrayRef" that takes no args & produces NoneType or similar (&
thus can be implicitly converted to an empty ArrayRef).



More information about the cfe-commits mailing list