- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/AlternativeFinder.h
re472d54 ra8b27c6 21 21 22 22 #include "Alternative.h" // for AltList, Alternative 23 #include "ExplodedActual.h" // for ExplodedActual 23 24 #include "ResolvExpr/Cost.h" // for Cost, Cost::infinity 24 25 #include "ResolvExpr/TypeEnvironment.h" // for AssertionSet, OpenVarSet … … 31 32 32 33 namespace ResolvExpr { 34 class ArgPack; 35 36 /// First index is which argument, second index is which alternative for that argument, 37 /// third index is which exploded element of that alternative 38 using ExplodedArgs = std::vector< std::vector< ExplodedActual > >; 39 33 40 class AlternativeFinder : public Visitor { 34 41 public: … … 61 68 } 62 69 63 void find( Expression *expr, bool adjust = false, bool prune = true );70 void find( Expression *expr, bool adjust = false, bool prune = true, bool failFast = true ); 64 71 /// Calls find with the adjust flag set; adjustment turns array and function types into equivalent pointer types 65 void findWithAdjustment( Expression *expr, bool prune = true ); 72 void findWithAdjustment( Expression *expr ); 73 /// Calls find with the adjust flag set and prune flag unset; pruning ensures there is at most one alternative per result type 74 void findWithoutPrune( Expression *expr ); 75 /// Calls find with the adjust and prune flags set, failFast flags unset; fail fast ensures that there is at least one resulting alternative 76 void maybeFind( Expression *expr ); 66 77 AltList &get_alternatives() { return alternatives; } 67 78 … … 77 88 const SymTab::Indexer &get_indexer() const { return indexer; } 78 89 const TypeEnvironment &get_environ() const { return env; } 90 91 /// Runs a new alternative finder on each element in [begin, end) 92 /// and writes each alternative finder to out. 93 template< typename InputIterator, typename OutputIterator > 94 void findSubExprs( InputIterator begin, InputIterator end, OutputIterator out ); 79 95 private: 80 96 virtual void visit( ApplicationExpr *applicationExpr ); … … 108 124 virtual void visit( StmtExpr *stmtExpr ); 109 125 virtual void visit( UntypedInitExpr *initExpr ); 110 /// Runs a new alternative finder on each element in [begin, end)111 /// and writes each alternative finder to out.112 template< typename InputIterator, typename OutputIterator >113 void findSubExprs( InputIterator begin, InputIterator end, OutputIterator out );114 126 115 127 /// Adds alternatives for anonymous members … … 121 133 /// Adds alternatives for offsetof expressions, given the base type and name of the member 122 134 template< typename StructOrUnionType > void addOffsetof( StructOrUnionType *aggInst, const std::string &name ); 135 /// Takes a final result and checks if its assertions can be satisfied 123 136 template<typename OutputIterator> 124 void makeFunctionAlternatives( const Alternative &func, FunctionType *funcType, const std::vector< AlternativeFinder >& args, OutputIterator out ); 137 void validateFunctionAlternative( const Alternative &func, ArgPack& result, const std::vector<ArgPack>& results, OutputIterator out ); 138 /// Finds matching alternatives for a function, given a set of arguments 139 template<typename OutputIterator> 140 void makeFunctionAlternatives( const Alternative &func, FunctionType *funcType, const ExplodedArgs& args, OutputIterator out ); 141 /// Checks if assertion parameters match for a new alternative 125 142 template< typename OutputIterator > 126 143 void inferParameters( const AssertionSet &need, AssertionSet &have, const Alternative &newAlt, OpenVarSet &openVars, OutputIterator out ); … … 134 151 135 152 Expression *resolveInVoidContext( Expression *expr, const SymTab::Indexer &indexer, TypeEnvironment &env ); 153 void referenceToRvalueConversion( Expression *& expr ); 136 154 137 155 template< typename InputIterator, typename OutputIterator >
Note: See TracChangeset
for help on using the changeset viewer.