Changeset 332e93a for src/InitTweak


Ignore:
Timestamp:
Feb 4, 2025, 9:18:54 PM (12 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
090b076
Parents:
985ff5f (diff), 1ee74df (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/GenInit.cpp

    r985ff5f r332e93a  
    164164                                ast::ObjectDecl * arrayDimension = nullptr;
    165165
    166                                 const ast::TypeExpr * ty = dynamic_cast< const ast::TypeExpr * >( arrayType->dimension.get() );
    167                                 if ( ty ) {
     166                                if ( auto ty = dynamic_cast< const ast::TypeExpr * >( arrayType->dimension.get() ) ) {
    168167                                        auto inst = ty->type.as<ast::EnumInstType>();
    169                                         if ( inst ) {
    170                                                 if ( inst->base->isCfa ) {
    171                                                         arrayDimension = new ast::ObjectDecl(
     168                                        if ( inst && !inst->base->is_c_enum() ) {
     169                                                arrayDimension = new ast::ObjectDecl(
     170                                                        arrayType->dimension->location,
     171                                                        dimensionName.newName(),
     172                                                        new ast::BasicType( ast::BasicKind::UnsignedChar ),
     173                                                        new ast::SingleInit(
    172174                                                                arrayType->dimension->location,
    173                                                                 dimensionName.newName(),
    174                                                                 new ast::BasicType( ast::BasicKind::UnsignedChar ),
    175                                                                 new ast::SingleInit(
    176                                                                         arrayType->dimension->location,
    177                                                                         ast::ConstantExpr::from_int( arrayType->dimension->location, inst->base->members.size() )
    178                                                                 )
    179                                                         );
    180                                                         // return arrayType;
    181                                                 }
     175                                                                ast::ConstantExpr::from_int( arrayType->dimension->location, inst->base->members.size() )
     176                                                        )
     177                                                );
    182178                                        }
    183179                                }
Note: See TracChangeset for help on using the changeset viewer.