Changeset 3d618a0 for src/Parser


Ignore:
Timestamp:
Sep 9, 2024, 6:16:09 PM (13 months ago)
Author:
JiadaL <j82liang@…>
Branches:
master
Children:
aa14aafe
Parents:
d93b813 (diff), f5dbc8d (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:
3 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/StatementNode.cpp

    rd93b813 r3d618a0  
    1111// Created On       : Sat May 16 14:59:41 2015
    1212// Last Modified By : Peter A. Buhr
    13 // Last Modified On : Fri Aug 11 11:44:15 2023
    14 // Update Count     : 429
     13// Last Modified On : Mon Sep  9 11:28:07 2024
     14// Update Count     : 430
    1515//
    1616
     
    208208
    209209ast::Stmt * build_for( const CodeLocation & location, ForCtrl * forctl, StatementNode * stmt, StatementNode * else_ ) {
    210         std::vector<ast::ptr<ast::Stmt>> astinit;                                               // maybe empty
     210        std::vector<ast::ptr<ast::Stmt>> astinit;                       // maybe empty
    211211        buildMoveList( forctl->init, astinit );
    212212
    213213        if ( forctl->range_over ) {
    214214                ast::Expr * range_over = maybeMoveBuild( forctl->range_over );
     215                auto kind = forctl->kind;                                               // save before delete, used in return
    215216                delete forctl;
    216217                return new ast::ForStmt( location,
    217218                        std::move( astinit ),
    218                         range_over, forctl->kind == OperKinds::LEThan,
     219                        range_over, kind == OperKinds::LEThan,
    219220                        buildMoveSingle( stmt ),
    220221                        buildMoveOptional( else_ )
  • src/Parser/TypeData.cpp

    rd93b813 r3d618a0  
    14761476                } else if ( cur->has_enumeratorValue() ) {
    14771477                        ast::Expr * initValue;
    1478                         if (ret->isCfa && ret->base) {
    1479                                 initValue = new ast::CastExpr( cur->enumeratorValue->location, maybeMoveBuild( cur->consume_enumeratorValue() ), ret->base  );
     1478                        if ( ret->isCfa && ret->base ) {
     1479                                CodeLocation location = cur->enumeratorValue->location;
     1480                                initValue = new ast::CastExpr( location, maybeMoveBuild( cur->consume_enumeratorValue() ), ret->base );
    14801481                        } else {
    14811482                                initValue = maybeMoveBuild( cur->consume_enumeratorValue() );
  • src/Parser/parser.yy

    rd93b813 r3d618a0  
    927927                { $$ = new ExpressionNode( build_unary_val( yylloc, OperKinds::Decr, $2 ) ); }
    928928        | SIZEOF unary_expression
    929                 { $$ = new ExpressionNode( new ast::SizeofExpr( yylloc, maybeMoveBuild( $2 ) ) ); }
     929                { $$ = new ExpressionNode( new ast::SizeofExpr( yylloc, new ast::TypeofType( maybeMoveBuild( $2 ) ) ) ); }
    930930        | SIZEOF '(' type_no_function ')'
    931931                { $$ = new ExpressionNode( new ast::SizeofExpr( yylloc, maybeMoveBuildType( $3 ) ) ); }
    932932        | ALIGNOF unary_expression                                                      // GCC, variable alignment
    933                 { $$ = new ExpressionNode( new ast::AlignofExpr( yylloc, maybeMoveBuild( $2 ) ) ); }
     933                { $$ = new ExpressionNode( new ast::AlignofExpr( yylloc, new ast::TypeofType( maybeMoveBuild( $2 ) ) ) ); }
    934934        | ALIGNOF '(' type_no_function ')'                                      // GCC, type alignment
    935935                { $$ = new ExpressionNode( new ast::AlignofExpr( yylloc, maybeMoveBuildType( $3 ) ) ); }
Note: See TracChangeset for help on using the changeset viewer.