Ignore:
Timestamp:
Jan 7, 2016, 11:28:48 AM (8 years ago)
Author:
Rob Schluntz <rschlunt@…>
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, with_gc
Children:
1e9d87b
Parents:
267cb3d (diff), de91427b (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 with master

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/AlternativeFinder.cc

    r267cb3d r083cf31  
    792792        }
    793793
     794        void AlternativeFinder::visit( AlignofExpr *alignofExpr ) {
     795                if ( alignofExpr->get_isType() ) {
     796                        alternatives.push_back( Alternative( alignofExpr->clone(), env, Cost::zero ) );
     797                } else {
     798                        // find all alternatives for the argument to sizeof
     799                        AlternativeFinder finder( indexer, env );
     800                        finder.find( alignofExpr->get_expr() );
     801                        // find the lowest cost alternative among the alternatives, otherwise ambiguous
     802                        AltList winners;
     803                        findMinCost( finder.alternatives.begin(), finder.alternatives.end(), back_inserter( winners ) );
     804                        if ( winners.size() != 1 ) {
     805                                throw SemanticError( "Ambiguous expression in alignof operand: ", alignofExpr->get_expr() );
     806                        } // if
     807                        // return the lowest cost alternative for the argument
     808                        Alternative &choice = winners.front();
     809                        alternatives.push_back( Alternative( new AlignofExpr( choice.expr->clone() ), choice.env, Cost::zero ) );
     810                } // if
     811        }
     812
    794813        void AlternativeFinder::resolveAttr( DeclarationWithType *funcDecl, FunctionType *function, Type *argType, const TypeEnvironment &env ) {
    795814                // assume no polymorphism
Note: See TracChangeset for help on using the changeset viewer.