Ignore:
Timestamp:
Jun 1, 2018, 2:54:55 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, with_gc
Children:
262bd63
Parents:
41e16b1
git-author:
Aaron Moss <a3moss@…> (05/31/18 16:24:49)
git-committer:
Aaron Moss <a3moss@…> (06/01/18 14:54:55)
Message:

stop eagerly copying EqvClass? on lookup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/AdjustExprType.cc

    r41e16b1 r00ac42e  
    6666
    6767        Type * AdjustExprType::postmutate( ArrayType * arrayType ) {
    68                 PointerType *pointerType = new PointerType( arrayType->get_qualifiers(), arrayType->base );
     68                PointerType *pointerType = new PointerType{ arrayType->get_qualifiers(), arrayType->base };
    6969                arrayType->base = nullptr;
    7070                delete arrayType;
     
    7373
    7474        Type * AdjustExprType::postmutate( FunctionType * functionType ) {
    75                 return new PointerType( Type::Qualifiers(), functionType );
     75                return new PointerType{ Type::Qualifiers(), functionType };
    7676        }
    7777
    7878        Type * AdjustExprType::postmutate( TypeInstType * typeInst ) {
    79                 EqvClass eqvClass;
    80                 if ( env.lookup( typeInst->get_name(), eqvClass ) ) {
    81                         if ( eqvClass.data.kind == TypeDecl::Ftype ) {
    82                                 PointerType *pointerType = new PointerType( Type::Qualifiers(), typeInst );
    83                                 return pointerType;
     79                if ( const EqvClass* eqvClass = env.lookup( typeInst->get_name() ) ) {
     80                        if ( eqvClass->data.kind == TypeDecl::Ftype ) {
     81                                return new PointerType{ Type::Qualifiers(), typeInst };
    8482                        }
    8583                } else if ( NamedTypeDecl *ntDecl = indexer.lookupType( typeInst->get_name() ) ) {
    8684                        if ( TypeDecl *tyDecl = dynamic_cast< TypeDecl* >( ntDecl ) ) {
    8785                                if ( tyDecl->get_kind() == TypeDecl::Ftype ) {
    88                                         PointerType *pointerType = new PointerType( Type::Qualifiers(), typeInst );
    89                                         return pointerType;
     86                                        return new PointerType{ Type::Qualifiers(), typeInst };
    9087                                } // if
    9188                        } // if
Note: See TracChangeset for help on using the changeset viewer.