Ignore:
Timestamp:
Feb 28, 2017, 1:49:12 PM (7 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:
14f6bb39
Parents:
31868da (diff), cc7f4b1 (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

    r31868da rfd061ed3  
    1010// Created On       : Sat May 16 15:12:51 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb 23 16:26:39 2017
    13 // Update Count     : 477
     12// Last Modified On : Thu Feb 23 21:48:55 2017
     13// Update Count     : 485
    1414//
    1515
     
    6262                aggInst.aggregate = nullptr;
    6363                aggInst.params = nullptr;
     64                aggInst.hoistType = false;;
    6465                break;
    6566          case Enum:
     
    195196                newtype->aggInst.aggregate = maybeClone( aggInst.aggregate );
    196197                newtype->aggInst.params = maybeClone( aggInst.params );
     198                newtype->aggInst.hoistType = aggInst.hoistType;
    197199                break;
    198200          case Enum:
     
    644646} // buildAggregate
    645647
     648ReferenceToType * buildComAggInst( const TypeData * type, std::list< Attribute * > attributes ) {
     649        switch ( type->kind ) {
     650          case TypeData::Enum: {
     651                  if ( type->enumeration.body ) {
     652                          EnumDecl * typedecl = buildEnum( type, attributes );
     653                          return new EnumInstType( buildQualifiers( type ), typedecl );
     654                  } else {
     655                          return new EnumInstType( buildQualifiers( type ), *type->enumeration.name );
     656                  } // if
     657          }
     658          case TypeData::Aggregate: {
     659                  ReferenceToType * ret;
     660                  if ( type->aggregate.body ) {
     661                          AggregateDecl * typedecl = buildAggregate( type, attributes );
     662                          switch ( type->aggregate.kind ) {
     663                                case DeclarationNode::Struct:
     664                                  ret = new StructInstType( buildQualifiers( type ), (StructDecl *)typedecl );
     665                                  break;
     666                                case DeclarationNode::Union:
     667                                  ret = new UnionInstType( buildQualifiers( type ), (UnionDecl *)typedecl );
     668                                  break;
     669                                case DeclarationNode::Trait:
     670                                  assert( false );
     671                                  //ret = new TraitInstType( buildQualifiers( type ), (TraitDecl *)typedecl );
     672                                  break;
     673                                default:
     674                                  assert( false );
     675                          } // switch
     676                  } else {
     677                          switch ( type->aggregate.kind ) {
     678                                case DeclarationNode::Struct:
     679                                  ret = new StructInstType( buildQualifiers( type ), *type->aggregate.name );
     680                                  break;
     681                                case DeclarationNode::Union:
     682                                  ret = new UnionInstType( buildQualifiers( type ), *type->aggregate.name );
     683                                  break;
     684                                case DeclarationNode::Trait:
     685                                  ret = new TraitInstType( buildQualifiers( type ), *type->aggregate.name );
     686                                  break;
     687                                default:
     688                                  assert( false );
     689                          } // switch
     690                  } // if
     691                  return ret;
     692          }
     693          default:
     694                assert( false );
     695        } // switch
     696} // buildAggInst
     697
    646698ReferenceToType * buildAggInst( const TypeData * td ) {
    647699        assert( td->kind == TypeData::AggregateInst );
    648700
    649         ReferenceToType * ret;
    650         if ( td->aggInst.aggregate->kind == TypeData::Enum ) {
    651                 ret = new EnumInstType( buildQualifiers( td ), *td->aggInst.aggregate->enumeration.name );
    652         } else {
    653                 assert( td->aggInst.aggregate->kind == TypeData::Aggregate );
    654                 switch ( td->aggInst.aggregate->aggregate.kind ) {
    655                   case DeclarationNode::Struct:
    656                         assert( td->aggInst.aggregate->aggregate.name );
    657                         ret = new StructInstType( buildQualifiers( td ), *td->aggInst.aggregate->aggregate.name );
    658                         break;
    659                   case DeclarationNode::Union:
    660                         ret = new UnionInstType( buildQualifiers( td ), *td->aggInst.aggregate->aggregate.name );
    661                         break;
    662                   case DeclarationNode::Trait:
    663                         ret = new TraitInstType( buildQualifiers( td ), *td->aggInst.aggregate->aggregate.name );
    664                         break;
    665                   default:
    666                         assert( false );
    667                 } // switch
    668         } // if
     701        // ReferenceToType * ret = buildComAggInst( td->aggInst.aggregate, std::list< Attribute * >() );
     702        ReferenceToType * ret = nullptr;
     703        TypeData * type = td->aggInst.aggregate;
     704        switch ( type->kind ) {
     705          case TypeData::Enum: {
     706                  return new EnumInstType( buildQualifiers( type ), *type->enumeration.name );
     707          }
     708          case TypeData::Aggregate: {
     709                  switch ( type->aggregate.kind ) {
     710                        case DeclarationNode::Struct:
     711                          ret = new StructInstType( buildQualifiers( type ), *type->aggregate.name );
     712                          break;
     713                        case DeclarationNode::Union:
     714                          ret = new UnionInstType( buildQualifiers( type ), *type->aggregate.name );
     715                          break;
     716                        case DeclarationNode::Trait:
     717                          ret = new TraitInstType( buildQualifiers( type ), *type->aggregate.name );
     718                          break;
     719                        default:
     720                          assert( false );
     721                  } // switch
     722          }
     723          break;
     724          default:
     725                assert( false );
     726        } // switch
     727
     728        ret->set_hoistType( td->aggInst.hoistType );
    669729        buildList( td->aggInst.params, ret->get_parameters() );
    670730        buildForall( td->forall, ret->get_forall() );
Note: See TracChangeset for help on using the changeset viewer.