Changeset d191e24 for src/Parser


Ignore:
Timestamp:
Oct 19, 2022, 5:29:12 PM (3 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, ast-experimental, master
Children:
bc899d6
Parents:
82ff4ed1 (diff), 058ece2 (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

Location:
src/Parser
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    r82ff4ed1 rd191e24  
    297297        } // if
    298298} // DeclarationNode::newEnumValueGeneric
     299
     300DeclarationNode * DeclarationNode::newEnumInLine( const string name ) {
     301        DeclarationNode * newnode = newName( new std::string(name) );
     302        newnode->enumInLine = true;
     303        return newnode;
     304}
    299305
    300306DeclarationNode * DeclarationNode::newFromTypedef( const string * name ) {
  • src/Parser/ExpressionNode.cc

    r82ff4ed1 rd191e24  
    523523                auto enumInst = new EnumInstType( Type::Qualifiers(), e );
    524524                auto obj = new ObjectDecl( name->name, Type::StorageClasses(), LinkageSpec::Cforall, nullptr, enumInst, nullptr );
    525                 ret->set_var( obj );
    526525        }
    527526        return ret;
  • src/Parser/ParseNode.h

    r82ff4ed1 rd191e24  
    240240        static DeclarationNode * newEnumConstant( const std::string * name, ExpressionNode * constant );
    241241        static DeclarationNode * newEnumValueGeneric( const std::string * name, InitializerNode * init );
     242        static DeclarationNode * newEnumInLine( const std::string name );
    242243        static DeclarationNode * newName( const std::string * );
    243244        static DeclarationNode * newFromTypeGen( const std::string *, ExpressionNode * params );
     
    339340
    340341        bool inLine = false;
     342        bool enumInLine = false;
    341343        Type::FuncSpecifiers funcSpecs;
    342344        Type::StorageClasses storageClasses;
  • src/Parser/TypeData.cc

    r82ff4ed1 rd191e24  
    924924        list< Declaration * >::iterator members = ret->get_members().begin();
    925925        for ( const DeclarationNode * cur = td->enumeration.constants; cur != nullptr; cur = dynamic_cast< DeclarationNode * >( cur->get_next() ), ++members ) {
     926                if ( cur->enumInLine ) {
     927                        // Tell the compiler this is a inline value placeholder
     928                        ObjectDecl * member = dynamic_cast< ObjectDecl* >(* members);
     929                        member->enumInLine = true;
     930                }
    926931                if ( ret->isTyped && !ret->base && cur->has_enumeratorValue() ) {
    927932                        SemanticError( td->location, "Enumerator of enum(void) cannot have an explicit initializer value." );
  • src/Parser/parser.yy

    r82ff4ed1 rd191e24  
    26052605                { $$ = DeclarationNode::newEnumValueGeneric( $1, $2 ); }
    26062606        | INLINE type_name
    2607                 { $$ = DeclarationNode::newEnumValueGeneric( new string("inline"), nullptr ); }
     2607                { $$ = DeclarationNode::newEnumInLine( *$2->type->symbolic.name ); }
    26082608        | enumerator_list ',' identifier_or_type_name enumerator_value_opt
    26092609                { $$ = $1->appendList( DeclarationNode::newEnumValueGeneric( $3, $4 ) ); }
Note: See TracChangeset for help on using the changeset viewer.