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/FixFunction.cc

    r6171841 r68f9c43  
    2828
    2929        DeclarationWithType * FixFunction::postmutate(FunctionDecl *functionDecl) {
    30                 // can't delete function type because it may contain assertions, so transfer ownership to new object
    31                 ObjectDecl *pointer = new ObjectDecl( functionDecl->name, functionDecl->get_storageClasses(), functionDecl->linkage, nullptr, new PointerType( Type::Qualifiers(), functionDecl->type ), nullptr, functionDecl->attributes );
    32                 functionDecl->attributes.clear();
    33                 functionDecl->type = nullptr;
    34                 delete functionDecl;
    35                 return pointer;
     30                return new ObjectDecl{
     31                        functionDecl->name, functionDecl->get_storageClasses(), functionDecl->linkage, nullptr,
     32                        new PointerType{ Type::Qualifiers(), functionDecl->type },
     33                        nullptr, functionDecl->attributes };
    3634        }
    3735
     
    4240        Type * FixFunction::postmutate(ArrayType *arrayType) {
    4341                // need to recursively mutate the base type in order for multi-dimensional arrays to work.
    44                 PointerType *pointerType = new PointerType( arrayType->get_qualifiers(), arrayType->base, arrayType->dimension, arrayType->isVarLen, arrayType->isStatic );
    45                 arrayType->base = nullptr;
    46                 arrayType->dimension = nullptr;
    47                 delete arrayType;
    48                 return pointerType;
     42                return new PointerType{ arrayType->get_qualifiers(), arrayType->base, arrayType->dimension, arrayType->isVarLen, arrayType->isStatic };
    4943        }
    5044
Note: See TracChangeset for help on using the changeset viewer.