Changeset ad47ec4 for src/Parser
- Timestamp:
- Aug 29, 2024, 2:38:39 PM (14 months ago)
- Branches:
- master
- Children:
- 9bb6c5f
- Parents:
- 960665c (diff), b965774 (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. - Location:
- src/Parser
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/DeclarationNode.cpp
r960665c rad47ec4 10 10 // Created On : Sat May 16 12:34:05 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Feb 23 18:25:57 202413 // Update Count : 15 3312 // Last Modified On : Thu Aug 22 14:11:47 2024 13 // Update Count : 1555 14 14 // 15 15 … … 134 134 os << endl << string( indent + 2, ' ' ) << "with initializer "; 135 135 initializer->printOneLine( os ); 136 os << " maybe constructed? " << initializer->get_maybeConstructed(); 136 if ( ! initializer->get_maybeConstructed() ) { 137 os << " constructed with @= "; 138 } // if 137 139 } // if 138 140 … … 957 959 isDelete ? nullptr : maybeBuild( initializer ), 958 960 copy( attributes ) 959 )->set_extension( extension ); 961 ); 962 decl->extension = extension; 960 963 if ( isDelete ) { 961 964 auto dwt = strict_dynamic_cast<ast::DeclWithType *>( decl ); … … 999 1002 assert( type ); 1000 1003 1001 // Some types are parsed as declarations and, syntactically, can have 1002 // initializers. However, semantically, this is meaningless. 1003 if ( initializer ) { 1004 SemanticError( this, "Initializer on type declaration " ); 1004 // Some types are parsed as declarations and, syntactically, can have initializers, which are not support (possibly 1005 // meaningless). 1006 if ( initializer && initializer->get_maybeConstructed() ) { // no @= 1007 SemanticError( location, "default initialization for parameter %s is unsupport for a function-pointer declaration.", 1008 (this->name) ? this->name->c_str() : "anonymous" ); 1005 1009 } 1006 1010 -
src/Parser/ExpressionNode.cpp
r960665c rad47ec4 9 9 // Author : Peter A. Buhr 10 10 // Created On : Sat May 16 13:17:07 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Thu Dec 14 18:57:07 202313 // Update Count : 108 711 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri Aug 23 10:22:00 2024 13 // Update Count : 1088 14 14 // 15 15 … … 780 780 } // build_compoundLiteral 781 781 782 ast::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 782 792 // Local Variables: // 783 793 // tab-width: 4 // -
src/Parser/ExpressionNode.hpp
r960665c rad47ec4 43 43 ast::Expr * build() { 44 44 ast::Expr * node = expr.release(); 45 node-> set_extension( this->get_extension() );45 node->extension = this->extension; 46 46 node->location = this->location; 47 47 return node; … … 83 83 ast::Expr * build_func( const CodeLocation &, ExpressionNode * function, ExpressionNode * expr_node ); 84 84 ast::Expr * build_compoundLiteral( const CodeLocation &, DeclarationNode * decl_node, InitializerNode * kids ); 85 ast::Expr * build_va_arg( const CodeLocation &, ExpressionNode * function, DeclarationNode * type ); 85 86 86 87 ast::Expr * build_enum_pos_expr( const CodeLocation &, ast::Expr * expr_node ); -
src/Parser/InitializerNode.cpp
r960665c rad47ec4 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 13:20:24 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : Tue A pr 4 11:18:00 202313 // Update Count : 2 711 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Aug 20 22:36:22 2024 13 // Update Count : 28 14 14 // 15 15 … … 86 86 } // if 87 87 88 InitializerNode * moreInit;88 InitializerNode * moreInit; 89 89 if ( ( moreInit = next ) ) { 90 90 moreInit->printOneLine( os ); -
src/Parser/TypeData.cpp
r960665c rad47ec4 1540 1540 1541 1541 1542 // The argument flag (is/is not var-args) of a computed property. 1543 static ast::ArgumentFlag argumentFlag( const TypeData * td ) { 1544 assert( td->kind == TypeData::Function ); 1545 bool isVaArgs = !td->function.params || td->function.params->hasEllipsis; 1546 return (isVaArgs) ? ast::VariableArgs : ast::FixedArgs; 1547 } // argumentFlag 1548 1549 1542 1550 ast::FunctionDecl * buildFunctionDecl( 1543 1551 const TypeData * td, … … 1549 1557 std::vector<ast::ptr<ast::Attribute>> && attributes ) { 1550 1558 assert( td->kind == TypeData::Function ); 1551 // For some reason FunctionDecl takes a bool instead of an ArgumentFlag.1552 bool isVarArgs = !td->function.params || td->function.params->hasEllipsis;1553 1559 ast::CV::Qualifiers cvq = buildQualifiers( td ); 1554 1560 std::vector<ast::ptr<ast::TypeDecl>> forall; … … 1604 1610 std::move( attributes ), 1605 1611 funcSpec, 1606 (isVarArgs) ? ast::VariableArgs : ast::FixedArgs1612 argumentFlag( td ) 1607 1613 ); 1608 1614 buildList( td->function.withExprs, decl->withExprs ); … … 1656 1662 assert( td->kind == TypeData::Function ); 1657 1663 ast::FunctionType * ft = new ast::FunctionType( 1658 ( !td->function.params || td->function.params->hasEllipsis ) 1659 ? ast::VariableArgs : ast::FixedArgs, 1664 argumentFlag( td ), 1660 1665 buildQualifiers( td ) 1661 1666 ); -
src/Parser/parser.yy
r960665c rad47ec4 792 792 { $$ = new ExpressionNode( build_func( yylloc, $1, $3 ) ); } 793 793 | 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 ) ) ); } 797 795 | postfix_expression '`' identifier // CFA, postfix call 798 796 { $$ = 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.