@@ -3170,21 +3170,22 @@ exprt c_typecheck_baset::do_special_functions(
31703170 if (expr.arguments ().size () != 1 )
31713171 {
31723172 std::ostringstream error_message;
3173- error_message << expr.source_location ().as_string () << " : " << identifier
3174- << " takes exactly 1 argument, but "
3173+ error_message << identifier << " takes exactly 1 argument, but "
31753174 << expr.arguments ().size () << " were provided" ;
3176- throw invalid_source_file_exceptiont{error_message.str ()};
3175+ throw invalid_source_file_exceptiont{
3176+ error_message.str (), expr.source_location ()};
31773177 }
31783178 auto arg1 = expr.arguments ()[0 ];
31793179 typecheck_expr (arg1);
31803180 if (!can_cast_type<c_enum_tag_typet>(arg1.type ()))
31813181 {
31823182 // Can't enum range check a non-enum
31833183 std::ostringstream error_message;
3184- error_message << expr.source_location ().as_string () << " : " << identifier
3185- << " expects enum, but (" << expr2c (arg1, *this )
3186- << " ) has type `" << type2c (arg1.type (), *this ) << ' `' ;
3187- throw invalid_source_file_exceptiont{error_message.str ()};
3184+ error_message << identifier << " expects enum, but ("
3185+ << expr2c (arg1, *this ) << " ) has type `"
3186+ << type2c (arg1.type (), *this ) << ' `' ;
3187+ throw invalid_source_file_exceptiont{
3188+ error_message.str (), expr.source_location ()};
31883189 }
31893190 else
31903191 {
@@ -3237,9 +3238,9 @@ exprt c_typecheck_baset::do_special_functions(
32373238 if (expr.arguments ().size () != 1 )
32383239 {
32393240 std::ostringstream error_message;
3240- error_message << expr. source_location (). as_string ()
3241- << " : error: " << identifier << " expects one operand " ;
3242- throw invalid_source_file_exceptiont{ error_message.str ()};
3241+ error_message << " error: " << identifier << " expects one operand " ;
3242+ throw invalid_source_file_exceptiont{
3243+ error_message.str (), expr. source_location ()};
32433244 }
32443245
32453246 typecheck_function_call_arguments (expr);
@@ -3264,10 +3265,10 @@ exprt c_typecheck_baset::typecheck_builtin_overflow(
32643265 if (expr.arguments ().size () != 3 )
32653266 {
32663267 std::ostringstream error_message;
3267- error_message << expr.source_location ().as_string () << " : " << identifier
3268- << " takes exactly 3 arguments, but "
3268+ error_message << identifier << " takes exactly 3 arguments, but "
32693269 << expr.arguments ().size () << " were provided" ;
3270- throw invalid_source_file_exceptiont{error_message.str ()};
3270+ throw invalid_source_file_exceptiont{
3271+ error_message.str (), expr.source_location ()};
32713272 }
32723273
32733274 typecheck_function_call_arguments (expr);
@@ -3283,14 +3284,14 @@ exprt c_typecheck_baset::typecheck_builtin_overflow(
32833284 [this , identifier](
32843285 const exprt &wrong_argument, std::size_t argument_number, bool _p) {
32853286 std::ostringstream error_message;
3286- error_message << wrong_argument.source_location ().as_string () << " : "
3287- << identifier << " has signature " << identifier
3288- << " (integral, integral, integral" << (_p ? " " : " *" )
3289- << " ), "
3287+ error_message << " error: " << identifier << " has signature "
3288+ << identifier << " (integral, integral, integral"
3289+ << (_p ? " " : " *" ) << " ), "
32903290 << " but argument " << argument_number << " ("
32913291 << expr2c (wrong_argument, *this ) << " ) has type `"
32923292 << type2c (wrong_argument.type (), *this ) << ' `' ;
3293- throw invalid_source_file_exceptiont{error_message.str ()};
3293+ throw invalid_source_file_exceptiont{
3294+ error_message.str (), wrong_argument.source_location ()};
32943295 };
32953296 for (int arg_index = 0 ; arg_index <= (!is__p_variant ? 1 : 2 ); ++arg_index)
32963297 {
@@ -3326,10 +3327,11 @@ exprt c_typecheck_baset::typecheck_saturating_arithmetic(
33263327 if (expr.arguments ().size () != 2 )
33273328 {
33283329 std::ostringstream error_message;
3329- error_message << expr. source_location (). as_string () << " : " << identifier
3330+ error_message << " error : " << identifier
33303331 << " takes exactly two arguments, but "
33313332 << expr.arguments ().size () << " were provided" ;
3332- throw invalid_source_file_exceptiont{error_message.str ()};
3333+ throw invalid_source_file_exceptiont{
3334+ error_message.str (), expr.source_location ()};
33333335 }
33343336
33353337 exprt result;
0 commit comments