<p dir="ltr"><br>
On Feb 20, 2015 4:26 AM, "Andrea Di Biagio" <<a href="mailto:andrea.dibiagio@gmail.com">andrea.dibiagio@gmail.com</a>> wrote:<br>
><br>
> Hi Justin,<br>
><br>
> Just for your info. After this change I get tons of new warnings<br>
> because of ‘llvm::None’ defined but not used [-Wunused-variable].<br>
><br>
> Example:<br>
><br>
> In file included from llvm/include/llvm/ADT/ArrayRef.h:13:0,<br>
>                  llvm/include/llvm/ADT/APInt.h:19,<br>
>                  llvm/include/llvm/ADT/APFloat.h:20,<br>
>                  llvm/lib/Support/APFloat.cpp:15:<br>
> llvm/include/llvm/ADT/None.h:23:17: warning: ‘llvm::None’ defined but<br>
> not used [-Wunused-variable]<br>
>  static NoneType None;<br>
>                  ^</p>
<p dir="ltr">Attribute unused? (Used?) I never remember which.</p>
<p dir="ltr">We should check the constexpr rules/option perhaps.</p>
<p dir="ltr">><br>
> I am using gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1).<br>
><br>
> -Andrea<br>
><br>
> On Fri, Feb 20, 2015 at 7:28 AM, Justin Bogner <<a href="mailto:mail@justinbogner.com">mail@justinbogner.com</a>> wrote:<br>
> > Author: bogner<br>
> > Date: Fri Feb 20 01:28:28 2015<br>
> > New Revision: 229980<br>
> ><br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project?rev=229980&view=rev">http://llvm.org/viewvc/llvm-project?rev=229980&view=rev</a><br>
> > Log:<br>
> > Disallow implicit conversions from None to integer types<br>
> ><br>
> > This fixes an error introduced in r228934 where None was converted to<br>
> > an int instead of the int being converted to an Optional as intended.<br>
> > We make that sort of mistake a compile error by changing NoneType into<br>
> > a scoped enum.<br>
> ><br>
> > Finally, provide a static NoneType called None to avoid forcing all<br>
> > users to spell it NoneType::None.<br>
> ><br>
> > Modified:<br>
> >     llvm/trunk/include/llvm/ADT/None.h<br>
> >     llvm/trunk/lib/ProfileData/CoverageMapping.cpp<br>
> ><br>
> > Modified: llvm/trunk/include/llvm/ADT/None.h<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/None.h?rev=229980&r1=229979&r2=229980&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/None.h?rev=229980&r1=229979&r2=229980&view=diff</a><br>
> > ==============================================================================<br>
> > --- llvm/trunk/include/llvm/ADT/None.h (original)<br>
> > +++ llvm/trunk/include/llvm/ADT/None.h Fri Feb 20 01:28:28 2015<br>
> > @@ -19,9 +19,8 @@<br>
> >  namespace llvm {<br>
> >  /// \brief A simple null object to allow implicit construction of Optional<T><br>
> >  /// and similar types without having to spell out the specialization's name.<br>
> > -enum NoneType {<br>
> > -  None<br>
> > -};<br>
> > +enum class NoneType { None };<br>
> > +static NoneType None;<br>
> >  }<br>
> ><br>
> >  #endif<br>
> ><br>
> > Modified: llvm/trunk/lib/ProfileData/CoverageMapping.cpp<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/CoverageMapping.cpp?rev=229980&r1=229979&r2=229980&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/CoverageMapping.cpp?rev=229980&r1=229979&r2=229980&view=diff</a><br>
> > ==============================================================================<br>
> > --- llvm/trunk/lib/ProfileData/CoverageMapping.cpp (original)<br>
> > +++ llvm/trunk/lib/ProfileData/CoverageMapping.cpp Fri Feb 20 01:28:28 2015<br>
> > @@ -361,7 +361,9 @@ static Optional<unsigned> findMainViewFi<br>
> >        IsNotExpandedFile[CR.ExpandedFileID] = false;<br>
> >    IsNotExpandedFile &= FilenameEquivalence;<br>
> >    int I = IsNotExpandedFile.find_first();<br>
> > -  return I != -1 ? I : None;<br>
> > +  if (I == -1)<br>
> > +    return None;<br>
> > +  return I;<br>
> >  }<br>
> ><br>
> >  static Optional<unsigned> findMainViewFileID(const FunctionRecord &Function) {<br>
> > @@ -370,7 +372,9 @@ static Optional<unsigned> findMainViewFi<br>
> >      if (CR.Kind == CounterMappingRegion::ExpansionRegion)<br>
> >        IsNotExpandedFile[CR.ExpandedFileID] = false;<br>
> >    int I = IsNotExpandedFile.find_first();<br>
> > -  return I != -1 ? I : None;<br>
> > +  if (I == -1)<br>
> > +    return None;<br>
> > +  return I;<br>
> >  }<br>
> ><br>
> >  /// Sort a nested sequence of regions from a single file.<br>
> ><br>
> ><br>
> > _______________________________________________<br>
> > llvm-commits mailing list<br>
> > <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> > <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</p>