Changeset d9bad51 for src


Ignore:
Timestamp:
Apr 4, 2024, 2:37:10 PM (9 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Children:
af746cc, b6a71bc, cb98d9d
Parents:
1cfe640
Message:

Fixed memory leak in the parser.

Location:
src/Parser
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    r1cfe640 rd9bad51  
    225225} // DeclarationNode::newEnumValueGeneric
    226226
    227 DeclarationNode * DeclarationNode::newEnumInLine( const string name ) {
    228         DeclarationNode * newnode = newName( new std::string(name) );
     227DeclarationNode * DeclarationNode::newEnumInLine( const std::string * name ) {
     228        DeclarationNode * newnode = newName( name );
    229229        newnode->enumInLine = true;
    230230        return newnode;
  • src/Parser/DeclarationNode.h

    r1cfe640 rd9bad51  
    3030        static DeclarationNode * newEnumConstant( const std::string * name, ExpressionNode * constant );
    3131        static DeclarationNode * newEnumValueGeneric( const std::string * name, InitializerNode * init );
    32         static DeclarationNode * newEnumInLine( const std::string name );
     32        static DeclarationNode * newEnumInLine( const std::string * name );
    3333        static DeclarationNode * newName( const std::string * );
    3434        static DeclarationNode * newTypeParam( ast::TypeDecl::Kind, const std::string * );
  • src/Parser/parser.yy

    r1cfe640 rd9bad51  
    28152815                { $$ = DeclarationNode::newEnumValueGeneric( $2, $3 ); }
    28162816        | INLINE type_name
    2817                 { $$ = DeclarationNode::newEnumInLine( *$2->symbolic.name ); }
     2817                {
     2818                        $$ = DeclarationNode::newEnumInLine( $2->symbolic.name );
     2819                        $2->symbolic.name = nullptr;
     2820                        delete $2;
     2821                }
    28182822        | enumerator_list ',' visible_hide_opt identifier_or_type_name enumerator_value_opt
    28192823                { $$ = $1->set_last( DeclarationNode::newEnumValueGeneric( $4, $5 ) ); }
Note: See TracChangeset for help on using the changeset viewer.