Ignore:
Timestamp:
Jan 17, 2024, 3:13:56 PM (6 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Children:
11f65b3
Parents:
e891349
Message:

Replayed maybeClone with maybeCopy, removed unused helppers in utility.h and pushed some includes out of headers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    re891349 r5bf685f  
    3535#include "Common/SemanticError.h"  // for SemanticError
    3636#include "Common/UniqueName.h"     // for UniqueName
    37 #include "Common/utility.h"        // for maybeClone
     37#include "Common/utility.h"        // for copy, spliceBegin
    3838#include "Parser/ExpressionNode.h" // for ExpressionNode
    3939#include "Parser/InitializerNode.h"// for InitializerNode
     
    4141#include "TypeData.h"              // for TypeData, TypeData::Aggregate_t
    4242#include "TypedefTable.h"          // for TypedefTable
    43 
    44 class Initializer;
    4543
    4644extern TypedefTable typedefTable;
     
    10199DeclarationNode * DeclarationNode::clone() const {
    102100        DeclarationNode * newnode = new DeclarationNode;
    103         newnode->set_next( maybeClone( get_next() ) );
     101        newnode->set_next( maybeCopy( get_next() ) );
    104102        newnode->name = name ? new string( *name ) : nullptr;
    105103
    106104        newnode->builtin = NoBuiltinType;
    107         newnode->type = maybeClone( type );
     105        newnode->type = maybeCopy( type );
    108106        newnode->inLine = inLine;
    109107        newnode->storageClasses = storageClasses;
    110108        newnode->funcSpecs = funcSpecs;
    111         newnode->bitfieldWidth = maybeClone( bitfieldWidth );
    112         newnode->enumeratorValue.reset( maybeClone( enumeratorValue.get() ) );
     109        newnode->bitfieldWidth = maybeCopy( bitfieldWidth );
     110        newnode->enumeratorValue.reset( maybeCopy( enumeratorValue.get() ) );
    113111        newnode->hasEllipsis = hasEllipsis;
    114112        newnode->linkage = linkage;
    115113        newnode->asmName = maybeCopy( asmName );
    116114        newnode->attributes = attributes;
    117         newnode->initializer = maybeClone( initializer );
     115        newnode->initializer = maybeCopy( initializer );
    118116        newnode->extension = extension;
    119         newnode->asmStmt = maybeClone( asmStmt );
     117        newnode->asmStmt = maybeCopy( asmStmt );
    120118        newnode->error = error;
    121119
    122120//      newnode->variable.name = variable.name ? new string( *variable.name ) : nullptr;
    123121        newnode->variable.tyClass = variable.tyClass;
    124         newnode->variable.assertions = maybeClone( variable.assertions );
    125         newnode->variable.initializer = maybeClone( variable.initializer );
    126 
    127         newnode->assert.condition = maybeClone( assert.condition );
     122        newnode->variable.assertions = maybeCopy( variable.assertions );
     123        newnode->variable.initializer = maybeCopy( variable.initializer );
     124
     125        newnode->assert.condition = maybeCopy( assert.condition );
    128126        newnode->assert.message = maybeCopy( assert.message );
    129127        return newnode;
     
    664662                                dst->base->aggInst.aggregate = src;
    665663                                if ( src->kind == TypeData::Aggregate ) {
    666                                         dst->base->aggInst.params = maybeClone( src->aggregate.actuals );
     664                                        dst->base->aggInst.params = maybeCopy( src->aggregate.actuals );
    667665                                } // if
    668666                                dst->base->qualifiers |= src->qualifiers;
     
    694692                                        if ( o->type->kind == TypeData::Aggregate ) {
    695693                                                type->aggInst.hoistType = o->type->aggregate.body;
    696                                                 type->aggInst.params = maybeClone( o->type->aggregate.actuals );
     694                                                type->aggInst.params = maybeCopy( o->type->aggregate.actuals );
    697695                                        } else {
    698696                                                type->aggInst.hoistType = o->type->enumeration.body;
     
    860858                                p->type->base->aggInst.aggregate = type;
    861859                                if ( type->kind == TypeData::Aggregate ) {
    862                                         p->type->base->aggInst.params = maybeClone( type->aggregate.actuals );
     860                                        p->type->base->aggInst.params = maybeCopy( type->aggregate.actuals );
    863861                                } // if
    864862                                p->type->base->qualifiers |= type->qualifiers;
     
    897895                        lastArray->base->aggInst.aggregate = type;
    898896                        if ( type->kind == TypeData::Aggregate ) {
    899                                 lastArray->base->aggInst.params = maybeClone( type->aggregate.actuals );
     897                                lastArray->base->aggInst.params = maybeCopy( type->aggregate.actuals );
    900898                        } // if
    901899                        lastArray->base->qualifiers |= type->qualifiers;
     
    950948DeclarationNode * DeclarationNode::cloneType( string * name ) {
    951949        DeclarationNode * newnode = newName( name );
    952         newnode->type = maybeClone( type );
     950        newnode->type = maybeCopy( type );
    953951        newnode->copySpecifiers( this );
    954952        return newnode;
     
    984982                } // if
    985983
    986                 newType->forall = maybeClone( type->forall );
     984                newType->forall = maybeCopy( type->forall );
    987985                if ( ! o->type ) {
    988986                        o->type = newType;
Note: See TracChangeset for help on using the changeset viewer.