Changeset 5f782f7
- Timestamp:
- Sep 16, 2017, 8:52:52 AM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 3e239ea, 8024bc8, b11d8e2
- Parents:
- 33a25f9 (diff), 3e3d923 (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:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/ExpressionNode.cc
r33a25f9 r5f782f7 10 10 // Created On : Sat May 16 13:17:07 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Sep 13 14:54:19201713 // Update Count : 6 8312 // Last Modified On : Thu Sep 14 23:09:34 2017 13 // Update Count : 690 14 14 // 15 15 … … 363 363 } // build_pfieldSel 364 364 365 Expression * build_addressOf( ExpressionNode * expr_node ) {366 return new AddressExpr( maybeMoveBuild< Expression >(expr_node) );367 } // build_addressOf368 369 Expression * build_sizeOfexpr( ExpressionNode * expr_node ) {370 return new SizeofExpr( maybeMoveBuild< Expression >(expr_node) );371 } // build_sizeOfexpr372 373 Expression * build_sizeOftype( DeclarationNode * decl_node ) {374 return new SizeofExpr( maybeMoveBuildType( decl_node ) );375 } // build_sizeOftype376 377 Expression * build_alignOfexpr( ExpressionNode * expr_node ) {378 return new AlignofExpr( maybeMoveBuild< Expression >(expr_node) );379 } // build_alignOfexpr380 381 Expression * build_alignOftype( DeclarationNode * decl_node ) {382 return new AlignofExpr( maybeMoveBuildType( decl_node) );383 } // build_alignOftype384 385 365 Expression * build_offsetOf( DeclarationNode * decl_node, NameExpr * member ) { 386 366 Expression * ret = new UntypedOffsetofExpr( maybeMoveBuildType( decl_node ), member->get_name() ); … … 423 403 } // build_cond 424 404 425 Expression * build_attrexpr( NameExpr * var, ExpressionNode * expr_node ) {426 return new AttrExpr( var, maybeMoveBuild< Expression >(expr_node) );427 } // build_attrexpr428 429 Expression * build_attrtype( NameExpr * var, DeclarationNode * decl_node ) {430 return new AttrExpr( var, maybeMoveBuildType( decl_node ) );431 } // build_attrtype432 433 405 Expression * build_tuple( ExpressionNode * expr_node ) { 434 406 list< Expression * > exprs; … … 442 414 return new UntypedExpr( maybeMoveBuild< Expression >(function), args, nullptr ); 443 415 } // build_func 444 445 Expression * build_range( ExpressionNode * low, ExpressionNode * high ) {446 return new RangeExpr( maybeMoveBuild< Expression >( low ), maybeMoveBuild< Expression >( high ) );447 } // build_range448 416 449 417 Expression * build_compoundLiteral( DeclarationNode * decl_node, InitializerNode * kids ) { -
src/Parser/ParseNode.h
r33a25f9 r5f782f7 10 10 // Created On : Sat May 16 13:28:16 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Sep 13 12:35:10201713 // Update Count : 8 0712 // Last Modified On : Thu Sep 14 23:09:39 2017 13 // Update Count : 815 14 14 // 15 15 … … 175 175 Expression * build_fieldSel( ExpressionNode * expr_node, Expression * member ); 176 176 Expression * 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 );182 177 Expression * build_offsetOf( DeclarationNode * decl_node, NameExpr * member ); 183 178 Expression * build_and( ExpressionNode * expr_node1, ExpressionNode * expr_node2 ); … … 188 183 Expression * build_binary_ptr( OperKinds op, ExpressionNode * expr_node1, ExpressionNode * expr_node2 ); 189 184 Expression * 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 );192 185 Expression * build_tuple( ExpressionNode * expr_node = nullptr ); 193 186 Expression * build_func( ExpressionNode * function, ExpressionNode * expr_node ); 194 Expression * build_range( ExpressionNode * low, ExpressionNode * high );195 187 Expression * build_compoundLiteral( DeclarationNode * decl_node, InitializerNode * kids ); 196 188 -
src/Parser/parser.yy
r33a25f9 r5f782f7 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Sep 13 11:01:20201713 // Update Count : 28 0312 // Last Modified On : Thu Sep 14 23:07:12 2017 13 // Update Count : 2815 14 14 // 15 15 … … 563 563 switch ( $1 ) { 564 564 case OperKinds::AddressOf: 565 $$ = new ExpressionNode( build_addressOf( $2) );565 $$ = new ExpressionNode( new AddressExpr( maybeMoveBuild< Expression >( $2 ) ) ); 566 566 break; 567 567 case OperKinds::PointTo: … … 569 569 break; 570 570 case OperKinds::And: 571 $$ = new ExpressionNode( new AddressExpr( build_addressOf( $2) ) );571 $$ = new ExpressionNode( new AddressExpr( new AddressExpr( maybeMoveBuild< Expression >( $2 ) ) ) ); 572 572 break; 573 573 default: … … 582 582 { $$ = new ExpressionNode( build_unary_ptr( OperKinds::Decr, $2 ) ); } 583 583 | SIZEOF unary_expression 584 { $$ = new ExpressionNode( build_sizeOfexpr( $2) ); }584 { $$ = new ExpressionNode( new SizeofExpr( maybeMoveBuild< Expression >( $2 ) ) ); } 585 585 | SIZEOF '(' type_no_function ')' 586 { $$ = new ExpressionNode( build_sizeOftype( $3) ); }586 { $$ = new ExpressionNode( new SizeofExpr( maybeMoveBuildType( $3 ) ) ); } 587 587 | ALIGNOF unary_expression // GCC, variable alignment 588 { $$ = new ExpressionNode( build_alignOfexpr( $2) ); }588 { $$ = new ExpressionNode( new AlignofExpr( maybeMoveBuild< Expression >( $2 ) ) ); } 589 589 | ALIGNOF '(' type_no_function ')' // GCC, type alignment 590 { $$ = new ExpressionNode( build_alignOftype( $3) ); }590 { $$ = new ExpressionNode( new AlignofExpr( maybeMoveBuildType( $3 ) ) ); } 591 591 | OFFSETOF '(' type_no_function ',' no_attr_identifier ')' 592 592 { $$ = new ExpressionNode( build_offsetOf( $3, build_varref( $5 ) ) ); } 593 593 | ATTR_IDENTIFIER 594 { $$ = new ExpressionNode( build_attrexpr( build_varref( $1 ), nullptr) ); }594 { $$ = new ExpressionNode( new AttrExpr( build_varref( $1 ), maybeMoveBuild< Expression >( (ExpressionNode *)nullptr ) ) ); } 595 595 | ATTR_IDENTIFIER '(' argument_expression ')' 596 { $$ = new ExpressionNode( build_attrexpr( build_varref( $1 ), $3) ); }596 { $$ = new ExpressionNode( new AttrExpr( build_varref( $1 ), maybeMoveBuild< Expression >( $3 ) ) ); } 597 597 | ATTR_IDENTIFIER '(' type ')' 598 { $$ = new ExpressionNode( build_attrtype( build_varref( $1 ), $3) ); }598 { $$ = new ExpressionNode( new AttrExpr( build_varref( $1 ), maybeMoveBuildType( $3 ) ) ); } 599 599 ; 600 600 … … 895 895 constant_expression { $$ = $1; } 896 896 | 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 ) ) ); } 898 898 | subrange // CFA, subrange 899 899 ; … … 2089 2089 { $$ = $3; } 2090 2090 | '[' 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 ) ) ); } 2092 2092 | '.' '[' push field_list pop ']' // CFA, tuple field selector 2093 2093 { $$ = $4; } … … 2407 2407 subrange: 2408 2408 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 ) ) ); } 2410 2410 ; 2411 2411
Note: See TracChangeset
for help on using the changeset viewer.