Changeset 8d70648 for src/GenPoly
- Timestamp:
- May 30, 2019, 4:15:08 PM (6 years ago)
- 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:
- a935892, f474e91
- Parents:
- d76c588 (diff), d88f8b3b (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. - Location:
- src/GenPoly
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/GenPoly/Box.cc ¶
rd76c588 r8d70648 657 657 paramExpr = new AddressExpr( paramExpr ); 658 658 } // if 659 arg = appExpr-> get_args().insert( arg, paramExpr ); // add argument to function call659 arg = appExpr->args.insert( arg, paramExpr ); // add argument to function call 660 660 arg++; 661 661 // Build a comma expression to call the function and emulate a normal return. 662 662 CommaExpr *commaExpr = new CommaExpr( appExpr, retExpr ); 663 commaExpr-> set_env( appExpr->get_env() );664 appExpr-> set_env( 0 );663 commaExpr->env = appExpr->env; 664 appExpr->env = nullptr; 665 665 return commaExpr; 666 666 } … … 708 708 // if ( ! function->get_returnVals().empty() && isPolyType( function->get_returnVals().front()->get_type(), tyVars ) ) { 709 709 if ( isDynRet( function, tyVars ) ) { 710 ret = addRetParam( appExpr, function-> get_returnVals().front()->get_type(), arg );710 ret = addRetParam( appExpr, function->returnVals.front()->get_type(), arg ); 711 711 } // if 712 712 std::string mangleName = mangleAdapterName( function, tyVars ); … … 715 715 // cast adaptee to void (*)(), since it may have any type inside a polymorphic function 716 716 Type * adapteeType = new PointerType( Type::Qualifiers(), new FunctionType( Type::Qualifiers(), true ) ); 717 appExpr->get_args().push_front( new CastExpr( appExpr-> get_function(), adapteeType ) );717 appExpr->get_args().push_front( new CastExpr( appExpr->function, adapteeType ) ); 718 718 appExpr->set_function( new NameExpr( adapterName ) ); // xxx - result is never set on NameExpr 719 719 -
TabularUnified src/GenPoly/GenPoly.cc ¶
rd76c588 r8d70648 468 468 469 469 void addToTyVarMap( TypeDecl * tyVar, TyVarMap &tyVarMap ) { 470 // xxx - should this actually be insert? 471 tyVarMap[ tyVar->get_name() ] = TypeDecl::Data{ tyVar }; 470 tyVarMap.insert( tyVar->name, TypeDecl::Data{ tyVar } ); 472 471 } 473 472 -
TabularUnified src/GenPoly/Lvalue.cc ¶
rd76c588 r8d70648 21 21 #include "Lvalue.h" 22 22 23 #include "InitTweak/InitTweak.h" 23 24 #include "Parser/LinkageSpec.h" // for Spec, isBuiltin, Intrinsic 24 25 #include "ResolvExpr/TypeEnvironment.h" // for AssertionSet, OpenVarSet 25 26 #include "ResolvExpr/Unify.h" // for unify 26 27 #include "ResolvExpr/typeops.h" 27 #include "SymTab/Autogen.h"28 28 #include "SymTab/Indexer.h" // for Indexer 29 29 #include "SynTree/Declaration.h" // for Declaration, FunctionDecl … … 33 33 #include "SynTree/Type.h" // for PointerType, Type, FunctionType 34 34 #include "SynTree/Visitor.h" // for Visitor, acceptAll 35 #include "Validate/FindSpecialDecls.h" // for dereferenceOperator 35 36 36 37 #if 0 … … 44 45 // TODO: fold this into the general createDeref function?? 45 46 Expression * mkDeref( Expression * arg ) { 46 if ( SymTab::dereferenceOperator ) {47 if ( Validate::dereferenceOperator ) { 47 48 // note: reference depth can be arbitrarily deep here, so peel off the outermost pointer/reference, not just pointer because they are effecitvely equivalent in this pass 48 VariableExpr * deref = new VariableExpr( SymTab::dereferenceOperator );49 VariableExpr * deref = new VariableExpr( Validate::dereferenceOperator ); 49 50 deref->result = new PointerType( Type::Qualifiers(), deref->result ); 50 51 Type * base = InitTweak::getPointerBase( arg->result ); … … 353 354 Type * destType = castExpr->result; 354 355 Type * srcType = castExpr->arg->result; 356 assertf( destType, "Cast to no type in: %s", toCString( castExpr ) ); 357 assertf( srcType, "Cast from no type in: %s", toCString( castExpr ) ); 355 358 int depth1 = destType->referenceDepth(); 356 359 int depth2 = srcType->referenceDepth(); -
TabularUnified src/GenPoly/ScopedSet.h ¶
rd76c588 r8d70648 38 38 typedef typename Scope::pointer pointer; 39 39 typedef typename Scope::const_pointer const_pointer; 40 40 41 41 class iterator : public std::iterator< std::bidirectional_iterator_tag, 42 42 value_type > { … … 72 72 return *this; 73 73 } 74 74 75 75 reference operator* () { return *it; } 76 76 pointer operator-> () { return it.operator->(); } … … 104 104 bool operator!= (const iterator &that) { return !( *this == that ); } 105 105 106 size_type get_level() const { return i; } 107 106 108 private: 107 109 scope_list const *scopes; … … 180 182 bool operator!= (const const_iterator &that) { return !( *this == that ); } 181 183 184 size_type get_level() const { return i; } 185 182 186 private: 183 187 scope_list const *scopes; … … 185 189 size_type i; 186 190 }; 187 191 188 192 /// Starts a new scope 189 193 void beginScope() { … … 222 226 return const_iterator( const_cast< ScopedSet< Value >* >(this)->find( key ) ); 223 227 } 224 228 225 229 /// Finds the given key in the outermost scope inside the given scope where it occurs 226 230 iterator findNext( const_iterator &it, const Value &key ) { … … 242 246 return std::make_pair( iterator(scopes, res.first, scopes.size()-1), res.second ); 243 247 } 244 248 245 249 }; 246 250 } // namespace GenPoly
Note: See TracChangeset
for help on using the changeset viewer.