Ignore:
Timestamp:
Aug 27, 2018, 4:40:34 PM (6 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
b7c89aa
Parents:
f9feab8 (diff), 305581d (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' into cleanup-dtors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/InitTweak.cc

    rf9feab8 r90152a4  
    225225                                        // xxx - this shouldn't be an error, but need a way to
    226226                                        // terminate without creating output, so should catch this error
    227                                         throw SemanticError( "unbalanced list initializers" );
     227                                        SemanticError( init->location, "unbalanced list initializers" );
    228228                                }
    229229
     
    296296                ObjectDecl * objDecl = dynamic_cast< ObjectDecl * >( dwt );
    297297                if ( ! objDecl ) return false;
    298                 return ! LinkageSpec::isBuiltin( objDecl->get_linkage() ) &&
    299                         (objDecl->get_init() == nullptr ||
     298                return (objDecl->get_init() == nullptr ||
    300299                                ( objDecl->get_init() != nullptr && objDecl->get_init()->get_maybeConstructed() ))
    301300                        && ! objDecl->get_storageClasses().is_extern
     
    409408                return allofCtorDtor( stmt, []( Expression * callExpr ){
    410409                        if ( ApplicationExpr * appExpr = isIntrinsicCallExpr( callExpr ) ) {
    411                                 FunctionType *funcType = GenPoly::getFunctionType( appExpr->get_function()->get_result() );
     410                                FunctionType *funcType = GenPoly::getFunctionType( appExpr->function->result );
    412411                                assert( funcType );
    413412                                return funcType->get_parameters().size() == 1;
     
    529528                }
    530529                if ( dynamic_cast< ReferenceType * >( dst->result ) ) {
    531                         dst = new AddressExpr( dst );
     530                        for (int depth = dst->result->referenceDepth(); depth > 0; depth--) {
     531                                dst = new AddressExpr( dst );
     532                        }
    532533                } else {
    533534                        dst = new CastExpr( dst, new ReferenceType( noQualifiers, dst->result->clone() ) );
    534535                }
    535536                if ( dynamic_cast< ReferenceType * >( src->result ) ) {
    536                         src = new CastExpr( src, new ReferenceType( noQualifiers, src->result->stripReferences()->clone() ) );
     537                        for (int depth = src->result->referenceDepth(); depth > 0; depth--) {
     538                                src = new AddressExpr( src );
     539                        }
     540                        // src = new CastExpr( src, new ReferenceType( noQualifiers, src->result->stripReferences()->clone() ) );
    537541                }
    538542                return new ApplicationExpr( VariableExpr::functionPointer( assign ), { dst, src } );
     
    564568                void previsit( ConstantExpr * ) {}
    565569
     570                void previsit( VariableExpr * varExpr ) {
     571                        visit_children = false;
     572
     573                        if ( EnumInstType * inst = dynamic_cast< EnumInstType * >( varExpr->result ) ) {
     574                                long long int value;
     575                                if ( inst->baseEnum->valueOf( varExpr->var, value ) ) {
     576                                        // enumerators are const expr
     577                                        return;
     578                                }
     579                        }
     580                        isConstExpr = false;
     581                }
     582
    566583                bool isConstExpr = true;
    567584        };
Note: See TracChangeset for help on using the changeset viewer.