<p dir="ltr"><br>
On Jun 24, 2013 9:17 AM, "Jordan Rose" <<a href="mailto:jordan_rose@apple.com">jordan_rose@apple.com</a>> wrote:<br>
><br>
> Couldn't this create problems for very big positive enums, i.e. those larger than 2^63? </p>
<p dir="ltr">Yep, that's the 'still a problem' I mentioned.</p>
<p dir="ltr">> Not that this isn't strictly better than what we had before.</p>
<p dir="ltr">Actually its not strictly better - I traded off one valid range for another. It just happens to be the one we now get right is the same as GCC, which is nice. GCC and clang both get the case you mentioned wrong in different ways so far as I can tell.</p>
<p dir="ltr">><br>
><br>
> On Jun 24, 2013, at 0:13 , David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br>
><br>
> > Author: dblaikie<br>
> > Date: Mon Jun 24 02:13:13 2013<br>
> > New Revision: 184695<br>
> ><br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project?rev=184695&view=rev">http://llvm.org/viewvc/llvm-project?rev=184695&view=rev</a><br>
> > Log:<br>
> > DebugInfo: ensure negative enumerators are emitted as such<br>
> ><br>
> > There's still a problem here - since we're not appropriately using the<br>
> > signedness/range of the enum to chooset the encoding and emission of<br>
> > enumerators, but GCC has some bugs around this too so I assume that's<br>
> > not /such/ a high priority though I may get to it soon out of<br>
> > completeness.<br>
> ><br>
> > Modified:<br>
> > cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br>
> > cfe/trunk/test/CodeGenCXX/debug-info-enum.cpp<br>
> ><br>
> > Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=184695&r1=184694&r2=184695&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=184695&r1=184694&r2=184695&view=diff</a><br>
> > ==============================================================================<br>
> > --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)<br>
> > +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Jun 24 02:13:13 2013<br>
> > @@ -1803,7 +1803,7 @@ llvm::DIType CGDebugInfo::CreateEnumType<br>
> > Enum != EnumEnd; ++Enum) {<br>
> > Enumerators.push_back(<br>
> > DBuilder.createEnumerator(Enum->getName(),<br>
> > - Enum->getInitVal().getZExtValue()));<br>
> > + Enum->getInitVal().getSExtValue()));<br>
> > }<br>
> ><br>
> > // Return a CompositeType for the enum itself.<br>
> ><br>
> > Modified: cfe/trunk/test/CodeGenCXX/debug-info-enum.cpp<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-enum.cpp?rev=184695&r1=184694&r2=184695&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-enum.cpp?rev=184695&r1=184694&r2=184695&view=diff</a><br>
> > ==============================================================================<br>
> > --- cfe/trunk/test/CodeGenCXX/debug-info-enum.cpp (original)<br>
> > +++ cfe/trunk/test/CodeGenCXX/debug-info-enum.cpp Mon Jun 24 02:13:13 2013<br>
> > @@ -1,7 +1,7 @@<br>
> > // RUN: %clang_cc1 -emit-llvm -g %s -o - | FileCheck %s<br>
> ><br>
> > // CHECK: [[ENUMS:![0-9]*]], {{[^,]*}}, {{[^,]*}}, {{[^,]*}}, {{[^,]*}}, {{[^,]*}}} ; [ DW_TAG_compile_unit ]<br>
> > -// CHECK: [[ENUMS]] = metadata !{metadata [[E1:![0-9]*]], metadata [[E2:![0-9]*]]}<br>
> > +// CHECK: [[ENUMS]] = metadata !{metadata [[E1:![0-9]*]], metadata [[E2:![0-9]*]], metadata [[E3:![0-9]*]]}<br>
> ><br>
> > namespace test1 {<br>
> > // CHECK: [[E1]] = metadata !{i32 {{[^,]*}}, {{[^,]*}}, metadata [[TEST1:![0-9]*]], {{.*}}, metadata [[TEST1_ENUMS:![0-9]*]], {{[^,]*}}, {{[^,]*}}} ; [ DW_TAG_enumeration_type ] [e]<br>
> > @@ -23,3 +23,14 @@ bool func(int i) {<br>
> > return i == E;<br>
> > }<br>
> > }<br>
> > +<br>
> > +namespace test3 {<br>
> > +// CHECK: [[E3]] = metadata !{i32 {{[^,]*}}, {{[^,]*}}, metadata [[TEST3:![0-9]*]], {{.*}}, metadata [[TEST3_ENUMS:![0-9]*]], {{[^,]*}}, {{[^,]*}}} ; [ DW_TAG_enumeration_type ] [e]<br>
> > +// CHECK: [[TEST3]] = {{.*}} ; [ DW_TAG_namespace ] [test3]<br>
> > +// CHECK: [[TEST3_ENUMS]] = metadata !{metadata [[TEST3_E:![0-9]*]]}<br>
> > +// CHECK: [[TEST3_E]] = {{.*}}, metadata !"E", i64 -1} ; [ DW_TAG_enumerator ] [E :: -1]<br>
> > +enum e { E = -1 };<br>
> > +void func() {<br>
> > + e x;<br>
> > +}<br>
> > +}<br>
> ><br>
> ><br>
> > _______________________________________________<br>
> > cfe-commits mailing list<br>
> > <a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
> > <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
><br>
</p>