Changeset e563edf
- Timestamp:
- Jan 17, 2023, 11:57:46 AM (11 months ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- 7b5694d
- Parents:
- 9845cb6
- Location:
- src
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/SymbolTable.cpp
r9845cb6 re563edf 28 28 #include "InitTweak/InitTweak.h" 29 29 #include "ResolvExpr/Cost.h" 30 #include "ResolvExpr/typeops.h" 30 #include "ResolvExpr/typeops.h" // for referenceToRvalueConversion 31 #include "ResolvExpr/Unify.h" 31 32 #include "SymTab/Mangler.h" 32 33 -
src/GenPoly/Box.cc
r9845cb6 re563edf 14 14 // 15 15 16 #include "Box.h" 17 16 18 #include <algorithm> // for mismatch 17 19 #include <cassert> // for assert, strict_dynamic_cast … … 23 25 #include <string> // for string, allocator, basic_string 24 26 #include <utility> // for pair 25 26 #include "Box.h"27 27 28 28 #include "CodeGen/OperatorTable.h" … … 37 37 #include "InitTweak/InitTweak.h" // for getFunctionName, isAssignment 38 38 #include "Lvalue.h" // for generalizedLvalue 39 #include "ResolvExpr/ typeops.h"// for typesCompatible39 #include "ResolvExpr/Unify.h" // for typesCompatible 40 40 #include "ScopedSet.h" // for ScopedSet, ScopedSet<>::iter... 41 41 #include "ScrubTyVars.h" // for ScrubTyVars -
src/GenPoly/InstantiateGeneric.cc
r9845cb6 re563edf 28 28 #include "GenPoly.h" // for isPolyType, typesPolyCompatible 29 29 #include "InitTweak/InitTweak.h" 30 #include "ResolvExpr/typeops.h" 30 #include "ResolvExpr/typeops.h" // for adjustExprType 31 #include "ResolvExpr/Unify.h" // for typesCompatible 31 32 #include "ScopedSet.h" // for ScopedSet, ScopedSet<>::iterator 32 33 #include "ScrubTyVars.h" // for ScrubTyVars -
src/GenPoly/InstantiateGenericNew.cpp
r9845cb6 re563edf 32 32 #include "GenPoly/GenPoly.h" // for isPolyType, typesPolyCompatible 33 33 #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 35 36 36 37 namespace GenPoly { -
src/InitTweak/FixInit.cc
r9845cb6 re563edf 39 39 #include "InitTweak.h" // for getFunctionName, getCallArg 40 40 #include "ResolvExpr/Resolver.h" // for findVoidExpression 41 #include "ResolvExpr/ typeops.h"// for typesCompatible41 #include "ResolvExpr/Unify.h" // for typesCompatible 42 42 #include "SymTab/Autogen.h" // for genImplicitCall 43 43 #include "SymTab/Indexer.h" // for Indexer -
src/InitTweak/FixInitNew.cpp
r9845cb6 re563edf 26 26 #include "GenPoly/GenPoly.h" // for getFunctionType 27 27 #include "ResolvExpr/Resolver.h" // for findVoidExpression 28 #include "ResolvExpr/ typeops.h"// for typesCompatible28 #include "ResolvExpr/Unify.h" // for typesCompatible 29 29 #include "SymTab/Autogen.h" // for genImplicitCall 30 30 #include "SymTab/Indexer.h" // for Indexer -
src/InitTweak/InitTweak.cc
r9845cb6 re563edf 35 35 #include "GenPoly/GenPoly.h" // for getFunctionType 36 36 #include "InitTweak.h" 37 #include "ResolvExpr/ typeops.h"// for typesCompatibleIgnoreQualifiers37 #include "ResolvExpr/Unify.h" // for typesCompatibleIgnoreQualifiers 38 38 #include "SymTab/Autogen.h" 39 39 #include "SymTab/Indexer.h" // for Indexer -
src/ResolvExpr/CastCost.cc
r9845cb6 re563edf 23 23 #include "Cost.h" // for Cost, Cost::infinity 24 24 #include "ResolvExpr/TypeEnvironment.h" // for TypeEnvironment, EqvClass 25 #include "ResolvExpr/typeops.h" // for ptrsCastable 26 #include "ResolvExpr/Unify.h" // for typesCompatibleIgnoreQualifiers 25 27 #include "SymTab/Indexer.h" // for Indexer 26 28 #include "SynTree/Declaration.h" // for TypeDecl, NamedTypeDecl 27 29 #include "SynTree/Type.h" // for PointerType, Type, TypeInstType 28 #include "typeops.h" // for typesCompatibleIgnoreQualifiers29 30 30 31 #if 0 -
src/ResolvExpr/Unify.cc
r9845cb6 re563edf 50 50 51 51 namespace SymTab { 52 class Indexer;52 class Indexer; 53 53 } // namespace SymTab 54 54 … … 56 56 57 57 namespace ResolvExpr { 58 59 // Template Helpers: 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, 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 72 template< typename Iterator1, typename Iterator2 > 73 bool 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 } 58 82 59 83 struct Unify_old : public WithShortCircuiting { -
src/ResolvExpr/Unify.h
r9845cb6 re563edf 9 9 // Author : Richard C. Bilson 10 10 // Created On : Sun May 17 13:09:04 2015 11 // Last Modified By : A aron B. Moss12 // Last Modified On : Mon Jun 18 11:58:00 201813 // Update Count : 411 // Last Modified By : Andrew Beach 12 // Last Modified On : Tue Jan 17 11:12:00 2023 13 // Update Count : 5 14 14 // 15 15 … … 37 37 38 38 namespace 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 );43 39 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 } 40 bool unify( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, OpenVarSet &openVars, const SymTab::Indexer &indexer ); 41 bool unify( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, OpenVarSet &openVars, const SymTab::Indexer &indexer, Type *&commonType ); 42 bool unifyExact( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, OpenVarSet &openVars, const SymTab::Indexer &indexer ); 43 bool unifyInexact( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, const OpenVarSet &openVars, WidenMode widen, const SymTab::Indexer &indexer, Type *&common ); 59 44 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 } 45 bool typesCompatible( const Type *, const Type *, const SymTab::Indexer & indexer, const TypeEnvironment & env ); 46 bool typesCompatibleIgnoreQualifiers( const Type *, const Type *, const SymTab::Indexer & indexer, const TypeEnvironment & env ); 70 47 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 ); 48 inline bool typesCompatible( const Type * t1, const Type * t2, const SymTab::Indexer & indexer ) { 49 TypeEnvironment env; 50 return typesCompatible( t1, t2, indexer, env ); 51 } 75 52 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 ); 53 inline bool typesCompatibleIgnoreQualifiers( const Type * t1, const Type * t2, const SymTab::Indexer & indexer ) { 54 TypeEnvironment env; 55 return typesCompatibleIgnoreQualifiers( t1, t2, indexer, env ); 56 } 80 57 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 );58 bool 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 ); 85 62 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 ); 63 bool 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 68 bool 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 73 bool 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 79 bool typesCompatible( 80 const ast::Type *, const ast::Type *, const ast::SymbolTable & symtab = {}, 81 const ast::TypeEnvironment & env = {} ); 82 83 bool typesCompatibleIgnoreQualifiers( 84 const ast::Type *, const ast::Type *, const ast::SymbolTable & symtab = {}, 85 const ast::TypeEnvironment & env = {} ); 91 86 92 87 } // namespace ResolvExpr -
src/ResolvExpr/typeops.h
r9845cb6 re563edf 107 107 const ast::Type * src, const ast::Type * dst, const ast::SymbolTable & symtab, 108 108 const ast::TypeEnvironment & env ); 109 110 // in Unify.cc111 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 = {} );131 109 132 110 /// creates the type represented by the list of returnVals in a FunctionType. The caller owns the return value. -
src/SymTab/Indexer.cc
r9845cb6 re563edf 31 31 #include "InitTweak/InitTweak.h" // for isConstructor, isCopyFunction, isC... 32 32 #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 34 35 #include "SynTree/LinkageSpec.h" // for isMangled, isOverridable, Spec 35 36 #include "SynTree/Constant.h" // for Constant -
src/SymTab/Validate.cc
r9845cb6 re563edf 63 63 #include "InitTweak/GenInit.h" // for fixReturnStatements 64 64 #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 66 67 #include "ResolvExpr/Resolver.h" // for findSingleExpression 67 68 #include "ResolvExpr/ResolveTypeof.h" // for resolveTypeof -
src/Validate/ReplaceTypedef.cpp
r9845cb6 re563edf 20 20 #include "Common/UniqueName.h" 21 21 #include "Common/utility.h" 22 #include "ResolvExpr/ typeops.h"22 #include "ResolvExpr/Unify.h" 23 23 24 24 namespace Validate {
Note: See TracChangeset
for help on using the changeset viewer.