Changeset 9bb6c5f for src


Ignore:
Timestamp:
Sep 5, 2024, 3:57:05 PM (15 months ago)
Author:
JiadaL <j82liang@…>
Branches:
master
Children:
29c8675
Parents:
ad47ec4 (diff), 508cff0 (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.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Location:
src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cpp

    rad47ec4 r9bb6c5f  
    180180
    181181        if ( 0 == decl->params.size() ) {
    182                 if ( decl->type->isVarArgs ) {
     182                if ( !decl->type->isVarArgs ) {
     183                        acc << "(void)";
     184                } else if ( options.genC ) {
    183185                        acc << "()";
    184186                } else {
    185                         acc << "(void)";
     187                        acc << "(...)";
    186188                }
    187189        } else {
  • src/CodeGen/GenType.cpp

    rad47ec4 r9bb6c5f  
    168168
    169169        if ( type->params.empty() ) {
    170                 if ( type->isVarArgs ) {
     170                if ( !type->isVarArgs ) {
     171                        os << "(void)";
     172                } else if ( options.genC ) {
    171173                        os << "()";
    172174                } else {
    173                         os << "(void)";
     175                        os << "(...)";
    174176                }
    175177        } else {
  • src/Concurrency/Keywords.cpp

    rad47ec4 r9bb6c5f  
    15101510
    15111511ast::ptr<ast::Type> MutexKeyword::generic_func =
    1512         new ast::FunctionType( ast::VariableArgs );
     1512        new ast::FunctionType( ast::FixedArgs );
    15131513
    15141514// --------------------------------------------------------------------------
  • src/Concurrency/Waitfor.cpp

    rad47ec4 r9bb6c5f  
    302302        const ast::ObjectDecl * monitors = declMonitors( out, clause );
    303303        ast::Type * fptr_t = new ast::PointerType(
    304                         new ast::FunctionType( ast::VariableArgs ) );
     304                        new ast::FunctionType( ast::FixedArgs ) );
    305305
    306306        const ast::VariableExpr * variableExpr =
  • src/Parser/TypeData.cpp

    rad47ec4 r9bb6c5f  
    15411541
    15421542// The argument flag (is/is not var-args) of a computed property.
    1543 static ast::ArgumentFlag argumentFlag( const TypeData * td ) {
     1543static ast::ArgumentFlag buildArgumentFlag( const TypeData * td ) {
    15441544        assert( td->kind == TypeData::Function );
    1545         bool isVaArgs = !td->function.params || td->function.params->hasEllipsis;
    1546         return (isVaArgs) ? ast::VariableArgs : ast::FixedArgs;
    1547 } // argumentFlag
     1545        bool isVarArgs = !td->function.params || td->function.params->hasEllipsis;
     1546        return (isVarArgs) ? ast::VariableArgs : ast::FixedArgs;
     1547}
     1548
     1549
     1550// Wrapper to convert the void parameter into the empty explicit list.
     1551static void buildParamList( DeclarationNode * decl,
     1552                std::vector<ast::ptr<ast::DeclWithType>> & params ) {
     1553        buildList( decl, params );
     1554        if ( 1 == params.size() && params[0]->get_type()->isVoid() ) {
     1555                params.pop_back();
     1556        }
     1557}
    15481558
    15491559
     
    15621572        std::vector<ast::ptr<ast::DeclWithType>> params;
    15631573        std::vector<ast::ptr<ast::DeclWithType>> returns;
    1564         buildList( td->function.params, params );
     1574        buildParamList( td->function.params, params );
    15651575        buildForall( td->forall, forall );
    15661576        // Functions do not store their assertions there anymore.
     
    16101620                std::move( attributes ),
    16111621                funcSpec,
    1612                 argumentFlag( td )
     1622                buildArgumentFlag( td )
    16131623        );
    16141624        buildList( td->function.withExprs, decl->withExprs );
     
    16621672        assert( td->kind == TypeData::Function );
    16631673        ast::FunctionType * ft = new ast::FunctionType(
    1664                 argumentFlag( td ),
     1674                buildArgumentFlag( td ),
    16651675                buildQualifiers( td )
    16661676        );
  • src/Parser/parser.yy

    rad47ec4 r9bb6c5f  
    28892889parameter_list_ellipsis_opt:
    28902890        // empty
    2891                 { $$ = nullptr; }
     2891                { $$ = DeclarationNode::newFromTypeData( build_basic_type( TypeData::Void ) ); }
    28922892        | ELLIPSIS
    28932893                { $$ = nullptr; }
Note: See TracChangeset for help on using the changeset viewer.