Ignore:
Timestamp:
Sep 20, 2022, 6:34:55 PM (2 years ago)
Author:
Fangren Yu <f37yu@…>
Branches:
ADT, ast-experimental, master, pthread-emulation
Children:
79ae13d, a065f1f
Parents:
8f1e035
Message:

try to make parameter qualifier conversion work for assertions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/ConversionCost.cc

    r8f1e035 ref1da0e2  
    2222#include "ResolvExpr/Cost.h"             // for Cost
    2323#include "ResolvExpr/TypeEnvironment.h"  // for EqvClass, TypeEnvironment
     24#include "ResolvExpr/Unify.h"
    2425#include "SymTab/Indexer.h"              // for Indexer
    2526#include "SynTree/Declaration.h"         // for TypeDecl, NamedTypeDecl
    2627#include "SynTree/Type.h"                // for Type, BasicType, TypeInstType
    2728#include "typeops.h"                     // for typesCompatibleIgnoreQualifiers
     29
    2830
    2931namespace ResolvExpr {
     
    655657                                cost = Cost::safe;
    656658                        }
    657                 } else {
     659                }
     660                /*
     661                else if ( const ast::FunctionType * dstFunc = dstAsPtr->base.as<ast::FunctionType>()) {
     662                        if (const ast::FunctionType * srcFunc = pointerType->base.as<ast::FunctionType>()) {
     663                                if (dstFunc->params.empty() && dstFunc->isVarArgs ) {
     664                                        cost = Cost::unsafe; // assign any function to variadic fptr
     665                                }
     666                        }
     667                        else {
     668                                ast::AssertionSet need, have; // unused
     669                                ast::OpenVarSet open;
     670                                env.extractOpenVars(open);
     671                                ast::TypeEnvironment tenv = env;
     672                                if ( unify(dstAsPtr->base, pointerType->base, tenv, need, have, open, symtab) ) {
     673                                        cost = Cost::safe;
     674                                }
     675                        }
     676                        // else infinity
     677                }
     678                */
     679                else {
    658680                        int assignResult = ptrsAssignable( pointerType->base, dstAsPtr->base, env );
    659681                        if ( 0 < assignResult && tq1 <= tq2 ) {
Note: See TracChangeset for help on using the changeset viewer.