Changeset d55d7a6 for src/ResolvExpr


Ignore:
Timestamp:
Feb 15, 2018, 3:58:56 PM (8 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:
75e3cb2
Parents:
d27e340
Message:

Massive change to errors to enable warnings

Location:
src/ResolvExpr
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/AlternativeFinder.cc

    rd27e340 rd55d7a6  
    252252                                std::cerr << "No reasonable alternatives for expression " << expr << std::endl;
    253253                        )
    254                         throw SemanticError( "No reasonable alternatives for expression ", expr );
     254                        throw SemanticError( expr, "No reasonable alternatives for expression " );
    255255                }
    256256                if ( prune ) {
     
    270270                                stream << "Alternatives are:\n";
    271271                                printAlts( winners, stream, 1 );
    272                                 throw SemanticError( stream.str() );
     272                                throw SemanticError( expr->location, stream.str() );
    273273                        }
    274274                        alternatives = move(pruned);
     
    507507                                return;
    508508                        } else if ( level >= recursionLimit ) {
    509                                 throw SemanticError( "Too many recursive assertions" );
     509                                throw SemanticError( newAlt.expr->location, "Too many recursive assertions" );
    510510                        } else {
    511511                                AssertionSet newerNeed;
     
    14211421                        findMinCost( finder.alternatives.begin(), finder.alternatives.end(), back_inserter( winners ) );
    14221422                        if ( winners.size() != 1 ) {
    1423                                 throw SemanticError( "Ambiguous expression in sizeof operand: ", sizeofExpr->get_expr() );
     1423                                throw SemanticError( sizeofExpr->get_expr(), "Ambiguous expression in sizeof operand: " );
    14241424                        } // if
    14251425                        // return the lowest cost alternative for the argument
     
    14421442                        findMinCost( finder.alternatives.begin(), finder.alternatives.end(), back_inserter( winners ) );
    14431443                        if ( winners.size() != 1 ) {
    1444                                 throw SemanticError( "Ambiguous expression in alignof operand: ", alignofExpr->get_expr() );
     1444                                throw SemanticError( alignofExpr->get_expr(), "Ambiguous expression in alignof operand: " );
    14451445                        } // if
    14461446                        // return the lowest cost alternative for the argument
  • src/ResolvExpr/CurrentObject.cc

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

    rd27e340 rd55d7a6  
    188188                        findMinCost( candidates.begin(), candidates.end(), back_inserter( winners ) );
    189189                        if ( winners.size() == 0 ) {
    190                                 throw SemanticError( "No reasonable alternatives for " + kindStr + " expression: ", untyped );
     190                                throw SemanticError( untyped, "No reasonable alternatives for " + kindStr + " expression: " );
    191191                        } else if ( winners.size() != 1 ) {
    192192                                std::ostringstream stream;
     
    195195                                stream << "Alternatives are:\n";
    196196                                printAlts( winners, stream, 1 );
    197                                 throw SemanticError( stream.str() );
     197                                throw SemanticError( untyped->location, stream.str() );
    198198                        }
    199199
     
    429429                                ss << strict_dynamic_cast<NameExpr*>( clause.target.function )->name;
    430430                                ss << "' in call to waitfor";
    431                                 throw SemanticError( ss.str() );
     431                                throw SemanticError( stmt->location, ss.str() );
    432432                        }
    433433
     
    451451                                        PointerType * pointer = dynamic_cast< PointerType* >( func.expr->get_result()->stripReferences() );
    452452                                        if( !pointer ) {
    453                                                 throw SemanticError( "candidate not viable: not a pointer type\n", func.expr->get_result() );
     453                                                throw SemanticError( func.expr->get_result(), "candidate not viable: not a pointer type\n" );
    454454                                        }
    455455
    456456                                        FunctionType * function = dynamic_cast< FunctionType* >( pointer->get_base() );
    457457                                        if( !function ) {
    458                                                 throw SemanticError( "candidate not viable: not a function type\n", pointer->get_base() );
     458                                                throw SemanticError( pointer->get_base(), "candidate not viable: not a function type\n" );
    459459                                        }
    460460
     
    465465
    466466                                                if( !advance_to_mutex( param, param_end ) ) {
    467                                                         throw SemanticError("candidate function not viable: no mutex parameters\n", function);
     467                                                        throw SemanticError(function, "candidate function not viable: no mutex parameters\n");
    468468                                                }
    469469                                        }
     
    504504                                                                        // We ran out of parameters but still have arguments
    505505                                                                        // this function doesn't match
    506                                                                         throw SemanticError("candidate function not viable: too many mutex arguments\n", function);
     506                                                                        throw SemanticError( function, "candidate function not viable: too many mutex arguments\n" );
    507507                                                                }
    508508
     
    516516                                                                        (*param)->get_type()->print( ss );
    517517                                                                        ss << "'\n";
    518                                                                         throw SemanticError(ss.str(), function);
     518                                                                        throw SemanticError( function, ss.str() );
    519519                                                                }
    520520
     
    528528                                                                // We ran out of arguments but still have parameters left
    529529                                                                // this function doesn't match
    530                                                                 throw SemanticError("candidate function not viable: too few mutex arguments\n", function);
     530                                                                throw SemanticError( function, "candidate function not viable: too few mutex arguments\n" );
    531531                                                        }
    532532
     
    555555
    556556                        // Make sure we got the right number of arguments
    557                         if( func_candidates.empty() )    { SemanticError top( "No alternatives for function in call to waitfor"  ); top.append( errors ); throw top; }
    558                         if( args_candidates.empty() )    { SemanticError top( "No alternatives for arguments in call to waitfor" ); top.append( errors ); throw top; }
    559                         if( func_candidates.size() > 1 ) { SemanticError top( "Ambiguous function in call to waitfor"            ); top.append( errors ); throw top; }
    560                         if( args_candidates.size() > 1 ) { SemanticError top( "Ambiguous arguments in call to waitfor"           ); top.append( errors ); throw top; }
     557                        if( func_candidates.empty() )    { SemanticError top( stmt->location, "No alternatives for function in call to waitfor"  ); top.append( errors ); throw top; }
     558                        if( args_candidates.empty() )    { SemanticError top( stmt->location, "No alternatives for arguments in call to waitfor" ); top.append( errors ); throw top; }
     559                        if( func_candidates.size() > 1 ) { SemanticError top( stmt->location, "Ambiguous function in call to waitfor"            ); top.append( errors ); throw top; }
     560                        if( args_candidates.size() > 1 ) { SemanticError top( stmt->location, "Ambiguous arguments in call to waitfor"           ); top.append( errors ); throw top; }
    561561
    562562
Note: See TracChangeset for help on using the changeset viewer.