Changeset 000b914 for src/ResolvExpr/AlternativeFinder.cc
- Timestamp:
- Dec 7, 2015, 11:31:53 AM (8 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:
- baf7fee
- Parents:
- e58be8e (diff), 47534159 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/AlternativeFinder.cc
re58be8e r000b914 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.