[PATCH] D23766: DebugInfo: use strongly typed enum for debug info flags
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 30 14:33:44 PDT 2016
On Tue, Aug 30, 2016 at 2:25 PM Victor <vleschuk at gmail.com> wrote:
> vleschuk added inline comments.
> Comment at: include/llvm/IR/DebugInfoMetadata.h:183
> @@ -180,2 +182,3 @@
> + typedef std::underlying_type<DIFlags>::type DIFlagsUnderlying;
> dblaikie wrote:
> > I'm assuming we don't need DIFlagsUnderlying anymore? Can we just use
> DIFlags everywhere?
> Nope. For example see updated ::get definitions in classes derived from
> (unsigned Tag, MDString *Name, Metadata *File,
> unsigned Line, Metadata *Scope, Metadata *BaseType,
> uint64_t SizeInBits, uint64_t AlignInBits,
> uint64_t OffsetInBits, **DIFlagsUnderlying** Flags,
> Metadata *ExtraData = nullptr),
> (Tag, Name, File, Line, Scope, BaseType, SizeInBits,
> AlignInBits, OffsetInBits,
> **static_cast<DIFlags>(Flags)**, ExtraData))
> This helps to avoid lots of static_casts in client code. Also some utility
> functions like splitFlags require this underlying type to process bitmasks
> which can consist not only of enumerated flags.
> In other words, this typedef is used in order not to break old code and
> avoid lots of code rewriting.
It'd be nice to do the cleanup - some of it could be done ahead of this
change, I assume (to keep it separate). Rather than having all this
supported for the previous use case.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-commits