Changeset 45ee172


Ignore:
Timestamp:
Aug 23, 2024, 10:44:14 AM (3 hours ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Parents:
cc0aa8c
Message:

Corrected handling of va_args in the parser. It still does not get through the resolver and further updates may be required.

Location:
src/Parser
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/ExpressionNode.cpp

    rcc0aa8c r45ee172  
    99// Author           : Peter A. Buhr
    1010// Created On       : Sat May 16 13:17:07 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Dec 14 18:57:07 2023
    13 // Update Count     : 1087
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Fri Aug 23 10:22:00 2024
     13// Update Count     : 1088
    1414//
    1515
     
    780780} // build_compoundLiteral
    781781
     782ast::Expr * build_va_arg( const CodeLocation & location,
     783                ExpressionNode * function, DeclarationNode * declaration ) {
     784        return build_func( location,
     785                new ExpressionNode(
     786                        build_varref( location, new std::string( "__builtin_va_arg" ) ) ),
     787                function->set_last( new ExpressionNode( new ast::TypeExpr( location,
     788                        maybeMoveBuildType( declaration ) ) ) )
     789        );
     790}
     791
    782792// Local Variables: //
    783793// tab-width: 4 //
  • src/Parser/ExpressionNode.hpp

    rcc0aa8c r45ee172  
    8383ast::Expr * build_func( const CodeLocation &, ExpressionNode * function, ExpressionNode * expr_node );
    8484ast::Expr * build_compoundLiteral( const CodeLocation &, DeclarationNode * decl_node, InitializerNode * kids );
     85ast::Expr * build_va_arg( const CodeLocation &, ExpressionNode * function, DeclarationNode * type );
    8586
    8687ast::Expr * build_enum_pos_expr( const CodeLocation &, ast::Expr * expr_node );
  • src/Parser/parser.yy

    rcc0aa8c r45ee172  
    792792                { $$ = new ExpressionNode( build_func( yylloc, $1, $3 ) ); }
    793793        | VA_ARG '(' primary_expression ',' declaration_specifier_nobody abstract_parameter_declarator_opt ')'
    794                 // { SemanticError( yylloc, "va_arg is currently unimplemented." ); $$ = nullptr; }
    795                 { $$ = new ExpressionNode( build_func( yylloc, new ExpressionNode( build_varref( yylloc, new string( "__builtin_va_arg" ) ) ),
    796                                                                                            $3->set_last( (ExpressionNode *)($6 ? $6->addType( $5 ) : $5) ) ) ); }
     794                { $$ = new ExpressionNode( build_va_arg( yylloc, $3, ( $6 ? $6->addType( $5 ) : $5 ) ) ); }
    797795        | postfix_expression '`' identifier                                     // CFA, postfix call
    798796                { $$ = new ExpressionNode( build_func( yylloc, new ExpressionNode( build_varref( yylloc, build_postfix_name( $3 ) ) ), $1 ) ); }
Note: See TracChangeset for help on using the changeset viewer.