Changeset a16764a6 for src/InitTweak


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/InitTweak
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/FixGlobalInit.cc

    r6a8df56 ra16764a6  
    2121
    2222#include "Common/PassVisitor.h"
    23 #include "Common/SemanticError.h"  // for SemanticError
    2423#include "Common/UniqueName.h"     // for UniqueName
    2524#include "InitTweak.h"             // for isIntrinsicSingleArgCallStmt
  • src/InitTweak/FixInit.cc

    r6a8df56 ra16764a6  
    213213                        Expression * postmutate( UntypedExpr * expr );
    214214
    215                         SemanticError errors;
     215                        SemanticErrorException errors;
    216216                  private:
    217217                        template< typename... Params >
     
    276276                        // can't use mutateAll, because need to insert declarations at top-level
    277277                        // can't use DeclMutator, because sometimes need to insert IfStmt, etc.
    278                         SemanticError errors;
     278                        SemanticErrorException errors;
    279279                        for ( std::list< Declaration * >::iterator i = translationUnit.begin(); i != translationUnit.end(); ++i ) {
    280280                                try {
    281281                                        maybeMutate( *i, fixer );
    282282                                        translationUnit.splice( i, fixer.pass.staticDtorDecls );
    283                                 } catch( SemanticError &e ) {
     283                                } catch( SemanticErrorException &e ) {
    284284                                        errors.append( e );
    285285                                } // try
     
    894894                        )
    895895                        if ( ! diff.empty() ) {
    896                                 throw SemanticError( stmt, std::string("jump to label '") + stmt->get_target().get_name() + "' crosses initialization of " + (*diff.begin())->get_name() + " " );
     896                                SemanticError( stmt, std::string("jump to label '") + stmt->get_target().get_name() + "' crosses initialization of " + (*diff.begin())->get_name() + " " );
    897897                        } // if
    898898                        // S_G-S_L results in set of objects that must be destructed
     
    945945                        GuardValue( isCtor );
    946946                        GuardValue( structDecl );
    947                         errors = SemanticError();  // clear previous errors
     947                        errors = SemanticErrorException();  // clear previous errors
    948948
    949949                        // need to start with fresh sets
     
    10341034                                                                function->get_statements()->push_back( callStmt );
    10351035                                                        }
    1036                                                 } catch ( SemanticError & error ) {
     1036                                                } catch ( SemanticErrorException & error ) {
    10371037                                                        emit( funcDecl->location, "in ", CodeGen::genPrettyType( function->get_functionType(), function->get_name() ), ", field ", field->get_name(), " not explicitly ", isCtor ? "constructed" : "destructed",  " and no ", isCtor ? "default constructor" : "destructor", " found" );
    10381038                                                }
     
    11101110                template< typename Visitor, typename... Params >
    11111111                void error( Visitor & v, CodeLocation loc, const Params &... params ) {
    1112                         SemanticError err( loc, toString( params... ) );
     1112                        SemanticErrorException err( loc, toString( params... ) );
    11131113                        v.errors.append( err );
    11141114                }
  • src/InitTweak/GenInit.cc

    r6a8df56 ra16764a6  
    317317                if ( tryConstruct( objDecl ) && ( managedTypes.isManaged( objDecl ) || ((! inFunction || objDecl->get_storageClasses().is_static ) && ! isConstExpr( objDecl->get_init() ) ) ) ) {
    318318                        // constructed objects cannot be designated
    319                         if ( isDesignated( objDecl->get_init() ) ) throw SemanticError( objDecl, "Cannot include designations in the initializer for a managed Object. If this is really what you want, then initialize with @=.\n" );
     319                        if ( isDesignated( objDecl->get_init() ) ) SemanticError( objDecl, "Cannot include designations in the initializer for a managed Object. If this is really what you want, then initialize with @=.\n" );
    320320                        // constructed objects should not have initializers nested too deeply
    321                         if ( ! checkInitDepth( objDecl ) ) throw SemanticError( objDecl, "Managed object's initializer is too deep " );
     321                        if ( ! checkInitDepth( objDecl ) ) SemanticError( objDecl, "Managed object's initializer is too deep " );
    322322
    323323                        objDecl->set_init( genCtorInit( objDecl ) );
  • src/InitTweak/InitTweak.cc

    r6a8df56 ra16764a6  
    225225                                        // xxx - this shouldn't be an error, but need a way to
    226226                                        // terminate without creating output, so should catch this error
    227                                         throw SemanticError( init->location, "unbalanced list initializers" );
     227                                        SemanticError( init->location, "unbalanced list initializers" );
    228228                                }
    229229
Note: See TracChangeset for help on using the changeset viewer.