Changeset 7f3f63c


Ignore:
Timestamp:
May 10, 2019, 2:46:27 PM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
04124c4
Parents:
b96d7c1
Message:

Unions now correctly use bitfields from previous commit

Location:
src/AST
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/AST/FunctionSpec.hpp

    rb96d7c1 r7f3f63c  
    3131
    3232        /// Bitflag type for storage classes
    33         union Specs {
    34                 unsigned int val;
    35                 struct {
    36                         bool is_inline   : 1;
    37                         bool is_noreturn : 1;
    38                         bool is_fortran  : 1;
     33        struct spec_flags {
     34                union {
     35                        unsigned int val;
     36                        struct {
     37                                bool is_inline   : 1;
     38                                bool is_noreturn : 1;
     39                                bool is_fortran  : 1;
     40                        };
     41
     42                        // MakeBitfieldPrint( NumSpecs )
    3943                };
    4044
    41                 MakeBitfield( Specs )
    42                 MakeBitfieldPrint( NumSpecs )
     45                constexpr spec_flags( unsigned int val ) : val(val) {}
    4346        };
    4447
     48        using Specs = bitfield<spec_flags>;
    4549}
    4650}
  • src/AST/LinkageSpec.hpp

    rb96d7c1 r7f3f63c  
    3535
    3636        /// Bitflag type for storage classes
    37         union Spec {
    38                 unsigned int val;
    39                 struct {
    40                         bool is_mangled      : 1;
    41                         bool is_generatable  : 1;
    42                         bool is_overrideable : 1;
    43                         bool is_builtin      : 1;
    44                         bool is_gcc_builtin  : 1;
     37        struct spec_flags {
     38                union {
     39                        unsigned int val;
     40                        struct {
     41                                bool is_mangled      : 1;
     42                                bool is_generatable  : 1;
     43                                bool is_overrideable : 1;
     44                                bool is_builtin      : 1;
     45                                bool is_gcc_builtin  : 1;
     46                        };
    4547                };
    4648
    47                 MakeBitfield( Spec )
     49                constexpr spec_flags( unsigned int val ) : val(val) {}
    4850        };
     51
     52        using Spec = bitfield<spec_flags>;
    4953
    5054        /// If `cmd` = "C" returns `spec` with `is_mangled = false`.
  • src/AST/StorageClasses.hpp

    rb96d7c1 r7f3f63c  
    3333
    3434        /// Bitflag type for storage classes
    35         union Classes {
    36                 unsigned int val;
    37                 struct {
    38                         bool is_extern      : 1;
    39                         bool is_static      : 1;
    40                         bool is_auto        : 1;
    41                         bool is_register    : 1;
    42                         bool is_threadlocal : 1;
     35        struct class_flags {
     36                union {
     37                        unsigned int val;
     38                        struct {
     39                                bool is_extern      : 1;
     40                                bool is_static      : 1;
     41                                bool is_auto        : 1;
     42                                bool is_register    : 1;
     43                                bool is_threadlocal : 1;
     44                        };
     45
     46                        // MakeBitfieldPrint( NumClasses )
    4347                };
    4448
    45                 MakeBitfield( Classes )
    46                 MakeBitfieldPrint( NumClasses )
     49                constexpr class_flags( unsigned int val ) : val(val) {}
    4750        };
    4851
     52        using Classes = bitfield<class_flags>;
    4953}
    5054}
Note: See TracChangeset for help on using the changeset viewer.