Changes in / [522363e:3e3d923]


Ignore:
Location:
src/Parser
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/ExpressionNode.cc

    r522363e r3e3d923  
    1010// Created On       : Sat May 16 13:17:07 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Sep 13 14:54:19 2017
    13 // Update Count     : 683
     12// Last Modified On : Thu Sep 14 23:09:34 2017
     13// Update Count     : 690
    1414//
    1515
     
    363363} // build_pfieldSel
    364364
    365 Expression * build_addressOf( ExpressionNode * expr_node ) {
    366         return new AddressExpr( maybeMoveBuild< Expression >(expr_node) );
    367 } // build_addressOf
    368 
    369 Expression * build_sizeOfexpr( ExpressionNode * expr_node ) {
    370         return new SizeofExpr( maybeMoveBuild< Expression >(expr_node) );
    371 } // build_sizeOfexpr
    372 
    373 Expression * build_sizeOftype( DeclarationNode * decl_node ) {
    374         return new SizeofExpr( maybeMoveBuildType( decl_node ) );
    375 } // build_sizeOftype
    376 
    377 Expression * build_alignOfexpr( ExpressionNode * expr_node ) {
    378         return new AlignofExpr( maybeMoveBuild< Expression >(expr_node) );
    379 } // build_alignOfexpr
    380 
    381 Expression * build_alignOftype( DeclarationNode * decl_node ) {
    382         return new AlignofExpr( maybeMoveBuildType( decl_node) );
    383 } // build_alignOftype
    384 
    385365Expression * build_offsetOf( DeclarationNode * decl_node, NameExpr * member ) {
    386366        Expression * ret = new UntypedOffsetofExpr( maybeMoveBuildType( decl_node ), member->get_name() );
     
    423403} // build_cond
    424404
    425 Expression * build_attrexpr( NameExpr * var, ExpressionNode * expr_node ) {
    426         return new AttrExpr( var, maybeMoveBuild< Expression >(expr_node) );
    427 } // build_attrexpr
    428 
    429 Expression * build_attrtype( NameExpr * var, DeclarationNode * decl_node ) {
    430         return new AttrExpr( var, maybeMoveBuildType( decl_node ) );
    431 } // build_attrtype
    432 
    433405Expression * build_tuple( ExpressionNode * expr_node ) {
    434406        list< Expression * > exprs;
     
    442414        return new UntypedExpr( maybeMoveBuild< Expression >(function), args, nullptr );
    443415} // build_func
    444 
    445 Expression * build_range( ExpressionNode * low, ExpressionNode * high ) {
    446         return new RangeExpr( maybeMoveBuild< Expression >( low ), maybeMoveBuild< Expression >( high ) );
    447 } // build_range
    448416
    449417Expression * build_compoundLiteral( DeclarationNode * decl_node, InitializerNode * kids ) {
  • src/Parser/ParseNode.h

    r522363e r3e3d923  
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Sep 13 12:35:10 2017
    13 // Update Count     : 807
     12// Last Modified On : Thu Sep 14 23:09:39 2017
     13// Update Count     : 815
    1414//
    1515
     
    175175Expression * build_fieldSel( ExpressionNode * expr_node, Expression * member );
    176176Expression * build_pfieldSel( ExpressionNode * expr_node, Expression * member );
    177 Expression * build_addressOf( ExpressionNode * expr_node );
    178 Expression * build_sizeOfexpr( ExpressionNode * expr_node );
    179 Expression * build_sizeOftype( DeclarationNode * decl_node );
    180 Expression * build_alignOfexpr( ExpressionNode * expr_node );
    181 Expression * build_alignOftype( DeclarationNode * decl_node );
    182177Expression * build_offsetOf( DeclarationNode * decl_node, NameExpr * member );
    183178Expression * build_and( ExpressionNode * expr_node1, ExpressionNode * expr_node2 );
     
    188183Expression * build_binary_ptr( OperKinds op, ExpressionNode * expr_node1, ExpressionNode * expr_node2 );
    189184Expression * build_cond( ExpressionNode * expr_node1, ExpressionNode * expr_node2, ExpressionNode * expr_node3 );
    190 Expression * build_attrexpr( NameExpr * var, ExpressionNode * expr_node );
    191 Expression * build_attrtype( NameExpr * var, DeclarationNode * decl_node );
    192185Expression * build_tuple( ExpressionNode * expr_node = nullptr );
    193186Expression * build_func( ExpressionNode * function, ExpressionNode * expr_node );
    194 Expression * build_range( ExpressionNode * low, ExpressionNode * high );
    195187Expression * build_compoundLiteral( DeclarationNode * decl_node, InitializerNode * kids );
    196188
  • src/Parser/parser.yy

    r522363e r3e3d923  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Sep 13 11:01:20 2017
    13 // Update Count     : 2803
     12// Last Modified On : Thu Sep 14 23:07:12 2017
     13// Update Count     : 2815
    1414//
    1515
     
    563563                        switch ( $1 ) {
    564564                          case OperKinds::AddressOf:
    565                                 $$ = new ExpressionNode( build_addressOf( $2 ) );
     565                                $$ = new ExpressionNode( new AddressExpr( maybeMoveBuild< Expression >( $2 ) ) );
    566566                                break;
    567567                          case OperKinds::PointTo:
     
    569569                                break;
    570570                          case OperKinds::And:
    571                                 $$ = new ExpressionNode( new AddressExpr( build_addressOf( $2 ) ) );
     571                                $$ = new ExpressionNode( new AddressExpr( new AddressExpr( maybeMoveBuild< Expression >( $2 ) ) ) );
    572572                                break;
    573573                          default:
     
    582582                { $$ = new ExpressionNode( build_unary_ptr( OperKinds::Decr, $2 ) ); }
    583583        | SIZEOF unary_expression
    584                 { $$ = new ExpressionNode( build_sizeOfexpr( $2 ) ); }
     584                { $$ = new ExpressionNode( new SizeofExpr( maybeMoveBuild< Expression >( $2 ) ) ); }
    585585        | SIZEOF '(' type_no_function ')'
    586                 { $$ = new ExpressionNode( build_sizeOftype( $3 ) ); }
     586                { $$ = new ExpressionNode( new SizeofExpr( maybeMoveBuildType( $3 ) ) ); }
    587587        | ALIGNOF unary_expression                                                      // GCC, variable alignment
    588                 { $$ = new ExpressionNode( build_alignOfexpr( $2 ) ); }
     588                { $$ = new ExpressionNode( new AlignofExpr( maybeMoveBuild< Expression >( $2 ) ) ); }
    589589        | ALIGNOF '(' type_no_function ')'                                      // GCC, type alignment
    590                 { $$ = new ExpressionNode( build_alignOftype( $3 ) ); }
     590                { $$ = new ExpressionNode( new AlignofExpr( maybeMoveBuildType( $3 ) ) ); }
    591591        | OFFSETOF '(' type_no_function ',' no_attr_identifier ')'
    592592                { $$ = new ExpressionNode( build_offsetOf( $3, build_varref( $5 ) ) ); }
    593593        | ATTR_IDENTIFIER
    594                 { $$ = new ExpressionNode( build_attrexpr( build_varref( $1 ), nullptr ) ); }
     594                { $$ = new ExpressionNode( new AttrExpr( build_varref( $1 ), maybeMoveBuild< Expression >( (ExpressionNode *)nullptr ) ) ); }
    595595        | ATTR_IDENTIFIER '(' argument_expression ')'
    596                 { $$ = new ExpressionNode( build_attrexpr( build_varref( $1 ), $3 ) ); }
     596                { $$ = new ExpressionNode( new AttrExpr( build_varref( $1 ), maybeMoveBuild< Expression >( $3 ) ) ); }
    597597        | ATTR_IDENTIFIER '(' type ')'
    598                 { $$ = new ExpressionNode( build_attrtype( build_varref( $1 ), $3 ) ); }
     598                { $$ = new ExpressionNode( new AttrExpr( build_varref( $1 ), maybeMoveBuildType( $3 ) ) ); }
    599599        ;
    600600
     
    895895        constant_expression                                                     { $$ = $1; }
    896896        | constant_expression ELLIPSIS constant_expression      // GCC, subrange
    897                 { $$ = new ExpressionNode( build_range( $1, $3 ) ); }
     897                { $$ = new ExpressionNode( new RangeExpr( maybeMoveBuild< Expression >( $1 ), maybeMoveBuild< Expression >( $3 ) ) ); }
    898898        | subrange                                                                                      // CFA, subrange
    899899        ;
     
    20892089                { $$ = $3; }
    20902090        | '[' push constant_expression ELLIPSIS constant_expression pop ']' // GCC, multiple array elements
    2091                 { $$ = new ExpressionNode( build_range( $3, $5 ) ); }
     2091                { $$ = new ExpressionNode( new RangeExpr( maybeMoveBuild< Expression >( $3 ), maybeMoveBuild< Expression >( $5 ) ) ); }
    20922092        | '.' '[' push field_list pop ']'                                       // CFA, tuple field selector
    20932093                { $$ = $4; }
     
    24072407subrange:
    24082408        constant_expression '~' constant_expression                     // CFA, integer subrange
    2409                 { $$ = new ExpressionNode( build_range( $1, $3 ) ); }
     2409                { $$ = new ExpressionNode( new RangeExpr( maybeMoveBuild< Expression >( $1 ), maybeMoveBuild< Expression >( $3 ) ) ); }
    24102410        ;
    24112411
Note: See TracChangeset for help on using the changeset viewer.