Ignore:
Timestamp:
Nov 27, 2017, 10:01:56 PM (5 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
aaron-thesis, arm-eh, 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:
8eb348a
Parents:
c8771e9
Message:

change semantics of CFA routine-prototype declaration

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    rc8771e9 r481115f  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Nov 26 11:36:36 2017
    13 // Update Count     : 2969
     12// Last Modified On : Mon Nov 27 17:23:35 2017
     13// Update Count     : 2992
    1414//
    1515
     
    13641364                        $$ = $3->addQualifiers( $1 )->addQualifiers( $2 );
    13651365                }
    1366         | cfa_function_declaration pop ',' push identifier_or_type_name
    1367                 {
    1368                         typedefTable.addToEnclosingScope( *$5, TypedefTable::ID );
    1369                         $$ = $1->appendList( $1->cloneType( $5 ) );
     1366        | cfa_function_declaration pop ',' push identifier_or_type_name '(' push cfa_parameter_type_list_opt pop ')'
     1367                {
     1368                        // Append the return type at the start (left-hand-side) to each identifier in the list.
     1369                        DeclarationNode * ret = new DeclarationNode;
     1370                        ret->type = maybeClone( $1->type->base );
     1371                        $$ = $1->appendList( DeclarationNode::newFunction( $5, ret, $8, nullptr, true ) );
    13701372                }
    13711373        ;
     
    24162418                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    24172419                        typedefTable.leaveScope();
    2418                         $$ = $1->addFunctionBody( $3 );
     2420                        // Add the function body to the last identifier in the function definition list, i.e., foo3:
     2421                        //   [const double] foo1(), foo2( int ), foo3( double ) { return 3.0; }
     2422                        $1->get_last()->addFunctionBody( $3 );
     2423                        $$ = $1;
    24192424                }
    24202425        | declaration_specifier function_declarator with_clause_opt compound_statement
Note: See TracChangeset for help on using the changeset viewer.