Changeset a16764a6 for src/ResolvExpr


Ignore:
Timestamp:
Feb 28, 2018, 4:48:22 PM (6 years ago)
Author:
Thierry Delisle <tdelisle@…>
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:
446ffa3
Parents:
6a8df56
Message:

Changed warning system to prepare for toggling warnings

Location:
src/ResolvExpr
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/AlternativeFinder.cc

    r6a8df56 ra16764a6  
    240240                                std::cerr << "No reasonable alternatives for expression " << expr << std::endl;
    241241                        )
    242                         throw SemanticError( expr, "No reasonable alternatives for expression " );
     242                        SemanticError( expr, "No reasonable alternatives for expression " );
    243243                }
    244244                if ( prune ) {
     
    258258                                stream << " Alternatives are:\n";
    259259                                printAlts( winners, stream, 1 );
    260                                 throw SemanticError( expr->location, stream.str() );
     260                                SemanticError( expr->location, stream.str() );
    261261                        }
    262262                        alternatives = move(pruned);
     
    495495                                return;
    496496                        } else if ( level >= recursionLimit ) {
    497                                 throw SemanticError( newAlt.expr->location, "Too many recursive assertions" );
     497                                SemanticError( newAlt.expr->location, "Too many recursive assertions" );
    498498                        } else {
    499499                                AssertionSet newerNeed;
     
    11121112
    11131113                AltList candidates;
    1114                 SemanticError errors;
     1114                SemanticErrorException errors;
    11151115                for ( AltList::iterator func = funcFinder.alternatives.begin(); func != funcFinder.alternatives.end(); ++func ) {
    11161116                        try {
     
    11381138                                        } // if
    11391139                                }
    1140                         } catch ( SemanticError &e ) {
     1140                        } catch ( SemanticErrorException &e ) {
    11411141                                errors.append( e );
    11421142                        }
     
    11671167                                                }
    11681168                                        }
    1169                                 } catch ( SemanticError &e ) {
     1169                                } catch ( SemanticErrorException &e ) {
    11701170                                        errors.append( e );
    11711171                                }
     
    14091409                        findMinCost( finder.alternatives.begin(), finder.alternatives.end(), back_inserter( winners ) );
    14101410                        if ( winners.size() != 1 ) {
    1411                                 throw SemanticError( sizeofExpr->get_expr(), "Ambiguous expression in sizeof operand: " );
     1411                                SemanticError( sizeofExpr->get_expr(), "Ambiguous expression in sizeof operand: " );
    14121412                        } // if
    14131413                        // return the lowest cost alternative for the argument
     
    14301430                        findMinCost( finder.alternatives.begin(), finder.alternatives.end(), back_inserter( winners ) );
    14311431                        if ( winners.size() != 1 ) {
    1432                                 throw SemanticError( alignofExpr->get_expr(), "Ambiguous expression in alignof operand: " );
     1432                                SemanticError( alignofExpr->get_expr(), "Ambiguous expression in alignof operand: " );
    14331433                        } // if
    14341434                        // return the lowest cost alternative for the argument
  • src/ResolvExpr/CurrentObject.cc

    r6a8df56 ra16764a6  
    141141                        base = at->get_base();
    142142                        memberIter = createMemberIterator( base );
    143                         if ( at->isVarLen ) throw SemanticError( at, "VLA initialization does not support @=" );
     143                        if ( at->isVarLen ) SemanticError( at, "VLA initialization does not support @=" );
    144144                        setSize( at->get_dimension() );
    145145                }
     
    155155                                        size = constExpr->intValue();
    156156                                        PRINT( std::cerr << "array type with size: " << size << std::endl; )
    157                                 } catch ( SemanticError & ) {
    158                                         throw SemanticError( expr, "Constant expression of non-integral type in array dimension: " );
     157                                } catch ( SemanticErrorException & ) {
     158                                        SemanticError( expr, "Constant expression of non-integral type in array dimension: " );
    159159                                }
    160160                        }       else if ( CastExpr * castExpr = dynamic_cast< CastExpr * >( expr ) ) {
     
    178178                                try {
    179179                                        index = constExpr->intValue();
    180                                 } catch( SemanticError & ) {
    181                                         throw SemanticError( expr, "Constant expression of non-integral type in array designator: " );
     180                                } catch( SemanticErrorException & ) {
     181                                        SemanticError( expr, "Constant expression of non-integral type in array designator: " );
    182182                                }
    183183                        } else if ( CastExpr * castExpr = dynamic_cast< CastExpr * >( expr ) ) {
     
    532532                } // for
    533533                if ( desigAlts.size() > 1 ) {
    534                         throw SemanticError( designation, toString("Too many alternatives (", desigAlts.size(), ") for designation: ") );
     534                        SemanticError( designation, toString("Too many alternatives (", desigAlts.size(), ") for designation: ") );
    535535                } else if ( desigAlts.size() == 0 ) {
    536                         throw SemanticError( designation, "No reasonable alternatives for designation: " );
     536                        SemanticError( designation, "No reasonable alternatives for designation: " );
    537537                }
    538538                DesignatorChain & d = desigAlts.back();
  • src/ResolvExpr/Resolver.cc

    r6a8df56 ra16764a6  
    174174                        findMinCost( candidates.begin(), candidates.end(), back_inserter( winners ) );
    175175                        if ( winners.size() == 0 ) {
    176                                 throw SemanticError( untyped, toString( "No reasonable alternatives for ", kindStr, (kindStr != "" ? " " : ""), "expression: ") );
     176                                SemanticError( untyped, toString( "No reasonable alternatives for ", kindStr, (kindStr != "" ? " " : ""), "expression: ") );
    177177                        } else if ( winners.size() != 1 ) {
    178178                                std::ostringstream stream;
     
    181181                                stream << " Alternatives are:\n";
    182182                                printAlts( winners, stream, 1 );
    183                                 throw SemanticError( untyped->location, stream.str() );
     183                                SemanticError( untyped->location, stream.str() );
    184184                        }
    185185
     
    187187                        Alternative & choice = winners.front();
    188188                        if ( findDeletedExpr( choice.expr ) ) {
    189                                 throw SemanticError( choice.expr, "Unique best alternative includes deleted identifier in " );
     189                                SemanticError( choice.expr, "Unique best alternative includes deleted identifier in " );
    190190                        }
    191191                        alt = std::move( choice );
     
    484484                                ss << strict_dynamic_cast<NameExpr*>( clause.target.function )->name;
    485485                                ss << "' in call to waitfor";
    486                                 throw SemanticError( stmt->location, ss.str() );
     486                                SemanticError( stmt->location, ss.str() );
    487487                        }
    488488
     
    501501                        //      try matching the arguments to the parameters
    502502                        //      not the other way around because we have more arguments than parameters
    503                         SemanticError errors;
     503                        SemanticErrorException errors;
    504504                        for ( Alternative & func : funcFinder.get_alternatives() ) {
    505505                                try {
    506506                                        PointerType * pointer = dynamic_cast< PointerType* >( func.expr->get_result()->stripReferences() );
    507507                                        if( !pointer ) {
    508                                                 throw SemanticError( func.expr->get_result(), "candidate not viable: not a pointer type\n" );
     508                                                SemanticError( func.expr->get_result(), "candidate not viable: not a pointer type\n" );
    509509                                        }
    510510
    511511                                        FunctionType * function = dynamic_cast< FunctionType* >( pointer->get_base() );
    512512                                        if( !function ) {
    513                                                 throw SemanticError( pointer->get_base(), "candidate not viable: not a function type\n" );
     513                                                SemanticError( pointer->get_base(), "candidate not viable: not a function type\n" );
    514514                                        }
    515515
     
    520520
    521521                                                if( !advance_to_mutex( param, param_end ) ) {
    522                                                         throw SemanticError(function, "candidate function not viable: no mutex parameters\n");
     522                                                        SemanticError(function, "candidate function not viable: no mutex parameters\n");
    523523                                                }
    524524                                        }
     
    559559                                                                        // We ran out of parameters but still have arguments
    560560                                                                        // this function doesn't match
    561                                                                         throw SemanticError( function, "candidate function not viable: too many mutex arguments\n" );
     561                                                                        SemanticError( function, "candidate function not viable: too many mutex arguments\n" );
    562562                                                                }
    563563
     
    571571                                                                        (*param)->get_type()->print( ss );
    572572                                                                        ss << "'\n";
    573                                                                         throw SemanticError( function, ss.str() );
     573                                                                        SemanticError( function, ss.str() );
    574574                                                                }
    575575
     
    583583                                                                // We ran out of arguments but still have parameters left
    584584                                                                // this function doesn't match
    585                                                                 throw SemanticError( function, "candidate function not viable: too few mutex arguments\n" );
     585                                                                SemanticError( function, "candidate function not viable: too few mutex arguments\n" );
    586586                                                        }
    587587
     
    599599
    600600                                                }
    601                                                 catch( SemanticError &e ) {
     601                                                catch( SemanticErrorException &e ) {
    602602                                                        errors.append( e );
    603603                                                }
    604604                                        }
    605605                                }
    606                                 catch( SemanticError &e ) {
     606                                catch( SemanticErrorException &e ) {
    607607                                        errors.append( e );
    608608                                }
     
    610610
    611611                        // Make sure we got the right number of arguments
    612                         if( func_candidates.empty() )    { SemanticError top( stmt->location, "No alternatives for function in call to waitfor"  ); top.append( errors ); throw top; }
    613                         if( args_candidates.empty() )    { SemanticError top( stmt->location, "No alternatives for arguments in call to waitfor" ); top.append( errors ); throw top; }
    614                         if( func_candidates.size() > 1 ) { SemanticError top( stmt->location, "Ambiguous function in call to waitfor"            ); top.append( errors ); throw top; }
    615                         if( args_candidates.size() > 1 ) { SemanticError top( stmt->location, "Ambiguous arguments in call to waitfor"           ); top.append( errors ); throw top; }
     612                        if( func_candidates.empty() )    { SemanticErrorException top( stmt->location, "No alternatives for function in call to waitfor"  ); top.append( errors ); throw top; }
     613                        if( args_candidates.empty() )    { SemanticErrorException top( stmt->location, "No alternatives for arguments in call to waitfor" ); top.append( errors ); throw top; }
     614                        if( func_candidates.size() > 1 ) { SemanticErrorException top( stmt->location, "Ambiguous function in call to waitfor"            ); top.append( errors ); throw top; }
     615                        if( args_candidates.size() > 1 ) { SemanticErrorException top( stmt->location, "Ambiguous arguments in call to waitfor"           ); top.append( errors ); throw top; }
    616616                        // TODO: need to use findDeletedExpr to ensure no deleted identifiers are used.
    617617
Note: See TracChangeset for help on using the changeset viewer.