Changeset bbbc067
- Timestamp:
- Jan 29, 2019, 4:30:46 PM (5 years ago)
- Branches:
- no_list
- Children:
- 8d25360
- Parents:
- bee0694
- Location:
- src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Concurrency/Keywords.cc
rbee0694 rbbbc067 621 621 ), 622 622 new ListInit( 623 map_range < std:: list<Initializer*> > ( args, [](DeclarationWithType * var ){623 map_range < std::vector< Initializer * > > ( args, [](DeclarationWithType * var ){ 624 624 Type * type = var->get_type()->clone(); 625 625 type->set_mutex( false ); -
src/Concurrency/Waitfor.cc
rbee0694 rbbbc067 371 371 ), 372 372 new ListInit( 373 map_range < std:: list<Initializer*> > ( clause.target.arguments, [this](Expression * expr ){373 map_range < std::vector< Initializer * > > ( clause.target.arguments, [this](Expression * expr ){ 374 374 Expression * init = new CastExpr( 375 375 new UntypedExpr( -
src/GenPoly/Box.cc
rbee0694 rbbbc067 1823 1823 1824 1824 // build initializer list for offset array 1825 std:: list< Initializer* > inits;1825 std::vector< Initializer * > inits; 1826 1826 for ( std::list< Declaration* >::const_iterator member = baseMembers.begin(); member != baseMembers.end(); ++member ) { 1827 1827 if ( DeclarationWithType *memberDecl = dynamic_cast< DeclarationWithType* >( *member ) ) { -
src/Parser/InitializerNode.cc
rbee0694 rbbbc067 96 96 designlist.push_back( new Designation( desList ) ); 97 97 } // for 98 std:: list< Initializer * > initlist;98 std::vector< Initializer * > initlist; 99 99 buildList< Initializer, InitializerNode >( next_init(), initlist ); 100 100 return new ListInit( initlist, designlist, maybeConstructed ); -
src/ResolvExpr/Resolver.cc
rbee0694 rbbbc067 80 80 void previsit( ConstructorInit *ctorInit ); 81 81 private: 82 typedef std:: list< Initializer * >::iterator InitIterator;82 typedef std::vector< Initializer * >::iterator InitIterator; 83 83 84 84 template< typename PtrType > … … 235 235 winner.cost = winner.cvtCost; 236 236 } 237 237 238 238 // produce ambiguous errors, if applicable 239 239 if ( winners.size() != 1 ) { … … 255 255 256 256 // xxx - check for ambiguous expressions 257 257 258 258 // output selected choice 259 259 alt = std::move( choice ); … … 402 402 403 403 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 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 408 408 // retained, so the type on the first analysis is preserved and used for selecting the RHS. 409 409 GuardValue( currentObject ); … … 442 442 443 443 void Resolver::postvisit( FunctionDecl *functionDecl ) { 444 // default value expressions have an environment which shouldn't be there and trips up 444 // default value expressions have an environment which shouldn't be there and trips up 445 445 // later passes. 446 // xxx - it might be necessary to somehow keep the information from this environment, but I 446 // xxx - it might be necessary to somehow keep the information from this environment, but I 447 447 // can't currently see how it's useful. 448 448 for ( Declaration * d : functionDecl->type->parameters ) { … … 795 795 initExpr->expr = nullptr; 796 796 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 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 799 799 // sufficient. 800 800 newExpr->spliceInferParams( initExpr ); 801 801 delete initExpr; 802 802 803 // get the actual object's type (may not exactly match what comes back from the resolver 803 // get the actual object's type (may not exactly match what comes back from the resolver 804 804 // due to conversions) 805 805 Type * initContext = currentObject.getCurrentType(); … … 814 814 if ( isCharType( pt->get_base() ) ) { 815 815 if ( CastExpr *ce = dynamic_cast< CastExpr * >( newExpr ) ) { 816 // strip cast if we're initializing a char[] with a char *, 816 // strip cast if we're initializing a char[] with a char *, 817 817 // e.g. char x[] = "hello"; 818 818 newExpr = ce->get_arg(); … … 837 837 // move cursor into brace-enclosed initializer-list 838 838 currentObject.enterListInit(); 839 // xxx - fix this so that the list isn't copied, iterator should be used to change current 839 // xxx - fix this so that the list isn't copied, iterator should be used to change current 840 840 // element 841 841 std::list<Designation *> newDesignations; 842 842 for ( auto p : group_iterate(listInit->get_designations(), listInit->get_initializers()) ) { 843 // iterate designations and initializers in pairs, moving the cursor to the current 843 // iterate designations and initializers in pairs, moving the cursor to the current 844 844 // designated object and resolving the initializer against that object. 845 845 Designation * des = std::get<0>(p); -
src/SymTab/Validate.cc
rbee0694 rbbbc067 1226 1226 TupleType * tupleType = strict_dynamic_cast< TupleType * >( ResolvExpr::extractResultType( ftype ) ); 1227 1227 // ensure return value is not destructed by explicitly creating an empty ListInit node wherein maybeConstruct is false. 1228 ObjectDecl * newRet = new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, tupleType, new ListInit( std:: list<Initializer*>(), noDesignators, false ) );1228 ObjectDecl * newRet = new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, tupleType, new ListInit( std::vector< Initializer * >(), noDesignators, false ) ); 1229 1229 deleteAll( retVals ); 1230 1230 retVals.clear(); -
src/SynTree/Initializer.cc
rbee0694 rbbbc067 70 70 71 71 72 ListInit::ListInit( const std:: list<Initializer*> &inits, const std::list<Designation *> &des, bool maybeConstructed )72 ListInit::ListInit( const std::vector< Initializer * > &inits, const std::list<Designation *> &des, bool maybeConstructed ) 73 73 : Initializer( maybeConstructed ), initializers( inits ), designations( des ) { 74 74 // handle the common case where a ListInit is created without designations by making a list of empty designations with the same length as the initializer -
src/SynTree/Initializer.h
rbee0694 rbbbc067 18 18 #include <iosfwd> // for ostream 19 19 #include <list> // for list, list<>::const_iterator, list<>::it... 20 #include <vector> 20 21 21 22 #include "BaseSyntaxNode.h" // for BaseSyntaxNode … … 85 86 class ListInit : public Initializer { 86 87 public: 87 std:: list<Initializer *> initializers; // order *is* important88 std::vector< Initializer * > initializers; // order *is* important 88 89 std::list<Designation *> designations; // order/length is consistent with initializers 89 90 90 ListInit( const std:: list<Initializer*> &initializers,91 ListInit( const std::vector< Initializer * > &initializers, 91 92 const std::list<Designation *> &designators = {}, bool maybeConstructed = false ); 92 93 ListInit( const ListInit & other ); … … 94 95 95 96 std::list<Designation *> & get_designations() { return designations; } 96 std:: list<Initializer *> & get_initializers() { return initializers; }97 std::vector< Initializer * > & get_initializers() { return initializers; } 97 98 98 typedef std:: list<Initializer*>::iterator iterator;99 typedef std:: list<Initializer*>::const_iterator const_iterator;99 typedef std::vector< Initializer * >::iterator iterator; 100 typedef std::vector< Initializer * >::const_iterator const_iterator; 100 101 iterator begin() { return initializers.begin(); } 101 102 iterator end() { return initializers.end(); } -
src/Tuples/TupleExpansion.cc
rbee0694 rbbbc067 271 271 // as a distinct part of its initializer - the produced compound literal may be used as part of 272 272 // another expression 273 std:: list< Initializer * > inits;273 std::vector< Initializer * > inits; 274 274 for ( Expression * expr : exprs ) { 275 275 inits.push_back( new SingleInit( expr ) );
Note: See TracChangeset
for help on using the changeset viewer.