Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/AlternativeFinder.h

    re472d54 ra8b27c6  
    2121
    2222#include "Alternative.h"                 // for AltList, Alternative
     23#include "ExplodedActual.h"              // for ExplodedActual
    2324#include "ResolvExpr/Cost.h"             // for Cost, Cost::infinity
    2425#include "ResolvExpr/TypeEnvironment.h"  // for AssertionSet, OpenVarSet
     
    3132
    3233namespace 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       
    3340        class AlternativeFinder : public Visitor {
    3441          public:
     
    6168                }
    6269
    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 );
    6471                /// 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 );
    6677                AltList &get_alternatives() { return alternatives; }
    6778
     
    7788                const SymTab::Indexer &get_indexer() const { return indexer; }
    7889                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 );
    7995          private:
    8096                virtual void visit( ApplicationExpr *applicationExpr );
     
    108124                virtual void visit( StmtExpr *stmtExpr );
    109125                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 );
    114126
    115127                /// Adds alternatives for anonymous members
     
    121133                /// Adds alternatives for offsetof expressions, given the base type and name of the member
    122134                template< typename StructOrUnionType > void addOffsetof( StructOrUnionType *aggInst, const std::string &name );
     135                /// Takes a final result and checks if its assertions can be satisfied
    123136                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
    125142                template< typename OutputIterator >
    126143                void inferParameters( const AssertionSet &need, AssertionSet &have, const Alternative &newAlt, OpenVarSet &openVars, OutputIterator out );
     
    134151
    135152        Expression *resolveInVoidContext( Expression *expr, const SymTab::Indexer &indexer, TypeEnvironment &env );
     153        void referenceToRvalueConversion( Expression *& expr );
    136154
    137155        template< typename InputIterator, typename OutputIterator >
Note: See TracChangeset for help on using the changeset viewer.