Changeset f57dd25 for src/ResolvExpr


Ignore:
Timestamp:
May 29, 2019, 3:45:00 PM (6 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
0aedb01
Parents:
157a816 (diff), ebc0a85 (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 branch 'cleanup-dtors'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/Resolver.cc

    r157a816 rf57dd25  
    4343#include "typeops.h"                     // for extractResultType
    4444#include "Unify.h"                       // for unify
     45#include "Validate/FindSpecialDecls.h"   // for SizeType
    4546
    4647using namespace std;
     
    235236                                winner.cost = winner.cvtCost;
    236237                        }
    237                        
     238
    238239                        // produce ambiguous errors, if applicable
    239240                        if ( winners.size() != 1 ) {
     
    255256
    256257                        // xxx - check for ambiguous expressions
    257                        
     258
    258259                        // output selected choice
    259260                        alt = std::move( choice );
     
    402403
    403404        void Resolver::previsit( ObjectDecl * objectDecl ) {
    404                 // To handle initialization of routine pointers, e.g., int (*fp)(int) = foo(), means that 
    405                 // class-variable initContext is changed multiple time because the LHS is analysed twice. 
    406                 // The second analysis changes initContext because of a function type can contain object 
    407                 // declarations in the return and parameter types. So each value of initContext is 
     405                // To handle initialization of routine pointers, e.g., int (*fp)(int) = foo(), means that
     406                // class-variable initContext is changed multiple time because the LHS is analysed twice.
     407                // The second analysis changes initContext because of a function type can contain object
     408                // declarations in the return and parameter types. So each value of initContext is
    408409                // retained, so the type on the first analysis is preserved and used for selecting the RHS.
    409410                GuardValue( currentObject );
     
    419420        void Resolver::handlePtrType( PtrType * type ) {
    420421                if ( type->get_dimension() ) {
    421                         findSingleExpression( type->dimension, SymTab::SizeType->clone(), indexer );
     422                        findSingleExpression( type->dimension, Validate::SizeType->clone(), indexer );
    422423                }
    423424        }
     
    442443
    443444        void Resolver::postvisit( FunctionDecl * functionDecl ) {
    444                 // default value expressions have an environment which shouldn't be there and trips up 
     445                // default value expressions have an environment which shouldn't be there and trips up
    445446                // later passes.
    446                 // xxx - it might be necessary to somehow keep the information from this environment, but I 
     447                // xxx - it might be necessary to somehow keep the information from this environment, but I
    447448                // can't currently see how it's useful.
    448449                for ( Declaration * d : functionDecl->type->parameters ) {
     
    795796                initExpr->expr = nullptr;
    796797                std::swap( initExpr->env, newExpr->env );
    797                 // InitExpr may have inferParams in the case where the expression specializes a function 
    798                 // pointer, and newExpr may already have inferParams of its own, so a simple swap is not 
     798                // InitExpr may have inferParams in the case where the expression specializes a function
     799                // pointer, and newExpr may already have inferParams of its own, so a simple swap is not
    799800                // sufficient.
    800801                newExpr->spliceInferParams( initExpr );
    801802                delete initExpr;
    802803
    803                 // get the actual object's type (may not exactly match what comes back from the resolver 
     804                // get the actual object's type (may not exactly match what comes back from the resolver
    804805                // due to conversions)
    805806                Type * initContext = currentObject.getCurrentType();
     
    814815                                        if ( isCharType( pt->get_base() ) ) {
    815816                                                if ( CastExpr * ce = dynamic_cast< CastExpr * >( newExpr ) ) {
    816                                                         // strip cast if we're initializing a char[] with a char *, 
     817                                                        // strip cast if we're initializing a char[] with a char *,
    817818                                                        // e.g.  char x[] = "hello";
    818819                                                        newExpr = ce->get_arg();
     
    837838                // move cursor into brace-enclosed initializer-list
    838839                currentObject.enterListInit();
    839                 // xxx - fix this so that the list isn't copied, iterator should be used to change current 
     840                // xxx - fix this so that the list isn't copied, iterator should be used to change current
    840841                // element
    841842                std::list<Designation *> newDesignations;
    842843                for ( auto p : group_iterate(listInit->get_designations(), listInit->get_initializers()) ) {
    843                         // iterate designations and initializers in pairs, moving the cursor to the current 
     844                        // iterate designations and initializers in pairs, moving the cursor to the current
    844845                        // designated object and resolving the initializer against that object.
    845846                        Designation * des = std::get<0>(p);
Note: See TracChangeset for help on using the changeset viewer.