[PATCH] D23766: DebugInfo: introduce DIFlagsUnderlying type for debug info flags

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 29 11:35:03 PDT 2016


Justin - didn't you, or someone, play around with making a utility for
enums that represent flags to work more betterer?

On Mon, Aug 29, 2016 at 11:31 AM Victor <vleschuk at gmail.com> wrote:

> vleschuk added a comment.
>
> In https://reviews.llvm.org/D23766#528004, @dblaikie wrote:
>
> > Why is it that we aren't just using teh DIFlags type directly everywhere
> we are currently using unsigned (everywhere you're changing to
> DIFlagsUnderlying)?
>
>
> Because constructions like the following do not compile
>
>   enum DIFlags: uint32_t
>   {
>       Flag1 = 1,
>       Flag2 = 1 << 2,
>       Flag3 = 1 << 3,
>   };
>
>   // ....
>
>   DIFlags Flags = Flag1 | Flag2; // expression (Flag1 | Flag2) isn't
> DIFlags, it results in underlying type
>
>
>
>   clang++ -std=c++11 t.cpp -o t
>   t.cpp:12:13: error: cannot initialize a variable of type 'DIFlags' with
> an rvalue of type 'unsigned int'
>       DIFlags Flags = Flag1 | Flag2;
>               ^       ~~~~~~~~~~~~~
>   1 error generated.
>
>
> https://reviews.llvm.org/D23766
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160829/c64e0c9d/attachment.html>


More information about the llvm-commits mailing list