Changeset b6f2e7ab for src/Parser


Ignore:
Timestamp:
Sep 9, 2024, 5:15:32 PM (2 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Children:
f5dbc8d
Parents:
5c6d439
Message:

Removed SizeofExpr::expr and AlignofExpr::expr, expressions that would be stored there are wrapped in TypeofType? and stored in the type field. Some special cases to hide the typeof in code generation were added. In addition, initializer length is calculated in more cases so that the full type of more arrays is known sooner. Other than that, most of the code changes were just stripping out the conditional code and checks no longer needed. Some tests had to be updated, because the typeof is not hidden in dumps and the resolver replaces known typeof expressions with the type. The extension case caused some concern but it appears that just hides warnings in the expression which no longer exists.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r5c6d439 rb6f2e7ab  
    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.