Changeset e563edf for src


Ignore:
Timestamp:
Jan 17, 2023, 11:57:46 AM (16 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, ast-experimental, master
Children:
7b5694d
Parents:
9845cb6
Message:

Header Clean-up: Clearing out typeops, moving things to Unify because that header already exist.

Location:
src
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • src/AST/SymbolTable.cpp

    r9845cb6 re563edf  
    2828#include "InitTweak/InitTweak.h"
    2929#include "ResolvExpr/Cost.h"
    30 #include "ResolvExpr/typeops.h"
     30#include "ResolvExpr/typeops.h"     // for referenceToRvalueConversion
     31#include "ResolvExpr/Unify.h"
    3132#include "SymTab/Mangler.h"
    3233
  • src/GenPoly/Box.cc

    r9845cb6 re563edf  
    1414//
    1515
     16#include "Box.h"
     17
    1618#include <algorithm>                     // for mismatch
    1719#include <cassert>                       // for assert, strict_dynamic_cast
     
    2325#include <string>                        // for string, allocator, basic_string
    2426#include <utility>                       // for pair
    25 
    26 #include "Box.h"
    2727
    2828#include "CodeGen/OperatorTable.h"
     
    3737#include "InitTweak/InitTweak.h"         // for getFunctionName, isAssignment
    3838#include "Lvalue.h"                      // for generalizedLvalue
    39 #include "ResolvExpr/typeops.h"          // for typesCompatible
     39#include "ResolvExpr/Unify.h"            // for typesCompatible
    4040#include "ScopedSet.h"                   // for ScopedSet, ScopedSet<>::iter...
    4141#include "ScrubTyVars.h"                 // for ScrubTyVars
  • src/GenPoly/InstantiateGeneric.cc

    r9845cb6 re563edf  
    2828#include "GenPoly.h"                   // for isPolyType, typesPolyCompatible
    2929#include "InitTweak/InitTweak.h"
    30 #include "ResolvExpr/typeops.h"
     30#include "ResolvExpr/typeops.h"        // for adjustExprType
     31#include "ResolvExpr/Unify.h"          // for typesCompatible
    3132#include "ScopedSet.h"                 // for ScopedSet, ScopedSet<>::iterator
    3233#include "ScrubTyVars.h"               // for ScrubTyVars
  • src/GenPoly/InstantiateGenericNew.cpp

    r9845cb6 re563edf  
    3232#include "GenPoly/GenPoly.h"           // for isPolyType, typesPolyCompatible
    3333#include "GenPoly/ScrubTyVars.h"       // for scrubAll
    34 #include "ResolvExpr/typeops.h"        // for typesCompatible
     34#include "ResolvExpr/typeops.h"        // for adjustExprType
     35#include "ResolvExpr/Unify.h"          // for typesCompatible
    3536
    3637namespace GenPoly {
  • src/InitTweak/FixInit.cc

    r9845cb6 re563edf  
    3939#include "InitTweak.h"                 // for getFunctionName, getCallArg
    4040#include "ResolvExpr/Resolver.h"       // for findVoidExpression
    41 #include "ResolvExpr/typeops.h"        // for typesCompatible
     41#include "ResolvExpr/Unify.h"          // for typesCompatible
    4242#include "SymTab/Autogen.h"            // for genImplicitCall
    4343#include "SymTab/Indexer.h"            // for Indexer
  • src/InitTweak/FixInitNew.cpp

    r9845cb6 re563edf  
    2626#include "GenPoly/GenPoly.h"           // for getFunctionType
    2727#include "ResolvExpr/Resolver.h"       // for findVoidExpression
    28 #include "ResolvExpr/typeops.h"        // for typesCompatible
     28#include "ResolvExpr/Unify.h"          // for typesCompatible
    2929#include "SymTab/Autogen.h"            // for genImplicitCall
    3030#include "SymTab/Indexer.h"            // for Indexer
  • src/InitTweak/InitTweak.cc

    r9845cb6 re563edf  
    3535#include "GenPoly/GenPoly.h"       // for getFunctionType
    3636#include "InitTweak.h"
    37 #include "ResolvExpr/typeops.h"    // for typesCompatibleIgnoreQualifiers
     37#include "ResolvExpr/Unify.h"      // for typesCompatibleIgnoreQualifiers
    3838#include "SymTab/Autogen.h"
    3939#include "SymTab/Indexer.h"        // for Indexer
  • src/ResolvExpr/CastCost.cc

    r9845cb6 re563edf  
    2323#include "Cost.h"                        // for Cost, Cost::infinity
    2424#include "ResolvExpr/TypeEnvironment.h"  // for TypeEnvironment, EqvClass
     25#include "ResolvExpr/typeops.h"          // for ptrsCastable
     26#include "ResolvExpr/Unify.h"            // for typesCompatibleIgnoreQualifiers
    2527#include "SymTab/Indexer.h"              // for Indexer
    2628#include "SynTree/Declaration.h"         // for TypeDecl, NamedTypeDecl
    2729#include "SynTree/Type.h"                // for PointerType, Type, TypeInstType
    28 #include "typeops.h"                     // for typesCompatibleIgnoreQualifiers
    2930
    3031#if 0
  • src/ResolvExpr/Unify.cc

    r9845cb6 re563edf  
    5050
    5151namespace SymTab {
    52 class Indexer;
     52        class Indexer;
    5353}  // namespace SymTab
    5454
     
    5656
    5757namespace ResolvExpr {
     58
     59// Template Helpers:
     60template< typename Iterator1, typename Iterator2 >
     61bool unifyList( Iterator1 list1Begin, Iterator1 list1End, Iterator2 list2Begin, Iterator2 list2End, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, OpenVarSet &openVars, const SymTab::Indexer &indexer, std::list< Type* > &commonTypes ) {
     62        for ( ; list1Begin != list1End && list2Begin != list2End; ++list1Begin, ++list2Begin ) {
     63                Type *commonType = 0;
     64                if ( ! unify( *list1Begin, *list2Begin, env, needAssertions, haveAssertions, openVars, indexer, commonType ) ) {
     65                        return false;
     66                } // if
     67                commonTypes.push_back( commonType );
     68        } // for
     69        return ( list1Begin == list1End && list2Begin == list2End );
     70}
     71
     72template< typename Iterator1, typename Iterator2 >
     73bool unifyList( Iterator1 list1Begin, Iterator1 list1End, Iterator2 list2Begin, Iterator2 list2End, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, OpenVarSet &openVars, const SymTab::Indexer &indexer ) {
     74        std::list< Type* > commonTypes;
     75        if ( unifyList( list1Begin, list1End, list2Begin, list2End, env, needAssertions, haveAssertions,  openVars, indexer, commonTypes ) ) {
     76                deleteAll( commonTypes );
     77                return true;
     78        } else {
     79                return false;
     80        } // if
     81}
    5882
    5983        struct Unify_old : public WithShortCircuiting {
  • src/ResolvExpr/Unify.h

    r9845cb6 re563edf  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sun May 17 13:09:04 2015
    11 // Last Modified By : Aaron B. Moss
    12 // Last Modified On : Mon Jun 18 11:58:00 2018
    13 // Update Count     : 4
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Tue Jan 17 11:12:00 2023
     13// Update Count     : 5
    1414//
    1515
     
    3737
    3838namespace ResolvExpr {
    39         bool unify( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, OpenVarSet &openVars, const SymTab::Indexer &indexer );
    40         bool unify( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, OpenVarSet &openVars, const SymTab::Indexer &indexer, Type *&commonType );
    41         bool unifyExact( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, OpenVarSet &openVars, const SymTab::Indexer &indexer );
    42         bool unifyInexact( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, const OpenVarSet &openVars, WidenMode widen, const SymTab::Indexer &indexer, Type *&common );
    4339
    44         template< typename Iterator1, typename Iterator2 >
    45         bool unifyList( Iterator1 list1Begin, Iterator1 list1End, Iterator2 list2Begin, Iterator2 list2End, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, OpenVarSet &openVars, const SymTab::Indexer &indexer, std::list< Type* > &commonTypes ) {
    46                 for ( ; list1Begin != list1End && list2Begin != list2End; ++list1Begin, ++list2Begin ) {
    47                         Type *commonType = 0;
    48                         if ( ! unify( *list1Begin, *list2Begin, env, needAssertions, haveAssertions, openVars, indexer, commonType ) ) {
    49                                 return false;
    50                         } // if
    51                         commonTypes.push_back( commonType );
    52                 } // for
    53                 if ( list1Begin != list1End || list2Begin != list2End ) {
    54                         return false;
    55                 } else {
    56                         return true;
    57                 } // if
    58         }
     40bool unify( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, OpenVarSet &openVars, const SymTab::Indexer &indexer );
     41bool unify( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, OpenVarSet &openVars, const SymTab::Indexer &indexer, Type *&commonType );
     42bool unifyExact( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, OpenVarSet &openVars, const SymTab::Indexer &indexer );
     43bool unifyInexact( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, const OpenVarSet &openVars, WidenMode widen, const SymTab::Indexer &indexer, Type *&common );
    5944
    60         template< typename Iterator1, typename Iterator2 >
    61         bool unifyList( Iterator1 list1Begin, Iterator1 list1End, Iterator2 list2Begin, Iterator2 list2End, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, OpenVarSet &openVars, const SymTab::Indexer &indexer ) {
    62                 std::list< Type* > commonTypes;
    63                 if ( unifyList( list1Begin, list1End, list2Begin, list2End, env, needAssertions, haveAssertions, openVars, indexer, commonTypes ) ) {
    64                         deleteAll( commonTypes );
    65                         return true;
    66                 } else {
    67                         return false;
    68                 } // if
    69         }
     45bool typesCompatible( const Type *, const Type *, const SymTab::Indexer & indexer, const TypeEnvironment & env );
     46bool typesCompatibleIgnoreQualifiers( const Type *, const Type *, const SymTab::Indexer & indexer, const TypeEnvironment & env );
    7047
    71         bool unify(
    72                 const ast::ptr<ast::Type> & type1, const ast::ptr<ast::Type> & type2,
    73                 ast::TypeEnvironment & env, ast::AssertionSet & need, ast::AssertionSet & have,
    74                 ast::OpenVarSet & open, const ast::SymbolTable & symtab );
     48inline bool typesCompatible( const Type * t1, const Type * t2, const SymTab::Indexer & indexer ) {
     49        TypeEnvironment env;
     50        return typesCompatible( t1, t2, indexer, env );
     51}
    7552
    76         bool unify(
    77                 const ast::ptr<ast::Type> & type1, const ast::ptr<ast::Type> & type2,
    78                 ast::TypeEnvironment & env, ast::AssertionSet & need, ast::AssertionSet & have,
    79                 ast::OpenVarSet & open, const ast::SymbolTable & symtab, ast::ptr<ast::Type> & common );
     53inline bool typesCompatibleIgnoreQualifiers( const Type * t1, const Type * t2, const SymTab::Indexer & indexer ) {
     54        TypeEnvironment env;
     55        return typesCompatibleIgnoreQualifiers( t1, t2, indexer, env );
     56}
    8057
    81         bool unifyExact(
    82                 const ast::Type * type1, const ast::Type * type2, ast::TypeEnvironment & env,
    83                 ast::AssertionSet & need, ast::AssertionSet & have, const ast::OpenVarSet & open,
    84                 WidenMode widen, const ast::SymbolTable & symtab );
     58bool unify(
     59        const ast::ptr<ast::Type> & type1, const ast::ptr<ast::Type> & type2,
     60        ast::TypeEnvironment & env, ast::AssertionSet & need, ast::AssertionSet & have,
     61        ast::OpenVarSet & open, const ast::SymbolTable & symtab );
    8562
    86         bool unifyInexact(
    87                 const ast::ptr<ast::Type> & type1, const ast::ptr<ast::Type> & type2,
    88                 ast::TypeEnvironment & env, ast::AssertionSet & need, ast::AssertionSet & have,
    89                 const ast::OpenVarSet & open, WidenMode widen, const ast::SymbolTable & symtab,
    90                 ast::ptr<ast::Type> & common );
     63bool unify(
     64        const ast::ptr<ast::Type> & type1, const ast::ptr<ast::Type> & type2,
     65        ast::TypeEnvironment & env, ast::AssertionSet & need, ast::AssertionSet & have,
     66        ast::OpenVarSet & open, const ast::SymbolTable & symtab, ast::ptr<ast::Type> & common );
     67
     68bool unifyExact(
     69        const ast::Type * type1, const ast::Type * type2, ast::TypeEnvironment & env,
     70        ast::AssertionSet & need, ast::AssertionSet & have, const ast::OpenVarSet & open,
     71        WidenMode widen, const ast::SymbolTable & symtab );
     72
     73bool unifyInexact(
     74        const ast::ptr<ast::Type> & type1, const ast::ptr<ast::Type> & type2,
     75        ast::TypeEnvironment & env, ast::AssertionSet & need, ast::AssertionSet & have,
     76        const ast::OpenVarSet & open, WidenMode widen, const ast::SymbolTable & symtab,
     77        ast::ptr<ast::Type> & common );
     78
     79bool typesCompatible(
     80        const ast::Type *, const ast::Type *, const ast::SymbolTable & symtab = {},
     81        const ast::TypeEnvironment & env = {} );
     82
     83bool typesCompatibleIgnoreQualifiers(
     84        const ast::Type *, const ast::Type *, const ast::SymbolTable & symtab = {},
     85        const ast::TypeEnvironment & env = {} );
    9186
    9287} // namespace ResolvExpr
  • src/ResolvExpr/typeops.h

    r9845cb6 re563edf  
    107107                const ast::Type * src, const ast::Type * dst, const ast::SymbolTable & symtab,
    108108                const ast::TypeEnvironment & env );
    109 
    110         // in Unify.cc
    111         bool typesCompatible( const Type *, const Type *, const SymTab::Indexer & indexer, const TypeEnvironment & env );
    112         bool typesCompatibleIgnoreQualifiers( const Type *, const Type *, const SymTab::Indexer & indexer, const TypeEnvironment & env );
    113 
    114         inline bool typesCompatible( const Type * t1, const Type * t2, const SymTab::Indexer & indexer ) {
    115                 TypeEnvironment env;
    116                 return typesCompatible( t1, t2, indexer, env );
    117         }
    118 
    119         inline bool typesCompatibleIgnoreQualifiers( const Type * t1, const Type * t2, const SymTab::Indexer & indexer ) {
    120                 TypeEnvironment env;
    121                 return typesCompatibleIgnoreQualifiers( t1, t2, indexer, env );
    122         }
    123 
    124         bool typesCompatible(
    125                 const ast::Type *, const ast::Type *, const ast::SymbolTable & symtab = {},
    126                 const ast::TypeEnvironment & env = {} );
    127 
    128         bool typesCompatibleIgnoreQualifiers(
    129                 const ast::Type *, const ast::Type *, const ast::SymbolTable &,
    130                 const ast::TypeEnvironment & env = {} );
    131109
    132110        /// creates the type represented by the list of returnVals in a FunctionType. The caller owns the return value.
  • src/SymTab/Indexer.cc

    r9845cb6 re563edf  
    3131#include "InitTweak/InitTweak.h"   // for isConstructor, isCopyFunction, isC...
    3232#include "Mangler.h"               // for Mangler
    33 #include "ResolvExpr/typeops.h"    // for typesCompatible
     33#include "ResolvExpr/typeops.h"    // for referenceToRvalueConversion
     34#include "ResolvExpr/Unify.h"      // for typesCompatible
    3435#include "SynTree/LinkageSpec.h"   // for isMangled, isOverridable, Spec
    3536#include "SynTree/Constant.h"      // for Constant
  • src/SymTab/Validate.cc

    r9845cb6 re563edf  
    6363#include "InitTweak/GenInit.h"         // for fixReturnStatements
    6464#include "InitTweak/InitTweak.h"       // for isCtorDtorAssign
    65 #include "ResolvExpr/typeops.h"        // for typesCompatible
     65#include "ResolvExpr/typeops.h"        // for extractResultType
     66#include "ResolvExpr/Unify.h"          // for typesCompatible
    6667#include "ResolvExpr/Resolver.h"       // for findSingleExpression
    6768#include "ResolvExpr/ResolveTypeof.h"  // for resolveTypeof
  • src/Validate/ReplaceTypedef.cpp

    r9845cb6 re563edf  
    2020#include "Common/UniqueName.h"
    2121#include "Common/utility.h"
    22 #include "ResolvExpr/typeops.h"
     22#include "ResolvExpr/Unify.h"
    2323
    2424namespace Validate {
Note: See TracChangeset for help on using the changeset viewer.