Ignore:
Timestamp:
Mar 21, 2022, 3:51:57 PM (2 years ago)
Author:
JiadaL <j82liang@…>
Branches:
ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
Children:
7a486f4a
Parents:
4390fb6
Message:

Fix the missing pieces in codeGen

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    r4390fb6 r32fc0d6  
    197197                if ( objectDecl->isDeleted && options.genC ) return;
    198198
    199                 // objectDecl->checkAssignedValue();
    200                 /* Temporary add the enum check here; need a better location */
    201                 // {
    202                 //      EnumInstType * enumTypePtr = dynamic_cast< EnumInstType *>(objectDecl->get_type());
    203                 //      if (enumTypePtr) {
    204                 //              EnumDecl * enumBase = enumTypePtr -> baseEnum;
    205                 //              if ( enumTypePtr && enumBase->base ) {
    206                 //                      std::list< Declaration * > & enumMembers = enumBase->get_members();
    207                 //                      auto in_enum = [&]( Declaration * enumMem ) -> bool {
    208                 //                              ObjectDecl * obj = dynamic_cast< ObjectDecl* >( enumMem );
    209                 //                              if ( mangleName( obj ) == mangleName( objectDecl ) ) {
    210                 //                                      return true;
    211                 //                              }
    212                 //                              return false;
    213                 //                      };
    214                 //                      if ( std::find_if( enumMembers.begin(), enumMembers.end(), in_enum ) == enumMembers.end() ) {
    215                 //                              output<< "/* Cannot assign a Non-enum member value to a typed enum variable. */" ;
    216                 //                      }
    217                                
    218                 //              }
    219                 //      }
    220                        
    221                 // }
    222 
    223199                // gcc allows an empty declarator (no name) for bit-fields and C states: 6.7.2.1 Structure and union specifiers,
    224200                // point 4, page 113: If the (bit field) value is zero, the declaration shall have no declarator.  For anything
     
    302278                if (enumDecl->base && ! memb.empty() &&
    303279                (dynamic_cast<BasicType *>(enumDecl->base)
    304                  && !dynamic_cast<BasicType *>(enumDecl->base)->kind == BasicType::Kind::SignedInt)) {
     280                 && !(dynamic_cast<BasicType *>(enumDecl->base)->kind == BasicType::Kind::SignedInt))) {
    305281                        ObjectDecl * last = nullptr;
    306282                        for ( std::list< Declaration* >::iterator i = memb.begin(); i != memb.end();  i++) {
Note: See TracChangeset for help on using the changeset viewer.