Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Validate.cc

    rf53836b rbd7e609  
    668668                }
    669669                filter( translationUnit, isTypedef, true );
     670
    670671        }
    671672
     
    675676                TypedefMap::const_iterator def = typedefNames.find( typeInst->get_name() );
    676677                if ( def != typedefNames.end() ) {
    677                         Type *ret = def->second.first->base->clone();
     678                        Type *ret = def->second.first->get_base()->clone();
    678679                        ret->get_qualifiers() |= typeInst->get_qualifiers();
    679680                        // place instance parameters on the typedef'd type
    680                         if ( ! typeInst->parameters.empty() ) {
     681                        if ( ! typeInst->get_parameters().empty() ) {
    681682                                ReferenceToType *rtt = dynamic_cast<ReferenceToType*>(ret);
    682683                                if ( ! rtt ) {
    683                                         throw SemanticError("Cannot apply type parameters to base type of " + typeInst->name);
     684                                        throw SemanticError("cannot apply type parameters to base type of " + typeInst->get_name());
    684685                                }
    685686                                rtt->get_parameters().clear();
    686                                 cloneAll( typeInst->parameters, rtt->parameters );
    687                                 mutateAll( rtt->parameters, *visitor );  // recursively fix typedefs on parameters
     687                                cloneAll( typeInst->get_parameters(), rtt->get_parameters() );
     688                                mutateAll( rtt->get_parameters(), *visitor );  // recursively fix typedefs on parameters
    688689                        } // if
    689690                        delete typeInst;
     
    691692                } else {
    692693                        TypeDeclMap::const_iterator base = typedeclNames.find( typeInst->get_name() );
    693                         assertf( base != typedeclNames.end(), "Cannot find typedecl name %s", typeInst->name.c_str() );
     694                        assertf( base != typedeclNames.end(), "Cannot find typedecl name %s", typeInst->get_name().c_str() );
    694695                        typeInst->set_baseType( base->second );
    695696                } // if
    696697                return typeInst;
    697         }
    698 
    699         struct VarLenChecker : WithShortCircuiting {
    700                 void previsit( FunctionType * ) { visit_children = false; }
    701                 void previsit( ArrayType * at ) {
    702                         isVarLen |= at->isVarLen;
    703                 }
    704                 bool isVarLen = false;
    705         };
    706 
    707         bool isVariableLength( Type * t ) {
    708                 PassVisitor<VarLenChecker> varLenChecker;
    709                 maybeAccept( t, varLenChecker );
    710                 return varLenChecker.pass.isVarLen;
    711698        }
    712699
     
    719706                        Type * t2 = typedefNames[ tyDecl->get_name() ].first->get_base();
    720707                        if ( ! ResolvExpr::typesCompatible( t1, t2, Indexer() ) ) {
    721                                 throw SemanticError( "Cannot redefine typedef: " + tyDecl->name );
    722                         }
    723                         // cannot redefine VLA typedefs
    724                         if ( isVariableLength( t1 ) || isVariableLength( t2 ) ) {
    725                                 throw SemanticError( "Cannot redefine typedef: " + tyDecl->name );
     708                                throw SemanticError( "cannot redefine typedef: " + tyDecl->get_name() );
    726709                        }
    727710                } else {
Note: See TracChangeset for help on using the changeset viewer.