Changeset 47534159 for src/ResolvExpr/AlternativeFinder.cc
- Timestamp:
- Dec 4, 2015, 2:55:22 PM (9 years ago)
- 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:
- 000b914, 63db3d76
- Parents:
- f8b961b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/AlternativeFinder.cc
rf8b961b r47534159 792 792 } 793 793 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 794 813 void AlternativeFinder::resolveAttr( DeclarationWithType *funcDecl, FunctionType *function, Type *argType, const TypeEnvironment &env ) { 795 814 // assume no polymorphism
Note: See TracChangeset
for help on using the changeset viewer.