Changeset b1f2007d for src/Validate


Ignore:
Timestamp:
Dec 13, 2023, 9:17:13 AM (22 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
4c2fe47
Parents:
c40157e
Message:

first attempt at simplifying SemanticError and its usage

Location:
src/Validate
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/Validate/FixQualifiedTypes.cpp

    rc40157e rb1f2007d  
    99// Author           : Andrew Beach
    1010// Created On       : Thr Apr 21 11:13:00 2022
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Tue Sep 20 16:15:00 2022
    13 // Update Count     : 1
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Wed Dec 13 09:00:25 2023
     13// Update Count     : 6
    1414//
    1515
     
    4141                                auto td = symtab.globalLookupType( inst->name );
    4242                                if ( !td ) {
    43                                         SemanticError( *location, toString("Use of undefined global type ", inst->name) );
     43                                        SemanticError( *location, "Use of undefined global type %s.", inst->name.c_str() );
    4444                                }
    4545                                auto base = td->base;
     
    5050                        } else {
    5151                                // .T => T is not a type name.
    52                                 assertf( false, "unhandled global qualified child type: %s", toCString(child) );
     52                                assertf( false, "unhandled global qualified child type: %s", toCString( child ) );
    5353                        }
    5454                } else {
     
    6363                                instp = inst;
    6464                        } else {
    65                                 SemanticError( *location, toString("Qualified type requires an aggregate on the left, but has: ", parent) );
     65                                SemanticError( *location, "Qualified type requires an aggregate on the left, but has %s.", toCString( parent ) );
    6666                        }
    6767                        // TODO: Need to handle forward declarations.
     
    8181                                } else {
    8282                                        // S.T - S is not an aggregate => error.
    83                                         assertf( false, "unhandled qualified child type: %s", toCString(type) );
     83                                        assertf( false, "unhandled qualified child type %s.", toCString( type ) );
    8484                                }
    8585                        }
    8686                        // failed to find a satisfying definition of type
    87                         SemanticError( *location, toString("Undefined type in qualified type: ", type) );
     87                        SemanticError( *location, "Undefined type in qualified type %s", toCString( type ) );
    8888                }
    8989        }
  • src/Validate/ForallPointerDecay.cpp

    rc40157e rb1f2007d  
    99// Author           : Andrew Beach
    1010// Created On       : Tue Dec  7 16:15:00 2021
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Sat Apr 23 13:10:00 2022
    13 // Update Count     : 1
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Sun Nov 26 18:49:57 2023
     13// Update Count     : 2
    1414//
    1515
     
    213213                auto type = obj->type->stripDeclarator();
    214214                if ( dynamic_cast< const ast::FunctionType * >( type ) ) return;
    215                 SemanticError( obj->location,
    216                         toCString( "operator ", obj->name.c_str(),
    217                         " is not a function or function pointer." ) );
     215                SemanticError( obj->location, "operator %s is not a function or function pointer.", obj->name.c_str() );
    218216        }
    219217};
  • src/Validate/ReplaceTypedef.cpp

    rc40157e rb1f2007d  
    99// Author           : Andrew Beach
    1010// Created On       : Tue Jun 29 14:59:00 2022
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Tue Sep 20 17:00:00 2022
    13 // Update Count     : 2
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Mon Nov 27 08:55:06 2023
     13// Update Count     : 3
    1414//
    1515
     
    111111                        if ( !rtt ) {
    112112                                assert( location );
    113                                 SemanticError( *location, "Cannot apply type parameters to base type of " + type->name );
     113                                SemanticError( *location, "Cannot apply type parameters to base type of %s.", type->name.c_str() );
    114114                        }
    115115                        rtt->params.clear();
     
    125125                if ( base == typedeclNames.end() ) {
    126126                        assert( location );
    127                         SemanticError( *location, toString( "Use of undefined type ", type->name ) );
     127                        SemanticError( *location, "Use of undefined type %s.", type->name.c_str() );
    128128                }
    129129                return ast::mutate_field( type, &ast::TypeInstType::base, base->second );
Note: See TracChangeset for help on using the changeset viewer.