Changeset 839ccbb for src/SynTree


Ignore:
Timestamp:
Nov 20, 2015, 4:19:13 PM (10 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
Children:
5189888
Parents:
05587c2 (diff), ed94eac (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.
git-author:
Peter A. Buhr <pabuhr@…> (11/20/15 12:51:58)
git-committer:
Peter A. Buhr <pabuhr@…> (11/20/15 16:19:13)
Message:

Merge branch 'master' of plg2:software/cfa/cfa-cc

Location:
src/SynTree
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Mutator.h

    r05587c2 r839ccbb  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jul 23 23:24:18 2015
    13 // Update Count     : 7
     12// Last Modified On : Thu Nov 19 22:26:16 2015
     13// Update Count     : 8
    1414//
    1515#include <cassert>
     
    103103inline TreeType *maybeMutate( TreeType *tree, MutatorType &mutator ) {
    104104        if ( tree ) {
    105                 TreeType *newnode = dynamic_cast< TreeType* >( tree->acceptMutator( mutator ) );
     105                TreeType *newnode = dynamic_cast< TreeType * >( tree->acceptMutator( mutator ) );
    106106                assert( newnode );
    107107                return newnode;
  • src/SynTree/ReferenceToType.cc

    r05587c2 r839ccbb  
    5959std::string StructInstType::typeString() const { return "struct"; }
    6060
    61 std::list<TypeDecl*>& StructInstType::get_baseParameters() { return baseStruct->get_parameters(); }
     61std::list<TypeDecl*>* StructInstType::get_baseParameters() {
     62        if ( ! baseStruct ) return NULL;
     63        return &baseStruct->get_parameters();
     64}
    6265
    6366void StructInstType::lookup( const std::string &name, std::list< Declaration* > &foundDecls ) const {
     
    6871std::string UnionInstType::typeString() const { return "union"; }
    6972
    70 std::list<TypeDecl*>& UnionInstType::get_baseParameters() { return baseUnion->get_parameters(); }
     73std::list<TypeDecl*>* UnionInstType::get_baseParameters() {
     74        if ( ! baseUnion ) return NULL;
     75        return &baseUnion->get_parameters();
     76}
    7177
    7278void UnionInstType::lookup( const std::string &name, std::list< Declaration* > &foundDecls ) const {
  • src/SynTree/Type.h

    r05587c2 r839ccbb  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jul  9 16:46:15 2015
    13 // Update Count     : 14
     12// Last Modified On : Fri Nov 20 12:54:09 2015
     13// Update Count     : 15
    1414//
    1515
     
    201201        std::list<DeclarationWithType*> parameters;
    202202
    203         // does the function accept a variable number of arguments following the arguments
    204         // specified in the parameters list.    This could be because of
     203        // Does the function accept a variable number of arguments following the arguments specified in the parameters list.
     204        // This could be because of
    205205        // - an ellipsis in a prototype declaration
    206206        // - an unprototyped declaration
     
    238238        void set_baseStruct( StructDecl *newValue ) { baseStruct = newValue; }
    239239
    240         /// Accesses generic parameters of base struct
    241         std::list<TypeDecl*>& get_baseParameters();
     240        /// Accesses generic parameters of base struct (NULL if none such)
     241        std::list<TypeDecl*> * get_baseParameters();
    242242       
    243243        /// Looks up the members of this struct named "name" and places them into "foundDecls".
     
    265265        void set_baseUnion( UnionDecl *newValue ) { baseUnion = newValue; }
    266266
    267         /// Accesses generic parameters of base union
    268         std::list<TypeDecl*>& get_baseParameters();
     267        /// Accesses generic parameters of base union (NULL if none such)
     268        std::list<TypeDecl*> * get_baseParameters();
    269269       
    270270        /// looks up the members of this union named "name" and places them into "foundDecls"
  • src/SynTree/TypeSubstitution.cc

    r05587c2 r839ccbb  
    147147        } // if
    148148        // bind type variables from generic type instantiations
    149         for ( std::list< TypeDecl* >::const_iterator tyvar = type->get_baseParameters().begin(); tyvar != type->get_baseParameters().end(); ++tyvar ) {
    150                 boundVars.insert( (*tyvar)->get_name() );
    151         } // for
     149        std::list< TypeDecl* > *baseParameters = type->get_baseParameters();
     150        if ( baseParameters && ! type->get_parameters().empty() ) {
     151                for ( std::list< TypeDecl* >::const_iterator tyvar = baseParameters->begin(); tyvar != baseParameters->end(); ++tyvar ) {
     152                        boundVars.insert( (*tyvar)->get_name() );
     153                } // for
     154        } // if
    152155        Type *ret = Mutator::mutate( type );
    153156        boundVars = oldBoundVars;
Note: See TracChangeset for help on using the changeset viewer.