[llvm] r230010 - Make the static instance of None just const.

Sean Silva chisophugis at gmail.com
Fri Feb 20 16:08:22 PST 2015


On Fri, Feb 20, 2015 at 9:10 AM, David Blaikie <dblaikie at gmail.com> wrote:

>
>
> On Fri, Feb 20, 2015 at 5:16 AM, Benjamin Kramer <benny.kra at googlemail.com
> > wrote:
>
>> Author: d0k
>> Date: Fri Feb 20 07:16:05 2015
>> New Revision: 230010
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=230010&view=rev
>> Log:
>> Make the static instance of None just const.
>>
>> This way there shouldn't be any unused variable warnings.
>>
>> Modified:
>>     llvm/trunk/include/llvm/ADT/None.h
>>
>> Modified: llvm/trunk/include/llvm/ADT/None.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/None.h?rev=230010&r1=230009&r2=230010&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/include/llvm/ADT/None.h (original)
>> +++ llvm/trunk/include/llvm/ADT/None.h Fri Feb 20 07:16:05 2015
>> @@ -20,7 +20,7 @@ namespace llvm {
>>  /// \brief A simple null object to allow implicit construction of
>> Optional<T>
>>  /// and similar types without having to spell out the specialization's
>> name.
>>  enum class NoneType { None };
>>
>
> At this point NoneType could just be an opaque/trivial struct instead of
> an enum class?
>

I seem to recall a discussion where an empty init list was suggested as a
replacement for None?

... digging ...

Not really. I guess what John suggested here was sort of array-specific:
"[PATCH] Use ArrayRef in SemaInit.cpp." (
http://thread.gmane.org/gmane.comp.compilers.clang.scm/72201)

-- Sean Silva


>
>
>> -static NoneType None;
>> +const NoneType None = None;
>>
>
> Does this result in ODR violations? (either because None is not defined in
> the program at all and it is ODR used, or because this is a definition (?)
> and it's in multiple translation units? - I always forget which)
>
>
>>  }
>>
>>  #endif
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150220/1f13d35c/attachment.html>


More information about the llvm-commits mailing list