Ignore:
Timestamp:
Mar 16, 2018, 5:15:02 PM (6 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
new-env, with_gc
Children:
8d7bef2
Parents:
6171841
git-author:
Aaron Moss <a3moss@…> (03/16/18 17:04:24)
git-committer:
Aaron Moss <a3moss@…> (03/16/18 17:15:02)
Message:

First pass at delete removal

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Validate.cc

    r6171841 r68f9c43  
    310310                } // if
    311311                // Always remove the hoisted aggregate from the inner structure.
    312                 GuardAction( [aggregateDecl]() { filter( aggregateDecl->members, isStructOrUnion, false ); } );
     312                GuardAction( [aggregateDecl]() { filter( aggregateDecl->members, isStructOrUnion ); } );
    313313        }
    314314
     
    365365                        // one void is the only thing in the list; remove it.
    366366                        if ( containsVoid ) {
    367                                 delete dwts.front();
    368367                                dwts.clear();
    369368                        }
     
    492491                                }
    493492                        }
    494                         deleteAll( td->assertions );
    495493                        td->assertions.clear();
    496494                } // for
     
    608606                                        // expand trait instance into all of its members
    609607                                        expandAssertions( traitInst, back_inserter( type->assertions ) );
    610                                         delete traitInst;
    611608                                } else {
    612609                                        // pass other assertions through
     
    682679                        SizeType = new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt );
    683680                }
    684                 filter( translationUnit, isTypedef, true );
     681                filter( translationUnit, isTypedef );
    685682        }
    686683
     
    696693                                ret->attributes.splice( ret->attributes.end(), typeInst->attributes );
    697694                        } else {
    698                                 deleteAll( ret->attributes );
    699695                                ret->attributes.clear();
    700696                        }
     
    709705                                mutateAll( rtt->parameters, *visitor );  // recursively fix typedefs on parameters
    710706                        } // if
    711                         delete typeInst;
    712707                        return ret;
    713708                } else {
     
    795790                if ( FunctionType *funtype = dynamic_cast<FunctionType *>( objDecl->get_type() ) ) { // function type?
    796791                        // replace the current object declaration with a function declaration
    797                         FunctionDecl * newDecl = new FunctionDecl( objDecl->get_name(), objDecl->get_storageClasses(), objDecl->get_linkage(), funtype, 0, objDecl->get_attributes(), objDecl->get_funcSpec() );
    798                         objDecl->get_attributes().clear();
    799                         objDecl->set_type( nullptr );
    800                         delete objDecl;
    801                         return newDecl;
     792                        return new FunctionDecl{
     793                                objDecl->get_name(), objDecl->get_storageClasses(), objDecl->get_linkage(),
     794                                funtype, 0, objDecl->get_attributes(), objDecl->get_funcSpec() };
    802795                } // if
    803796                return objDecl;
     
    823816                        } // if
    824817                        return false;
    825                 }, true);
     818                } );
    826819                return compoundStmt;
    827820        }
     
    831824        template<typename AggDecl>
    832825        AggDecl *EliminateTypedef::handleAggregate( AggDecl * aggDecl ) {
    833                 filter( aggDecl->members, isTypedef, true );
     826                filter( aggDecl->members, isTypedef );
    834827                return aggDecl;
    835828        }
     
    961954                static UniqueName indexName( "_compLit" );
    962955
    963                 ObjectDecl *tempvar = new ObjectDecl( indexName.newName(), storageClasses, LinkageSpec::C, nullptr, compLitExpr->get_result(), compLitExpr->get_initializer() );
    964                 compLitExpr->set_result( nullptr );
    965                 compLitExpr->set_initializer( nullptr );
    966                 delete compLitExpr;
     956                ObjectDecl * tempvar = new ObjectDecl{
     957                        indexName.newName(), storageClasses, LinkageSpec::C, nullptr, compLitExpr->get_result(), compLitExpr->get_initializer() };
    967958                declsToAddBefore.push_back( tempvar );                                  // add modified temporary to current block
    968959                return new VariableExpr( tempvar );
     
    1000991                        // ensure return value is not destructed by explicitly creating an empty ListInit node wherein maybeConstruct is false.
    1001992                        ObjectDecl * newRet = new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, tupleType, new ListInit( std::list<Initializer*>(), noDesignators, false ) );
    1002                         deleteAll( retVals );
    1003993                        retVals.clear();
    1004994                        retVals.push_back( newRet );
     
    10411031                        if ( NameExpr * nameExpr = dynamic_cast< NameExpr * >( inner->arg ) ) {
    10421032                                if ( labels.count( nameExpr->name ) ) {
    1043                                         Label name = nameExpr->name;
    1044                                         delete addrExpr;
    1045                                         return new LabelAddressExpr( name );
     1033                                        return new LabelAddressExpr{ nameExpr->name };
    10461034                                }
    10471035                        }
Note: See TracChangeset for help on using the changeset viewer.