[llvm] r226570 - IR: Store StorageType as an unsigned bitfield

Benjamin Kramer benny.kra at gmail.com
Tue Jan 20 08:00:09 PST 2015


> On 20.01.2015, at 16:51, Duncan P. N. Exon Smith <dexonsmith at apple.com> wrote:
> 
> Author: dexonsmith
> Date: Tue Jan 20 09:51:14 2015
> New Revision: 226570
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=226570&view=rev
> Log:
> IR: Store StorageType as an unsigned bitfield
> 
> Use `unsigned` instead of `StorageType` for the bitfield to prevent MSVC
> from treating the top bit of the bitfield as a sign bit.

Can you just give the enum a type? Losing type information this way is really ugly and not needed in the C++11 days.

- Ben

> 
> Modified:
>    llvm/trunk/include/llvm/IR/Metadata.h
> 
> Modified: llvm/trunk/include/llvm/IR/Metadata.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Metadata.h?rev=226570&r1=226569&r2=226570&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/IR/Metadata.h (original)
> +++ llvm/trunk/include/llvm/IR/Metadata.h Tue Jan 20 09:51:14 2015
> @@ -51,7 +51,7 @@ protected:
>   enum StorageType { Uniqued, Distinct, Temporary };
> 
>   /// \brief Storage flag for non-uniqued, otherwise unowned, metadata.
> -  StorageType Storage : 2;
> +  unsigned Storage : 2;
>   // TODO: expose remaining bits to subclasses.
> 
>   unsigned short SubclassData16;
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits





More information about the llvm-commits mailing list