Changeset 4e7cc5ce


Ignore:
Timestamp:
May 31, 2018, 3:46:59 PM (6 years ago)
Author:
Rob Schluntz <rschlunt@…>
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, with_gc
Children:
5de1e2c
Parents:
cf5e5b1
Message:

Minor cleanup

Location:
src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/Alternative.cc

    rcf5e5b1 r4e7cc5ce  
    2727
    2828namespace ResolvExpr {
    29         Alternative::Alternative() : cost( Cost::zero ), cvtCost( Cost::zero ), expr( 0 ) {}
     29        Alternative::Alternative() : cost( Cost::zero ), cvtCost( Cost::zero ), expr( nullptr ) {}
    3030
    3131        Alternative::Alternative( Expression *expr, const TypeEnvironment &env, const Cost& cost )
     
    4848        }
    4949
    50         Alternative::Alternative( Alternative && other ) : cost( other.cost ), cvtCost( other.cvtCost ), expr( other.expr ), env( other.env ) {
     50        Alternative::Alternative( Alternative && other ) : cost( other.cost ), cvtCost( other.cvtCost ), expr( other.expr ), env( std::move( other.env ) ) {
    5151                other.expr = nullptr;
    5252        }
     
    5858                cvtCost = other.cvtCost;
    5959                expr = other.expr;
    60                 env = other.env;
     60                env = std::move( other.env );
    6161                other.expr = nullptr;
    6262                return *this;
  • src/ResolvExpr/TypeEnvironment.cc

    rcf5e5b1 r4e7cc5ce  
    5050        }
    5151
    52         EqvClass::EqvClass() : type( 0 ), allowWidening( true ) {
     52        EqvClass::EqvClass() : type( nullptr ), allowWidening( true ) {
    5353        }
    5454
     
    159159
    160160        void TypeEnvironment::print( std::ostream &os, Indenter indent ) const {
    161                 for ( std::list< EqvClass >::const_iterator i = env.begin(); i != env.end(); ++i ) {
    162                         i->print( os, indent );
     161                for ( const EqvClass & theClass : env ) {
     162                        theClass.print( os, indent );
    163163                } // for
    164164        }
  • src/SynTree/ReferenceToType.cc

    rcf5e5b1 r4e7cc5ce  
    5050
    5151namespace {
    52         void doLookup( const std::list< Declaration* > &members, const std::string &name, std::list< Declaration* > &foundDecls ) {
    53                 for ( std::list< Declaration* >::const_iterator i = members.begin(); i != members.end(); ++i ) {
    54                         if ( (*i)->get_name() == name ) {
    55                                 foundDecls.push_back( *i );
     52        void doLookup( const std::list< Declaration * > & members, const std::string & name, std::list< Declaration* > & foundDecls ) {
     53                for ( Declaration * decl : members ) {
     54                        if ( decl->name == name ) {
     55                                foundDecls.push_back( decl );
    5656                        } // if
    5757                } // for
     
    6060
    6161StructInstType::StructInstType( const Type::Qualifiers & tq, StructDecl * baseStruct, const std::list< Attribute * > & attributes ) :
    62                 Parent( tq, baseStruct->get_name(), attributes ), baseStruct( baseStruct ) {}
     62                Parent( tq, baseStruct->name, attributes ), baseStruct( baseStruct ) {}
    6363
    6464std::string StructInstType::typeString() const { return "struct"; }
     
    8484void StructInstType::lookup( const std::string &name, std::list< Declaration* > &foundDecls ) const {
    8585        assert( baseStruct );
    86         doLookup( baseStruct->get_members(), name, foundDecls );
     86        doLookup( baseStruct->members, name, foundDecls );
    8787}
    8888
     
    103103
    104104UnionInstType::UnionInstType( const Type::Qualifiers & tq, UnionDecl * baseUnion, const std::list< Attribute * > & attributes ) :
    105                 Parent( tq, baseUnion->get_name(), attributes ), baseUnion( baseUnion ) {}
     105                Parent( tq, baseUnion->name, attributes ), baseUnion( baseUnion ) {}
    106106
    107107std::string UnionInstType::typeString() const { return "union"; }
     
    127127void UnionInstType::lookup( const std::string &name, std::list< Declaration* > &foundDecls ) const {
    128128        assert( baseUnion );
    129         doLookup( baseUnion->get_members(), name, foundDecls );
     129        doLookup( baseUnion->members, name, foundDecls );
    130130}
    131131
Note: See TracChangeset for help on using the changeset viewer.