Ignore:
Timestamp:
Oct 4, 2016, 11:25:00 AM (9 years ago)
Author:
Aaron Moss <a3moss@…>
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:
40744af8, a7976d79
Parents:
6295081 (diff), 4b1fd2c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/TypeData.cc

    r6295081 r19b5d6b  
    1010// Created On       : Sat May 16 15:12:51 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Sep 12 21:11:22 2016
    13 // Update Count     : 377
     12// Last Modified On : Sat Sep 24 11:14:26 2016
     13// Update Count     : 415
    1414//
    1515
     
    2424#include "SynTree/Statement.h"
    2525#include "SynTree/Initializer.h"
    26 
    27 TypeData::TypeData( Kind k ) : kind( k ), base( 0 ), forall( 0 ) {
     26using namespace std;
     27
     28TypeData::TypeData( Kind k ) : kind( k ), base( nullptr ), forall( nullptr ) {
    2829        switch ( kind ) {
    2930          case Unknown:
     
    3738          case Array:
    3839                // array = new Array_t;
    39                 array.dimension = 0;
     40                array.dimension = nullptr;
    4041                array.isVarLen = false;
    4142                array.isStatic = false;
     
    4344          case Function:
    4445                // function = new Function_t;
    45                 function.params = 0;
    46                 function.idList = 0;
    47                 function.oldDeclList = 0;
    48                 function.body = 0;
     46                function.params = nullptr;
     47                function.idList = nullptr;
     48                function.oldDeclList = nullptr;
     49                function.body = nullptr;
    4950                function.hasBody = false;
    5051                function.newStyle = false;
     
    5253          case Aggregate:
    5354                // aggregate = new Aggregate_t;
    54                 aggregate.params = 0;
    55                 aggregate.actuals = 0;
    56                 aggregate.fields = 0;
     55                aggregate.name = nullptr;
     56                aggregate.params = nullptr;
     57                aggregate.actuals = nullptr;
     58                aggregate.fields = nullptr;
    5759                break;
    5860          case AggregateInst:
    5961                // aggInst = new AggInst_t;
    60                 aggInst.aggregate = 0;
    61                 aggInst.params = 0;
     62                aggInst.aggregate = nullptr;
     63                aggInst.params = nullptr;
    6264                break;
    6365          case Enum:
    6466                // enumeration = new Enumeration_t;
    65                 enumeration.constants = 0;
     67                enumeration.name = nullptr;
     68                enumeration.constants = nullptr;
    6669                break;
    6770          case Symbolic:
    6871          case SymbolicInst:
    6972                // symbolic = new Symbolic_t;
    70                 symbolic.params = 0;
    71                 symbolic.actuals = 0;
    72                 symbolic.assertions = 0;
    73                 break;
    74           case Variable:
    75                 // variable = new Variable_t;
    76                 // variable.tyClass = DeclarationNode::Type;
    77                 // variable.assertions = 0;
     73                symbolic.name = nullptr;
     74                symbolic.params = nullptr;
     75                symbolic.actuals = nullptr;
     76                symbolic.assertions = nullptr;
    7877                break;
    7978          case Tuple:
     
    8483                // typeexpr = new Typeof_t;
    8584                typeexpr = nullptr;
    86                 break;
    87           case Attr:
    88                 // attr = new Attr_t;
    89                 // attr.expr = nullptr;
    90                 // attr.type = nullptr;
    9185                break;
    9286          case Builtin:
     
    121115                break;
    122116          case Aggregate:
     117                delete aggregate.name;
    123118                delete aggregate.params;
    124119                delete aggregate.actuals;
     
    132127                break;
    133128          case Enum:
     129                delete enumeration.name;
    134130                delete enumeration.constants;
    135131                // delete enumeration;
     
    137133          case Symbolic:
    138134          case SymbolicInst:
     135                delete symbolic.name;
    139136                delete symbolic.params;
    140137                delete symbolic.actuals;
     
    142139                // delete symbolic;
    143140                break;
    144           case Variable:
    145                 // delete variable.assertions;
    146                 // delete variable;
    147                 break;
    148141          case Tuple:
    149142                // delete tuple->members;
     
    153146                // delete typeexpr->expr;
    154147                delete typeexpr;
    155                 break;
    156           case Attr:
    157                 // delete attr.expr;
    158                 // delete attr.type;
    159                 // delete attr;
    160148                break;
    161149          case Builtin:
     
    197185                break;
    198186          case Aggregate:
     187                newtype->aggregate.name = aggregate.name ? new string( *aggregate.name ) : nullptr;
    199188                newtype->aggregate.params = maybeClone( aggregate.params );
    200189                newtype->aggregate.actuals = maybeClone( aggregate.actuals );
    201190                newtype->aggregate.fields = maybeClone( aggregate.fields );
    202                 newtype->aggregate.name = aggregate.name;
    203191                newtype->aggregate.kind = aggregate.kind;
    204192                newtype->aggregate.body = aggregate.body;
     
    209197                break;
    210198          case Enum:
    211                 newtype->enumeration.name = enumeration.name;
     199                newtype->enumeration.name = enumeration.name ? new string( *enumeration.name ) : nullptr;
    212200                newtype->enumeration.constants = maybeClone( enumeration.constants );
    213201                break;
    214202          case Symbolic:
    215203          case SymbolicInst:
     204                newtype->symbolic.name = symbolic.name ? new string( *symbolic.name ) : nullptr;
    216205                newtype->symbolic.params = maybeClone( symbolic.params );
    217206                newtype->symbolic.actuals = maybeClone( symbolic.actuals );
    218207                newtype->symbolic.assertions = maybeClone( symbolic.assertions );
    219208                newtype->symbolic.isTypedef = symbolic.isTypedef;
    220                 newtype->symbolic.name = symbolic.name;
    221                 break;
    222           case Variable:
    223                 assert( false );
    224                 // newtype->variable.assertions = maybeClone( variable.assertions );
    225                 // newtype->variable.name = variable.name;
    226                 // newtype->variable.tyClass = variable.tyClass;
    227209                break;
    228210          case Tuple:
     
    231213          case Typeof:
    232214                newtype->typeexpr = maybeClone( typeexpr );
    233                 break;
    234           case Attr:
    235                 assert( false );
    236                 // newtype->attr.expr = maybeClone( attr.expr );
    237                 // newtype->attr.type = maybeClone( attr.type );
    238215                break;
    239216          case Builtin:
     
    245222} // TypeData::clone
    246223
    247 void TypeData::print( std::ostream &os, int indent ) const {
    248         using std::endl;
    249         using std::string;
    250 
     224void TypeData::print( ostream &os, int indent ) const {
    251225        for ( int i = 0; i < DeclarationNode::NoQualifier; i += 1 ) {
    252226                if ( qualifiers[i] ) os << DeclarationNode::qualifierName[ i ] << ' ';
     
    326300                break;
    327301          case Aggregate:
    328                 os << DeclarationNode::aggregateName[ aggregate.kind ] << ' ' << aggregate.name << endl;
     302                os << DeclarationNode::aggregateName[ aggregate.kind ] << ' ' << *aggregate.name << endl;
    329303                if ( aggregate.params ) {
    330304                        os << string( indent + 2, ' ' ) << "with type parameters " << endl;
     
    363337                break;
    364338          case SymbolicInst:
    365                 os << "instance of type " << symbolic.name;
     339                os << "instance of type " << *symbolic.name;
    366340                if ( symbolic.actuals ) {
    367341                        os << " with parameters" << endl;
     
    389363                } // if
    390364                break;
    391           case Variable:
    392                 // os << DeclarationNode::typeClassName[ variable.tyClass ] << " variable ";
    393                 // if ( variable.assertions ) {
    394                 //      os << endl << string( indent + 2, ' ' ) << "with assertions" << endl;
    395                 //      variable.assertions->printList( os, indent + 4 );
    396                 //      os << string( indent + 2, ' ' );
    397                 // } // if
    398                 break;
    399365          case Tuple:
    400366                os << "tuple ";
     
    410376                } // if
    411377                break;
    412           case Attr:
    413                 // os << "attribute type decl " << attr.name << " applied to ";
    414                 // if ( attr.expr ) {
    415                 //      attr.expr->print( os, indent + 2 );
    416                 // } // if
    417                 // if ( attr.type ) {
    418                 //      attr.type->print( os, indent + 2 );
    419                 // } // if
    420                 break;
    421378          case Builtin:
    422379                os << "gcc builtin type";
     
    428385} // TypeData::print
    429386
    430 void buildForall( const DeclarationNode * firstNode, std::list< TypeDecl* > &outputList ) {
     387void buildForall( const DeclarationNode * firstNode, list< TypeDecl* > &outputList ) {
    431388        buildList( firstNode, outputList );
    432         for ( std::list< TypeDecl* >::iterator i = outputList.begin(); i != outputList.end(); ++i ) {
     389        for ( list< TypeDecl* >::iterator i = outputList.begin(); i != outputList.end(); ++i ) {
    433390                if ( (*i)->get_kind() == TypeDecl::Any ) {
    434391                        // add assertion parameters to `type' tyvars in reverse order
    435392                        // add dtor:  void ^?{}(T *)
    436393                        FunctionType * dtorType = new FunctionType( Type::Qualifiers(), false );
    437                         dtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ) ), 0 ) );
    438                         (*i)->get_assertions().push_front( new FunctionDecl( "^?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, dtorType, 0, false, false ) );
     394                        dtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ) ), nullptr ) );
     395                        (*i)->get_assertions().push_front( new FunctionDecl( "^?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, dtorType, nullptr, false, false ) );
    439396
    440397                        // add copy ctor:  void ?{}(T *, T)
    441398                        FunctionType * copyCtorType = new FunctionType( Type::Qualifiers(), false );
    442                         copyCtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ) ), 0 ) );
    443                         copyCtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ), 0 ) );
    444                         (*i)->get_assertions().push_front( new FunctionDecl( "?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, copyCtorType, 0, false, false ) );
     399                        copyCtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ) ), nullptr ) );
     400                        copyCtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ), nullptr ) );
     401                        (*i)->get_assertions().push_front( new FunctionDecl( "?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, copyCtorType, nullptr, false, false ) );
    445402
    446403                        // add default ctor:  void ?{}(T *)
    447404                        FunctionType * ctorType = new FunctionType( Type::Qualifiers(), false );
    448                         ctorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ) ), 0 ) );
    449                         (*i)->get_assertions().push_front( new FunctionDecl( "?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, ctorType, 0, false, false ) );
     405                        ctorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ) ), nullptr ) );
     406                        (*i)->get_assertions().push_front( new FunctionDecl( "?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, ctorType, nullptr, false, false ) );
    450407
    451408                        // add assignment operator:  T * ?=?(T *, T)
    452409                        FunctionType * assignType = new FunctionType( Type::Qualifiers(), false );
    453                         assignType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ) ), 0 ) );
    454                         assignType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ), 0 ) );
    455                         assignType->get_returnVals().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ), 0 ) );
    456                         (*i)->get_assertions().push_front( new FunctionDecl( "?=?", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, assignType, 0, false, false ) );
     410                        assignType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ) ), nullptr ) );
     411                        assignType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ), nullptr ) );
     412                        assignType->get_returnVals().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ), nullptr ) );
     413                        (*i)->get_assertions().push_front( new FunctionDecl( "?=?", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, assignType, nullptr, false, false ) );
    457414                } // if
    458415        } // for
     
    486443          case TypeData::Builtin:
    487444                return new VarArgsType( buildQualifiers( td ) );
    488           case TypeData::Attr:
    489                 assert( false );
    490                 return buildAttr( td );
    491445          case TypeData::Symbolic:
    492446          case TypeData::Enum:
    493447          case TypeData::Aggregate:
    494           case TypeData::Variable:
    495448                assert( false );
    496449        } // switch
    497         return 0;
     450        return nullptr;
    498451} // typebuild
    499452
    500453TypeData * typeextractAggregate( const TypeData * td, bool toplevel ) {
    501         TypeData * ret = 0;
     454        TypeData * ret = nullptr;
    502455
    503456        switch ( td->kind ) {
     
    549502          case DeclarationNode::Bool:
    550503                if ( td->signedness != DeclarationNode::NoSignedness ) {
    551                         throw SemanticError( std::string( "invalid type specifier " ) + DeclarationNode::signednessName[ td->signedness ] + " in type: ", td );
     504                        throw SemanticError( string( "invalid type specifier " ) + DeclarationNode::signednessName[ td->signedness ] + " in type: ", td );
    552505                } // if
    553506                if ( td->length != DeclarationNode::NoLength ) {
    554                         throw SemanticError( std::string( "invalid type specifier " ) + DeclarationNode::lengthName[ td->length ] + " in type: ", td );
     507                        throw SemanticError( string( "invalid type specifier " ) + DeclarationNode::lengthName[ td->length ] + " in type: ", td );
    555508                } // if
    556509
     
    565518
    566519                if ( td->length != DeclarationNode::NoLength ) {
    567                         throw SemanticError( std::string( "invalid type specifier " ) + DeclarationNode::lengthName[ td->length ] + " in type: ", td );
     520                        throw SemanticError( string( "invalid type specifier " ) + DeclarationNode::lengthName[ td->length ] + " in type: ", td );
    568521                } // if
    569522
     
    595548          FloatingPoint: ;
    596549                if ( td->signedness != DeclarationNode::NoSignedness ) {
    597                         throw SemanticError( std::string( "invalid type specifier " ) + DeclarationNode::signednessName[ td->signedness ] + " in type: ", td );
     550                        throw SemanticError( string( "invalid type specifier " ) + DeclarationNode::signednessName[ td->signedness ] + " in type: ", td );
    598551                } // if
    599552                if ( td->length == DeclarationNode::Short || td->length == DeclarationNode::LongLong ) {
    600                         throw SemanticError( std::string( "invalid type specifier " ) + DeclarationNode::lengthName[ td->length ] + " in type: ", td );
     553                        throw SemanticError( string( "invalid type specifier " ) + DeclarationNode::lengthName[ td->length ] + " in type: ", td );
    601554                } // if
    602555                if ( td->basictype == DeclarationNode::Float && td->length == DeclarationNode::Long ) {
     
    655608        switch ( td->aggregate.kind ) {
    656609          case DeclarationNode::Struct:
    657                 at = new StructDecl( td->aggregate.name );
     610                at = new StructDecl( *td->aggregate.name );
    658611                buildForall( td->aggregate.params, at->get_parameters() );
    659612                break;
    660613          case DeclarationNode::Union:
    661                 at = new UnionDecl( td->aggregate.name );
     614                at = new UnionDecl( *td->aggregate.name );
    662615                buildForall( td->aggregate.params, at->get_parameters() );
    663616                break;
    664617          case DeclarationNode::Trait:
    665                 at = new TraitDecl( td->aggregate.name );
     618                at = new TraitDecl( *td->aggregate.name );
    666619                buildList( td->aggregate.params, at->get_parameters() );
    667620                break;
     
    681634        ReferenceToType * ret;
    682635        if ( td->aggInst.aggregate->kind == TypeData::Enum ) {
    683                 ret = new EnumInstType( buildQualifiers( td ), td->aggInst.aggregate->enumeration.name );
     636                ret = new EnumInstType( buildQualifiers( td ), *td->aggInst.aggregate->enumeration.name );
    684637        } else {
    685638                assert( td->aggInst.aggregate->kind == TypeData::Aggregate );
    686639                switch ( td->aggInst.aggregate->aggregate.kind ) {
    687640                  case DeclarationNode::Struct:
    688                         ret = new StructInstType( buildQualifiers( td ), td->aggInst.aggregate->aggregate.name );
     641                        assert( td->aggInst.aggregate->aggregate.name );
     642                        ret = new StructInstType( buildQualifiers( td ), *td->aggInst.aggregate->aggregate.name );
    689643                        break;
    690644                  case DeclarationNode::Union:
    691                         ret = new UnionInstType( buildQualifiers( td ), td->aggInst.aggregate->aggregate.name );
     645                        ret = new UnionInstType( buildQualifiers( td ), *td->aggInst.aggregate->aggregate.name );
    692646                        break;
    693647                  case DeclarationNode::Trait:
    694                         ret = new TraitInstType( buildQualifiers( td ), td->aggInst.aggregate->aggregate.name );
     648                        ret = new TraitInstType( buildQualifiers( td ), *td->aggInst.aggregate->aggregate.name );
    695649                        break;
    696650                  default:
     
    703657} // buildAggInst
    704658
    705 NamedTypeDecl * buildSymbolic( const TypeData * td, const std::string & name, DeclarationNode::StorageClass sc ) {
     659NamedTypeDecl * buildSymbolic( const TypeData * td, const string & name, DeclarationNode::StorageClass sc ) {
    706660        assert( td->kind == TypeData::Symbolic );
    707661        NamedTypeDecl * ret;
     
    717671} // buildSymbolic
    718672
    719 TypeDecl * buildVariable( const TypeData * td ) {
    720         assert( false );
    721         return nullptr;
    722         // assert( td->kind == TypeData::Variable );
    723         // static const TypeDecl::Kind kindMap[] = { TypeDecl::Any, TypeDecl::Ftype, TypeDecl::Dtype };
    724 
    725         // TypeDecl * ret = new TypeDecl( td->variable.name, DeclarationNode::NoStorageClass, 0, kindMap[ td->variable.tyClass ] );
    726         // buildList( td->variable.assertions, ret->get_assertions() );
    727         // return ret;
    728 } // buildSymbolic
    729 
    730673EnumDecl * buildEnum( const TypeData * td ) {
    731674        assert( td->kind == TypeData::Enum );
    732         EnumDecl * ret = new EnumDecl( td->enumeration.name );
     675        EnumDecl * ret = new EnumDecl( *td->enumeration.name );
    733676        buildList( td->enumeration.constants, ret->get_members() );
    734         std::list< Declaration * >::iterator members = ret->get_members().begin();
     677        list< Declaration * >::iterator members = ret->get_members().begin();
    735678        for ( const DeclarationNode * cur = td->enumeration. constants; cur != nullptr; cur = dynamic_cast< DeclarationNode * >( cur->get_next() ), ++members ) {
    736679                if ( cur->has_enumeratorValue() ) {
    737680                        ObjectDecl * member = dynamic_cast< ObjectDecl * >(* members);
    738                         member->set_init( new SingleInit( maybeMoveBuild< Expression >( cur->consume_enumeratorValue() ), std::list< Expression * >() ) );
     681                        member->set_init( new SingleInit( maybeMoveBuild< Expression >( cur->consume_enumeratorValue() ), list< Expression * >() ) );
    739682                } // if
    740683        } // for
     
    744687TypeInstType * buildSymbolicInst( const TypeData * td ) {
    745688        assert( td->kind == TypeData::SymbolicInst );
    746         TypeInstType * ret = new TypeInstType( buildQualifiers( td ), td->symbolic.name, false );
     689        TypeInstType * ret = new TypeInstType( buildQualifiers( td ), *td->symbolic.name, false );
    747690        buildList( td->symbolic.actuals, ret->get_parameters() );
    748691        buildForall( td->forall, ret->get_forall() );
     
    765708} // buildTypeof
    766709
    767 AttrType * buildAttr( const TypeData * td ) {
    768         assert( false );
    769         return nullptr;
    770         // assert( td->kind == TypeData::Attr );
    771         // // assert( td->attr );
    772         // AttrType * ret;
    773         // if ( td->attr.expr ) {
    774         //      ret = new AttrType( buildQualifiers( td ), td->attr.name, td->attr.expr->build() );
    775         // } else {
    776         //      assert( td->attr.type );
    777         //      ret = new AttrType( buildQualifiers( td ), td->attr.name, td->attr.type->buildType() );
    778         // } // if
    779         // return ret;
    780 } // buildAttr
    781 
    782 Declaration * buildDecl( const TypeData * td, std::string name, DeclarationNode::StorageClass sc, Expression * bitfieldWidth, bool isInline, bool isNoreturn, LinkageSpec::Spec linkage, Initializer * init ) {
     710Declaration * buildDecl( const TypeData * td, const string &name, DeclarationNode::StorageClass sc, Expression * bitfieldWidth, bool isInline, bool isNoreturn, LinkageSpec::Spec linkage, Initializer * init ) {
    783711        if ( td->kind == TypeData::Function ) {
    784712                FunctionDecl * decl;
     
    790718                                decl = new FunctionDecl( name, sc, linkage, buildFunction( td ), body, isInline, isNoreturn );
    791719                        } else {
    792                                 // std::list< Label > ls;
    793                                 decl = new FunctionDecl( name, sc, linkage, buildFunction( td ), new CompoundStmt( std::list< Label >() ), isInline, isNoreturn );
     720                                // list< Label > ls;
     721                                decl = new FunctionDecl( name, sc, linkage, buildFunction( td ), new CompoundStmt( list< Label >() ), isInline, isNoreturn );
    794722                        } // if
    795723                } else {
    796                         decl = new FunctionDecl( name, sc, linkage, buildFunction( td ), 0, isInline, isNoreturn );
    797                 } // if
    798                 for ( DeclarationNode * cur = td->function.idList; cur != 0; cur = dynamic_cast< DeclarationNode* >( cur->get_next() ) ) {
    799                         if ( cur->get_name() != "" ) {
    800                                 decl->get_oldIdents().insert( decl->get_oldIdents().end(), cur->get_name() );
     724                        decl = new FunctionDecl( name, sc, linkage, buildFunction( td ), nullptr, isInline, isNoreturn );
     725                } // if
     726                for ( DeclarationNode * cur = td->function.idList; cur != nullptr; cur = dynamic_cast< DeclarationNode* >( cur->get_next() ) ) {
     727                        if ( cur->name ) {
     728                                decl->get_oldIdents().insert( decl->get_oldIdents().end(), *cur->name );
    801729                        } // if
    802730                } // for
     
    809737        } else if ( td->kind == TypeData::Symbolic ) {
    810738                return buildSymbolic( td, name, sc );
    811         } else if ( td->kind == TypeData::Variable ) {
    812                 assert( false );
    813                 return buildVariable( td );
    814739        } else {
    815                 return new ObjectDecl( name, sc, linkage, bitfieldWidth, typebuild( td ), init, std::list< Attribute * >(), isInline, isNoreturn );
     740                return new ObjectDecl( name, sc, linkage, bitfieldWidth, typebuild( td ), init, list< Attribute * >(), isInline, isNoreturn );
    816741        } // if
    817         return 0;
     742        return nullptr;
    818743} // buildDecl
    819744
     
    831756                        break;
    832757                  default:
    833                         ft->get_returnVals().push_back( dynamic_cast< DeclarationWithType* >( buildDecl( td->base,  "", DeclarationNode::NoStorageClass, 0, false, false, LinkageSpec::Cforall ) ) );
     758                        ft->get_returnVals().push_back( dynamic_cast< DeclarationWithType* >( buildDecl( td->base,  "", DeclarationNode::NoStorageClass, nullptr, false, false, LinkageSpec::Cforall ) ) );
    834759                } // switch
    835760        } else {
    836                 ft->get_returnVals().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), 0 ) );
     761                ft->get_returnVals().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr ) );
    837762        } // if
    838763        return ft;
Note: See TracChangeset for help on using the changeset viewer.