Changes in / [7c782af:62cd621]
- Location:
- src
- Files:
-
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/CodeGenerator.cc
r7c782af r62cd621 764 764 765 765 void CodeGenerator::postvisit( StmtExpr * stmtExpr ) { 766 std::list< Statement * > & stmts = stmtExpr-> statements->kids;766 std::list< Statement * > & stmts = stmtExpr->get_statements()->get_kids(); 767 767 output << "({" << endl; 768 768 ++indent; … … 775 775 // cannot cast to void, otherwise the expression statement has no value 776 776 if ( ExprStmt * exprStmt = dynamic_cast< ExprStmt * >( stmt ) ) { 777 exprStmt-> expr->accept( *visitor );777 exprStmt->get_expr()->accept( *visitor ); 778 778 output << ";" << endl; 779 779 ++i; … … 795 795 assertf( ! genC, "Unique expressions should not reach code generation." ); 796 796 expr->callExpr->accept( *visitor ); 797 }798 799 void CodeGenerator::postvisit( DeletedExpr * expr ) {800 assertf( ! genC, "Deleted expressions should not reach code generation." );801 expr->expr->accept( *visitor );802 797 } 803 798 -
src/CodeGen/CodeGenerator.h
r7c782af r62cd621 88 88 void postvisit( StmtExpr * ); 89 89 void postvisit( ConstructorExpr * ); 90 void postvisit( DeletedExpr * );91 90 92 91 //*** Statements -
src/Common/PassVisitor.h
r7c782af r62cd621 121 121 virtual void visit( UntypedInitExpr * initExpr ) override final; 122 122 virtual void visit( InitExpr * initExpr ) override final; 123 virtual void visit( DeletedExpr * delExpr ) override final;124 123 125 124 virtual void visit( VoidType * basicType ) override final; … … 216 215 virtual Expression * mutate( UntypedInitExpr * initExpr ) override final; 217 216 virtual Expression * mutate( InitExpr * initExpr ) override final; 218 virtual Expression * mutate( DeletedExpr * delExpr ) override final;219 217 220 218 virtual Type * mutate( VoidType * basicType ) override final; … … 305 303 void indexerAddUnionFwd ( UnionDecl * node ) { indexer_impl_addUnionFwd ( pass, 0, node ); } 306 304 void indexerAddTrait ( TraitDecl * node ) { indexer_impl_addTrait ( pass, 0, node ); } 307 void indexerAddWith ( std::list< Expression * > & exprs , BaseSyntaxNode * withStmt ) { indexer_impl_addWith ( pass, 0, exprs, withStmt); }305 void indexerAddWith ( std::list< Expression * > & exprs ) { indexer_impl_addWith ( pass, 0, exprs ); } 308 306 309 307 -
src/Common/PassVisitor.impl.h
r7c782af r62cd621 393 393 // shadow with exprs and not the other way around. 394 394 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 395 indexerAddWith( node->withExprs , node);395 indexerAddWith( node->withExprs ); 396 396 { 397 397 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); … … 423 423 // shadow with exprs and not the other way around. 424 424 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 425 indexerAddWith( node->withExprs , node);425 indexerAddWith( node->withExprs ); 426 426 { 427 427 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); … … 1064 1064 // catch statements introduce a level of scope (for the caught exception) 1065 1065 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 1066 indexerAddWith( node->exprs , node);1066 indexerAddWith( node->exprs ); 1067 1067 maybeAccept_impl( node->stmt, *this ); 1068 1068 } … … 1077 1077 // catch statements introduce a level of scope (for the caught exception) 1078 1078 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 1079 indexerAddWith( node->exprs , node);1079 indexerAddWith( node->exprs ); 1080 1080 maybeMutate_impl( node->stmt, *this ); 1081 1081 } … … 1971 1971 } 1972 1972 1973 //--------------------------------------------------------------------------1974 // DeletedExpr1975 template< typename pass_type >1976 void PassVisitor< pass_type >::visit( DeletedExpr * node ) {1977 VISIT_START( node );1978 1979 indexerScopedAccept( node->result, *this );1980 maybeAccept_impl( node->expr, *this );1981 // don't visit deleteStmt, because it is a pointer to somewhere else in the tree.1982 1983 VISIT_END( node );1984 }1985 1986 template< typename pass_type >1987 Expression * PassVisitor< pass_type >::mutate( DeletedExpr * node ) {1988 MUTATE_START( node );1989 1990 indexerScopedMutate( node->env, *this );1991 indexerScopedMutate( node->result, *this );1992 maybeMutate_impl( node->expr, *this );1993 1994 MUTATE_END( Expression, node );1995 }1996 1997 1998 1973 template< typename pass_type > 1999 1974 void PassVisitor< pass_type >::visit( VoidType * node ) { -
src/Common/PassVisitor.proto.h
r7c782af r62cd621 193 193 194 194 195 #define INDEXER_FUNC 1( func, type ) \195 #define INDEXER_FUNC( func, type ) \ 196 196 template<typename pass_type> \ 197 197 static inline auto indexer_impl_##func ( pass_type & pass, int, type arg ) -> decltype( pass.indexer.func( arg ), void() ) { \ … … 202 202 static inline void indexer_impl_##func ( pass_type &, long, type ) { } \ 203 203 204 #define INDEXER_FUNC2( func, type1, type2 ) \ 205 template<typename pass_type> \ 206 static inline auto indexer_impl_##func ( pass_type & pass, int, type1 arg1, type2 arg2 ) -> decltype( pass.indexer.func( arg1, arg2 ), void() ) { \ 207 pass.indexer.func( arg1, arg2 ); \ 208 } \ 209 \ 210 template<typename pass_type> \ 211 static inline void indexer_impl_##func ( pass_type &, long, type1, type2 ) { } 212 213 214 INDEXER_FUNC1( addId , DeclarationWithType * ); 215 INDEXER_FUNC1( addType , NamedTypeDecl * ); 216 INDEXER_FUNC1( addStruct , StructDecl * ); 217 INDEXER_FUNC1( addEnum , EnumDecl * ); 218 INDEXER_FUNC1( addUnion , UnionDecl * ); 219 INDEXER_FUNC1( addTrait , TraitDecl * ); 220 INDEXER_FUNC2( addWith , std::list< Expression * > &, BaseSyntaxNode * ); 204 INDEXER_FUNC( addId , DeclarationWithType * ); 205 INDEXER_FUNC( addType , NamedTypeDecl * ); 206 INDEXER_FUNC( addStruct , StructDecl * ); 207 INDEXER_FUNC( addEnum , EnumDecl * ); 208 INDEXER_FUNC( addUnion , UnionDecl * ); 209 INDEXER_FUNC( addTrait , TraitDecl * ); 210 INDEXER_FUNC( addWith , std::list< Expression * > & ); 221 211 222 212 -
src/Common/utility.h
r7c782af r62cd621 98 98 } 99 99 100 template< typename SrcContainer, typename DestContainer, typename Predicate >101 void cloneAll_if( const SrcContainer &src, DestContainer &dest, Predicate pred ) {102 std::back_insert_iterator< DestContainer > out( dest );103 for ( auto x : src ) {104 if ( pred(x) ) {105 *out++ = x->clone();106 }107 } // while108 }109 110 100 template< typename Container > 111 101 void assertAll( const Container &container ) { -
src/ResolvExpr/Alternative.h
r7c782af r62cd621 57 57 /// Moves all elements from src to the beginning of dst 58 58 void spliceBegin( AltList& dst, AltList& src ); 59 60 static inline std::ostream & operator<<(std::ostream & os, const ResolvExpr::Alternative & alt) {61 alt.print( os );62 return os;63 }64 59 } // namespace ResolvExpr 65 60 -
src/ResolvExpr/AlternativeFinder.cc
r7c782af r62cd621 95 95 void postvisit( StmtExpr * stmtExpr ); 96 96 void postvisit( UntypedInitExpr * initExpr ); 97 void postvisit( InitExpr * initExpr );98 void postvisit( DeletedExpr * delExpr );99 97 100 98 /// Adds alternatives for anonymous members … … 122 120 Type *& targetType; 123 121 }; 122 123 Expression *resolveInVoidContext( Expression *expr, const SymTab::Indexer &indexer, TypeEnvironment &env ) { 124 CastExpr *castToVoid = new CastExpr( expr ); 125 126 AlternativeFinder finder( indexer, env ); 127 finder.findWithAdjustment( castToVoid ); 128 129 // it's a property of the language that a cast expression has either 1 or 0 interpretations; if it has 0 130 // interpretations, an exception has already been thrown. 131 assert( finder.get_alternatives().size() == 1 ); 132 CastExpr *newExpr = dynamic_cast< CastExpr* >( finder.get_alternatives().front().expr ); 133 assert( newExpr ); 134 env = finder.get_alternatives().front().env; 135 return newExpr->get_arg()->clone(); 136 } 124 137 125 138 Cost sumCost( const AltList &in ) { … … 1367 1380 void AlternativeFinder::Finder::postvisit( NameExpr *nameExpr ) { 1368 1381 std::list< SymTab::Indexer::IdData > declList; 1369 indexer.lookupId( nameExpr-> name, declList );1370 PRINT( std::cerr << "nameExpr is " << nameExpr-> name<< std::endl; )1382 indexer.lookupId( nameExpr->get_name(), declList ); 1383 PRINT( std::cerr << "nameExpr is " << nameExpr->get_name() << std::endl; ) 1371 1384 for ( auto & data : declList ) { 1372 1385 Expression * newExpr = data.combine(); … … 1389 1402 // not sufficient to clone here, because variable's type may have changed 1390 1403 // since the VariableExpr was originally created. 1391 alternatives.push_back( Alternative( new VariableExpr( variableExpr-> var), env, Cost::zero ) );1404 alternatives.push_back( Alternative( new VariableExpr( variableExpr->get_var() ), env, Cost::zero ) ); 1392 1405 } 1393 1406 … … 1456 1469 // xxx - resolveTypeof? 1457 1470 if ( StructInstType *structInst = dynamic_cast< StructInstType* >( offsetofExpr->get_type() ) ) { 1458 addOffsetof( structInst, offsetofExpr-> member);1471 addOffsetof( structInst, offsetofExpr->get_member() ); 1459 1472 } else if ( UnionInstType *unionInst = dynamic_cast< UnionInstType* >( offsetofExpr->get_type() ) ) { 1460 addOffsetof( unionInst, offsetofExpr-> member);1473 addOffsetof( unionInst, offsetofExpr->get_member() ); 1461 1474 } 1462 1475 } … … 1535 1548 secondFinder.findWithAdjustment( logicalExpr->get_arg2() ); 1536 1549 if ( secondFinder.alternatives.empty() ) return; 1537 for ( const Alternative & first : firstFinder.alternatives) {1538 for ( const Alternative & second : secondFinder.alternatives) {1550 for ( AltList::const_iterator first = firstFinder.alternatives.begin(); first != firstFinder.alternatives.end(); ++first ) { 1551 for ( AltList::const_iterator second = secondFinder.alternatives.begin(); second != secondFinder.alternatives.end(); ++second ) { 1539 1552 TypeEnvironment compositeEnv; 1540 compositeEnv.simpleCombine( first .env );1541 compositeEnv.simpleCombine( second .env );1542 1543 LogicalExpr *newExpr = new LogicalExpr( first .expr->clone(), second.expr->clone(), logicalExpr->get_isAnd() );1544 alternatives.push_back( Alternative( newExpr, compositeEnv, first .cost + second.cost ) );1553 compositeEnv.simpleCombine( first->env ); 1554 compositeEnv.simpleCombine( second->env ); 1555 1556 LogicalExpr *newExpr = new LogicalExpr( first->expr->clone(), second->expr->clone(), logicalExpr->get_isAnd() ); 1557 alternatives.push_back( Alternative( newExpr, compositeEnv, first->cost + second->cost ) ); 1545 1558 } 1546 1559 } … … 1592 1605 AlternativeFinder secondFinder( indexer, newEnv ); 1593 1606 secondFinder.findWithAdjustment( commaExpr->get_arg2() ); 1594 for ( const Alternative & alt : secondFinder.alternatives) {1595 alternatives.push_back( Alternative( new CommaExpr( newFirstArg->clone(), alt .expr->clone() ), alt.env, alt.cost ) );1607 for ( AltList::const_iterator alt = secondFinder.alternatives.begin(); alt != secondFinder.alternatives.end(); ++alt ) { 1608 alternatives.push_back( Alternative( new CommaExpr( newFirstArg->clone(), alt->expr->clone() ), alt->env, alt->cost ) ); 1596 1609 } // for 1597 1610 delete newFirstArg; … … 1601 1614 // resolve low and high, accept alternatives whose low and high types unify 1602 1615 AlternativeFinder firstFinder( indexer, env ); 1603 firstFinder.findWithAdjustment( rangeExpr-> low);1616 firstFinder.findWithAdjustment( rangeExpr->get_low() ); 1604 1617 if ( firstFinder.alternatives.empty() ) return; 1605 1618 AlternativeFinder secondFinder( indexer, env ); 1606 secondFinder.findWithAdjustment( rangeExpr-> high);1619 secondFinder.findWithAdjustment( rangeExpr->get_high() ); 1607 1620 if ( secondFinder.alternatives.empty() ) return; 1608 for ( const Alternative & first : firstFinder.alternatives) {1609 for ( const Alternative & second : secondFinder.alternatives) {1621 for ( AltList::const_iterator first = firstFinder.alternatives.begin(); first != firstFinder.alternatives.end(); ++first ) { 1622 for ( AltList::const_iterator second = secondFinder.alternatives.begin(); second != secondFinder.alternatives.end(); ++second ) { 1610 1623 TypeEnvironment compositeEnv; 1611 compositeEnv.simpleCombine( first .env );1612 compositeEnv.simpleCombine( second .env );1624 compositeEnv.simpleCombine( first->env ); 1625 compositeEnv.simpleCombine( second->env ); 1613 1626 OpenVarSet openVars; 1614 1627 AssertionSet needAssertions, haveAssertions; 1615 Alternative newAlt( 0, compositeEnv, first .cost + second.cost );1628 Alternative newAlt( 0, compositeEnv, first->cost + second->cost ); 1616 1629 Type* commonType = nullptr; 1617 if ( unify( first .expr->result, second.expr->result, newAlt.env, needAssertions, haveAssertions, openVars, indexer, commonType ) ) {1618 RangeExpr * newExpr = new RangeExpr( first.expr->clone(), second.expr->clone() );1619 newExpr-> result = commonType ? commonType : first.expr->result->clone();1630 if ( unify( first->expr->get_result(), second->expr->get_result(), newAlt.env, needAssertions, haveAssertions, openVars, indexer, commonType ) ) { 1631 RangeExpr *newExpr = new RangeExpr( first->expr->clone(), second->expr->clone() ); 1632 newExpr->set_result( commonType ? commonType : first->expr->get_result()->clone() ); 1620 1633 newAlt.expr = newExpr; 1621 1634 inferParameters( needAssertions, haveAssertions, newAlt, openVars, back_inserter( alternatives ) ); … … 1738 1751 findMinCost( minArgCost.begin(), minArgCost.end(), std::back_inserter( alternatives ) ); 1739 1752 } 1740 1741 void AlternativeFinder::Finder::postvisit( InitExpr * ) {1742 assertf( false, "AlternativeFinder should never see a resolved InitExpr." );1743 }1744 1745 void AlternativeFinder::Finder::postvisit( DeletedExpr * ) {1746 assertf( false, "AlternativeFinder should never see a DeletedExpr." );1747 }1748 1753 } // namespace ResolvExpr 1749 1754 -
src/ResolvExpr/Resolver.cc
r7c782af r62cd621 105 105 } 106 106 107 namespace { 108 struct DeleteFinder : public WithShortCircuiting { 109 DeletedExpr * delExpr = nullptr; 110 void previsit( DeletedExpr * expr ) { 111 if ( delExpr ) visit_children = false; 112 else delExpr = expr; 113 } 114 115 void previsit( Expression * ) { 116 if ( delExpr ) visit_children = false; 117 } 118 }; 119 } 120 121 DeletedExpr * findDeletedExpr( Expression * expr ) { 122 PassVisitor<DeleteFinder> finder; 123 expr->accept( finder ); 124 return finder.pass.delExpr; 107 // used in resolveTypeof 108 Expression *resolveInVoidContext( Expression *expr, const SymTab::Indexer &indexer ) { 109 TypeEnvironment env; 110 return resolveInVoidContext( expr, indexer, env ); 125 111 } 126 112 … … 144 130 } // namespace 145 131 146 namespace {147 void findUnfinishedKindExpression(Expression * untyped, Alternative & alt, const SymTab::Indexer & indexer, const std::string & kindStr, std::function<bool(const Alternative &)> pred, bool adjust = false, bool prune = true, bool failFast = true) {148 assertf( untyped, "expected a non-null expression." );149 TypeEnvironment env;150 AlternativeFinder finder( indexer, env );151 finder.find( untyped, adjust, prune, failFast );152 153 #if 0154 if ( finder.get_alternatives().size() != 1 ) {155 std::cerr << "untyped expr is ";156 untyped->print( std::cerr );157 std::cerr << std::endl << "alternatives are:";158 for ( const Alternative & alt : finder.get_alternatives() ) {159 alt.print( std::cerr );160 } // for161 } // if162 #endif163 164 AltList candidates;165 for ( Alternative & alt : finder.get_alternatives() ) {166 if ( pred( alt ) ) {167 candidates.push_back( std::move( alt ) );168 }169 }170 171 // xxx - if > 1 alternative with same cost, ignore deleted and pick from remaining172 // choose the lowest cost expression among the candidates173 AltList winners;174 findMinCost( candidates.begin(), candidates.end(), back_inserter( winners ) );175 if ( winners.size() == 0 ) {176 throw SemanticError( untyped, toString( "No reasonable alternatives for ", kindStr, (kindStr != "" ? " " : ""), "expression: ") );177 } else if ( winners.size() != 1 ) {178 std::ostringstream stream;179 stream << "Cannot choose between " << winners.size() << " alternatives for " << kindStr << (kindStr != "" ? " " : "") << "expression\n";180 untyped->print( stream );181 stream << "Alternatives are:\n";182 printAlts( winners, stream, 1 );183 throw SemanticError( untyped->location, stream.str() );184 }185 186 // there is one unambiguous interpretation - move the expression into the with statement187 Alternative & choice = winners.front();188 if ( findDeletedExpr( choice.expr ) ) {189 throw SemanticError( choice.expr, "Unique best alternative includes deleted identifier in " );190 }191 alt = std::move( choice );192 }193 194 /// resolve `untyped` to the expression whose alternative satisfies `pred` with the lowest cost; kindStr is used for providing better error messages195 void findKindExpression(Expression *& untyped, const SymTab::Indexer & indexer, const std::string & kindStr, std::function<bool(const Alternative &)> pred, bool adjust = false, bool prune = true, bool failFast = true) {196 if ( ! untyped ) return;197 Alternative choice;198 findUnfinishedKindExpression( untyped, choice, indexer, kindStr, pred, adjust, prune, failFast );199 finishExpr( choice.expr, choice.env, untyped->env );200 delete untyped;201 untyped = choice.expr;202 choice.expr = nullptr;203 }204 205 bool standardAlternativeFilter( const Alternative & ) {206 // currently don't need to filter, under normal circumstances.207 // in the future, this may be useful for removing deleted expressions208 return true;209 }210 } // namespace211 212 // used in resolveTypeof213 Expression * resolveInVoidContext( Expression *expr, const SymTab::Indexer &indexer ) {214 TypeEnvironment env;215 return resolveInVoidContext( expr, indexer, env );216 }217 218 Expression * resolveInVoidContext( Expression *expr, const SymTab::Indexer &indexer, TypeEnvironment &env ) {219 // it's a property of the language that a cast expression has either 1 or 0 interpretations; if it has 0220 // interpretations, an exception has already been thrown.221 assertf( expr, "expected a non-null expression." );222 223 static CastExpr untyped( nullptr ); // cast to void224 225 // set up and resolve expression cast to void226 untyped.arg = expr;227 Alternative choice;228 findUnfinishedKindExpression( &untyped, choice, indexer, "", standardAlternativeFilter, true );229 CastExpr * castExpr = strict_dynamic_cast< CastExpr * >( choice.expr );230 env = std::move( choice.env );231 232 // clean up resolved expression233 Expression * ret = castExpr->arg;234 castExpr->arg = nullptr;235 236 // unlink the arg so that it isn't deleted twice at the end of the program237 untyped.arg = nullptr;238 return ret;239 }240 241 132 void findVoidExpression( Expression *& untyped, const SymTab::Indexer &indexer ) { 242 133 resetTyVarRenaming(); 243 134 TypeEnvironment env; 244 Expression * 135 Expression *newExpr = resolveInVoidContext( untyped, indexer, env ); 245 136 finishExpr( newExpr, env, untyped->env ); 246 137 delete untyped; … … 249 140 250 141 void findSingleExpression( Expression *&untyped, const SymTab::Indexer &indexer ) { 251 findKindExpression( untyped, indexer, "", standardAlternativeFilter ); 142 if ( ! untyped ) return; 143 TypeEnvironment env; 144 AlternativeFinder finder( indexer, env ); 145 finder.find( untyped ); 146 #if 0 147 if ( finder.get_alternatives().size() != 1 ) { 148 std::cerr << "untyped expr is "; 149 untyped->print( std::cerr ); 150 std::cerr << std::endl << "alternatives are:"; 151 for ( const Alternative & alt : finder.get_alternatives() ) { 152 alt.print( std::cerr ); 153 } // for 154 } // if 155 #endif 156 assertf( finder.get_alternatives().size() == 1, "findSingleExpression: must have exactly one alternative at the end: (%zd) %s", finder.get_alternatives().size(), toString( untyped ).c_str() ); 157 Alternative &choice = finder.get_alternatives().front(); 158 Expression *newExpr = choice.expr->clone(); 159 finishExpr( newExpr, choice.env, untyped->env ); 160 delete untyped; 161 untyped = newExpr; 252 162 } 253 163 … … 260 170 261 171 namespace { 262 bool isIntegralType( const Alternative & alt ) { 263 Type * type = alt.expr->result; 172 /// resolve `untyped` to the expression whose type satisfies `pred` with the lowest cost; kindStr is used for providing better error messages 173 template<typename Pred> 174 void findKindExpression(Expression *& untyped, const SymTab::Indexer & indexer, const std::string & kindStr, Pred pred) { 175 TypeEnvironment env; 176 AlternativeFinder finder( indexer, env ); 177 finder.findWithAdjustment( untyped ); 178 179 AltList candidates; 180 for ( Alternative & alt : finder.get_alternatives() ) { 181 if ( pred( alt.expr->result ) ) { 182 candidates.push_back( std::move( alt ) ); 183 } 184 } 185 186 // choose the lowest cost expression among the candidates 187 AltList winners; 188 findMinCost( candidates.begin(), candidates.end(), back_inserter( winners ) ); 189 if ( winners.size() == 0 ) { 190 throw SemanticError( untyped, "No reasonable alternatives for " + kindStr + " expression: " ); 191 } else if ( winners.size() != 1 ) { 192 std::ostringstream stream; 193 stream << "Cannot choose between " << winners.size() << " alternatives for " + kindStr + " expression\n"; 194 untyped->print( stream ); 195 stream << "Alternatives are:\n"; 196 printAlts( winners, stream, 1 ); 197 throw SemanticError( untyped->location, stream.str() ); 198 } 199 200 // there is one unambiguous interpretation - move the expression into the with statement 201 Alternative & alt = winners.front(); 202 finishExpr( alt.expr, alt.env, untyped->env ); 203 delete untyped; 204 untyped = alt.expr; 205 alt.expr = nullptr; 206 } 207 208 bool isIntegralType( Type *type ) { 264 209 if ( dynamic_cast< EnumInstType * >( type ) ) { 265 210 return true; … … 614 559 if( func_candidates.size() > 1 ) { SemanticError top( stmt->location, "Ambiguous function in call to waitfor" ); top.append( errors ); throw top; } 615 560 if( args_candidates.size() > 1 ) { SemanticError top( stmt->location, "Ambiguous arguments in call to waitfor" ); top.append( errors ); throw top; } 616 // TODO: need to use findDeletedExpr to ensure no deleted identifiers are used. 561 617 562 618 563 // Swap the results from the alternative with the unresolved values. … … 647 592 } 648 593 649 bool isStructOrUnion( const Alternative & alt ) {650 Type * t = alt.expr->result->stripReferences();594 bool isStructOrUnion( Type * t ) { 595 t = t->stripReferences(); 651 596 return dynamic_cast< StructInstType * >( t ) || dynamic_cast< UnionInstType * >( t ); 652 597 } -
src/ResolvExpr/Unify.cc
r7c782af r62cd621 563 563 flatten( dcl->get_type(), back_inserter( types ) ); 564 564 for ( Type * t : types ) { 565 // outermost const, volatile, _Atomic qualifiers in parameters should not play a role in the unification of function types, since they do not determine whether a function is callable.566 // Note: MUST consider at least mutex qualifier, since functions can be overloaded on outermost mutex and a mutex function has different requirements than a non-mutex function.567 t->get_qualifiers() -= Type::Qualifiers(Type::Const | Type::Volatile | Type::Atomic);568 569 565 dst.push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::C, nullptr, t, nullptr ) ); 570 566 } … … 584 580 585 581 // sizes don't have to match if ttypes are involved; need to be more precise wrt where the ttype is to prevent errors 586 if ( (flatFunc-> parameters.size() == flatOther->parameters.size() && flatFunc->returnVals.size() == flatOther->returnVals.size()) || flatFunc->isTtype() || flatOther->isTtype() ) {587 if ( unifyDeclList( flatFunc-> parameters.begin(), flatFunc->parameters.end(), flatOther->parameters.begin(), flatOther->parameters.end(), env, needAssertions, haveAssertions, openVars, indexer ) ) {588 if ( unifyDeclList( flatFunc-> returnVals.begin(), flatFunc->returnVals.end(), flatOther->returnVals.begin(), flatOther->returnVals.end(), env, needAssertions, haveAssertions, openVars, indexer ) ) {582 if ( (flatFunc->get_parameters().size() == flatOther->get_parameters().size() && flatFunc->get_returnVals().size() == flatOther->get_returnVals().size()) || flatFunc->isTtype() || flatOther->isTtype() ) { 583 if ( unifyDeclList( flatFunc->get_parameters().begin(), flatFunc->get_parameters().end(), flatOther->get_parameters().begin(), flatOther->get_parameters().end(), env, needAssertions, haveAssertions, openVars, indexer ) ) { 584 if ( unifyDeclList( flatFunc->get_returnVals().begin(), flatFunc->get_returnVals().end(), flatOther->get_returnVals().begin(), flatOther->get_returnVals().end(), env, needAssertions, haveAssertions, openVars, indexer ) ) { 589 585 590 586 // the original types must be used in mark assertions, since pointer comparisons are used … … 603 599 // check that other type is compatible and named the same 604 600 RefType *otherStruct = dynamic_cast< RefType* >( other ); 605 result = otherStruct && inst-> name == otherStruct->name;601 result = otherStruct && inst->get_name() == otherStruct->get_name(); 606 602 } 607 603 … … 612 608 if ( ! result ) return; 613 609 // Check that parameters of types unify, if any 614 std::list< Expression* > params = inst-> parameters;615 std::list< Expression* > otherParams = ((RefType*)other)-> parameters;610 std::list< Expression* > params = inst->get_parameters(); 611 std::list< Expression* > otherParams = ((RefType*)other)->get_parameters(); 616 612 617 613 std::list< Expression* >::const_iterator it = params.begin(), jt = otherParams.begin(); -
src/SymTab/Autogen.cc
r7c782af r62cd621 377 377 paramType->attributes.clear(); 378 378 // add a parameter corresponding to this field 379 ObjectDecl * param = new ObjectDecl( field->name, Type::StorageClasses(), LinkageSpec::Cforall, nullptr, paramType, nullptr ); 380 cloneAll_if( field->attributes, param->attributes, [](Attribute * attr) { return attr->isValidOnFuncParam(); } ); 381 memCtorType->parameters.push_back( param ); 379 memCtorType->parameters.push_back( new ObjectDecl( field->name, Type::StorageClasses(), LinkageSpec::Cforall, nullptr, paramType, nullptr ) ); 382 380 FunctionDecl * ctor = genFunc( "?{}", memCtorType->clone(), functionNesting ); 383 381 makeFieldCtorBody( aggregateDecl->members.begin(), aggregateDecl->members.end(), ctor ); -
src/SymTab/FixFunction.cc
r7c782af r62cd621 36 36 } 37 37 38 // xxx - this passes on void[], e.g.39 // void foo(void [10]);40 // does not cause an error41 42 38 Type * FixFunction::postmutate(ArrayType *arrayType) { 43 39 // need to recursively mutate the base type in order for multi-dimensional arrays to work. … … 66 62 void FixFunction::premutate(ZeroType *) { visit_children = false; } 67 63 void FixFunction::premutate(OneType *) { visit_children = false; } 68 69 bool fixFunction( DeclarationWithType *& dwt ) {70 PassVisitor<FixFunction> fixer;71 dwt = dwt->acceptMutator( fixer );72 return fixer.pass.isVoid;73 }74 64 } // namespace SymTab 75 65 -
src/SymTab/FixFunction.h
r7c782af r62cd621 47 47 bool isVoid; 48 48 }; 49 50 bool fixFunction( DeclarationWithType *& );51 49 } // namespace SymTab 52 50 -
src/SymTab/Indexer.cc
r7c782af r62cd621 286 286 } 287 287 288 const Indexer::IdData *Indexer::lookupIdAtScope( const std::string &id, const std::string &mangleName, unsigned long scope ) const {289 if ( ! tables ) return nullptr;290 if ( tables->scope < scope ) return nullptr;288 DeclarationWithType *Indexer::lookupIdAtScope( const std::string &id, const std::string &mangleName, unsigned long scope ) const { 289 if ( ! tables ) return 0; 290 if ( tables->scope < scope ) return 0; 291 291 292 292 IdTable::const_iterator decls = tables->idTable.find( id ); … … 294 294 const MangleTable &mangleTable = decls->second; 295 295 MangleTable::const_iterator decl = mangleTable.find( mangleName ); 296 if ( decl != mangleTable.end() ) return &decl->second;296 if ( decl != mangleTable.end() ) return decl->second.id; 297 297 } 298 298 299 299 return tables->base.lookupIdAtScope( id, mangleName, scope ); 300 }301 302 Indexer::IdData * Indexer::lookupIdAtScope( const std::string &id, const std::string &mangleName, unsigned long scope ) {303 return const_cast<IdData *>(const_cast<const Indexer *>(this)->lookupIdAtScope( id, mangleName, scope ));304 300 } 305 301 … … 377 373 } 378 374 379 bool addedIdConflicts( Indexer::IdData & existing, DeclarationWithType *added, BaseSyntaxNode * deleteStmt, Indexer::ConflictFunction handleConflicts) {375 bool addedIdConflicts( DeclarationWithType *existing, DeclarationWithType *added ) { 380 376 // if we're giving the same name mangling to things of different types then there is something wrong 381 assert( (dynamic_cast<ObjectDecl*>( added ) && dynamic_cast<ObjectDecl*>( existing .id) )382 || (dynamic_cast<FunctionDecl*>( added ) && dynamic_cast<FunctionDecl*>( existing .id) ) );383 384 if ( LinkageSpec::isOverridable( existing .id->get_linkage() ) ) {377 assert( (dynamic_cast<ObjectDecl*>( added ) && dynamic_cast<ObjectDecl*>( existing ) ) 378 || (dynamic_cast<FunctionDecl*>( added ) && dynamic_cast<FunctionDecl*>( existing ) ) ); 379 380 if ( LinkageSpec::isOverridable( existing->get_linkage() ) ) { 385 381 // new definition shadows the autogenerated one, even at the same scope 386 382 return false; 387 } else if ( LinkageSpec::isMangled( added->get_linkage() ) || ResolvExpr::typesCompatible( added->get_type(), existing.id->get_type(), Indexer() ) ) { 388 389 // it is a conflict if one declaration is deleted and the other is not 390 if ( deleteStmt && ! existing.deleteStmt ) { 391 return handleConflicts( existing, "deletion of defined identifier " ); 392 } else if ( ! deleteStmt && existing.deleteStmt ) { 393 return handleConflicts( existing, "definition of deleted identifier " ); 394 } 395 383 } else if ( LinkageSpec::isMangled( added->get_linkage() ) || ResolvExpr::typesCompatible( added->get_type(), existing->get_type(), Indexer() ) ) { 396 384 // typesCompatible doesn't really do the right thing here. When checking compatibility of function types, 397 385 // we should ignore outermost pointer qualifiers, except _Atomic? 398 FunctionDecl * newentry = dynamic_cast< FunctionDecl* >( added );399 FunctionDecl * oldentry = dynamic_cast< FunctionDecl * >( existing.id);386 FunctionDecl *newentry = dynamic_cast< FunctionDecl* >( added ); 387 FunctionDecl *oldentry = dynamic_cast< FunctionDecl* >( existing ); 400 388 if ( newentry && oldentry ) { 401 389 if ( newentry->get_statements() && oldentry->get_statements() ) { 402 return handleConflicts( existing, "duplicate function definition for " );390 throw SemanticError( added, "duplicate function definition for " ); 403 391 } // if 404 392 } else { … … 407 395 // xxx - perhaps it's actually if either is intrinsic then this is okay? 408 396 // might also need to be same storage class? 409 ObjectDecl * newobj = dynamic_cast< ObjectDecl* >( added );410 ObjectDecl * oldobj = dynamic_cast< ObjectDecl * >( existing.id);397 ObjectDecl *newobj = dynamic_cast< ObjectDecl* >( added ); 398 ObjectDecl *oldobj = dynamic_cast< ObjectDecl* >( existing ); 411 399 if ( ! newobj->get_storageClasses().is_extern && ! oldobj->get_storageClasses().is_extern ) { 412 return handleConflicts( existing, "duplicate object definition for " );400 throw SemanticError( added, "duplicate object definition for " ); 413 401 } // if 414 402 } // if 415 403 } else { 416 return handleConflicts( existing, "duplicate definition for " );404 throw SemanticError( added, "duplicate definition for " ); 417 405 } // if 418 406 … … 420 408 } 421 409 422 void Indexer::addId( DeclarationWithType *decl, ConflictFunction handleConflicts, Expression * baseExpr, BaseSyntaxNode * deleteStmt) {410 void Indexer::addId( DeclarationWithType *decl, Expression * baseExpr ) { 423 411 if ( decl->name == "" ) return; 424 412 debugPrint( "Adding Id " << decl->name << std::endl ); … … 446 434 } 447 435 } else { 448 // Check that a Cforall declaration doesn't over rideany C declaration436 // Check that a Cforall declaration doesn't overload any C declaration 449 437 if ( hasCompatibleCDecl( name, mangleName, scope ) ) { 450 438 throw SemanticError( decl, "Cforall declaration hides C function " ); … … 453 441 454 442 // Skip repeat declarations of the same identifier 455 IdData *existing = lookupIdAtScope( name, mangleName, scope );456 if ( existing && existing->id && addedIdConflicts( *existing, decl, deleteStmt, handleConflicts) ) return;443 DeclarationWithType *existing = lookupIdAtScope( name, mangleName, scope ); 444 if ( existing && addedIdConflicts( existing, decl ) ) return; 457 445 458 446 // add to indexer 459 tables->idTable[ name ][ mangleName ] = { decl, baseExpr , deleteStmt};447 tables->idTable[ name ][ mangleName ] = { decl, baseExpr }; 460 448 ++tables->size; 461 }462 463 void Indexer::addId( DeclarationWithType * decl, Expression * baseExpr ) {464 // default handling of conflicts is to raise an error465 addId( decl, [decl](IdData &, const std::string & msg) { throw SemanticError( decl, msg ); return true; }, baseExpr );466 }467 468 void Indexer::addDeletedId( DeclarationWithType * decl, BaseSyntaxNode * deleteStmt ) {469 // default handling of conflicts is to raise an error470 addId( decl, [decl](IdData &, const std::string & msg) { throw SemanticError( decl, msg ); return true; }, nullptr, deleteStmt );471 449 } 472 450 … … 595 573 } 596 574 597 void Indexer::addMembers( AggregateDecl * aggr, Expression * expr , ConflictFunction handleConflicts) {575 void Indexer::addMembers( AggregateDecl * aggr, Expression * expr ) { 598 576 for ( Declaration * decl : aggr->members ) { 599 577 if ( DeclarationWithType * dwt = dynamic_cast< DeclarationWithType * >( decl ) ) { 600 addId( dwt, handleConflicts,expr );578 addId( dwt, expr ); 601 579 if ( dwt->name == "" ) { 602 580 Type * t = dwt->get_type()->stripReferences(); … … 604 582 Expression * base = expr->clone(); 605 583 ResolvExpr::referenceToRvalueConversion( base ); 606 addMembers( t->getAggr(), new MemberExpr( dwt, base ) , handleConflicts);584 addMembers( t->getAggr(), new MemberExpr( dwt, base ) ); 607 585 } 608 586 } … … 611 589 } 612 590 613 void Indexer::addWith( std::list< Expression * > & withExprs , BaseSyntaxNode * withStmt) {591 void Indexer::addWith( std::list< Expression * > & withExprs ) { 614 592 for ( Expression * expr : withExprs ) { 615 593 if ( expr->result ) { … … 617 595 assertf( aggr, "WithStmt expr has non-aggregate type: %s", toString( expr->result ).c_str() ); 618 596 619 addMembers( aggr, expr, [withStmt](IdData & existing, const std::string &) { 620 // on conflict, delete the identifier 621 existing.deleteStmt = withStmt; 622 return true; 623 }); 597 addMembers( aggr, expr ); 624 598 } 625 599 } … … 680 654 681 655 void Indexer::print( std::ostream &os, int indent ) const { 682 656 using std::cerr; 683 657 684 658 if ( tables ) { … … 706 680 707 681 Expression * Indexer::IdData::combine() const { 708 Expression * ret = nullptr;709 682 if ( baseExpr ) { 710 683 Expression * base = baseExpr->clone(); 711 684 ResolvExpr::referenceToRvalueConversion( base ); 712 ret = new MemberExpr( id, base );685 Expression * ret = new MemberExpr( id, base ); 713 686 // xxx - this introduces hidden environments, for now remove them. 714 687 // std::swap( base->env, ret->env ); 715 688 delete base->env; 716 689 base->env = nullptr; 717 } else { 718 ret = new VariableExpr( id ); 719 } 720 if ( deleteStmt ) ret = new DeletedExpr( ret, deleteStmt ); 721 return ret; 690 return ret; 691 } else { 692 return new VariableExpr( id ); 693 } 722 694 } 723 695 } // namespace SymTab -
src/SymTab/Indexer.h
r7c782af r62cd621 19 19 #include <list> // for list 20 20 #include <string> // for string 21 #include <functional> // for function22 21 23 22 #include "SynTree/Visitor.h" // for Visitor … … 41 40 42 41 struct IdData { 43 DeclarationWithType * id = nullptr; 44 Expression * baseExpr = nullptr; // WithExpr 45 46 /// non-null if this declaration is deleted 47 BaseSyntaxNode * deleteStmt = nullptr; 42 DeclarationWithType * id; 43 Expression * baseExpr; // WithExpr 48 44 49 45 Expression * combine() const; … … 66 62 67 63 /// looks up a specific mangled ID at the given scope 68 IdData * lookupIdAtScope( const std::string &id, const std::string &mangleName, unsigned long scope ); 69 const IdData * lookupIdAtScope( const std::string &id, const std::string &mangleName, unsigned long scope ) const; 64 DeclarationWithType *lookupIdAtScope( const std::string &id, const std::string &mangleName, unsigned long scope ) const; 70 65 /// returns true if there exists a declaration with C linkage and the given name with a different mangled name 71 66 bool hasIncompatibleCDecl( const std::string &id, const std::string &mangleName, unsigned long scope ) const; … … 79 74 TraitDecl *lookupTraitAtScope( const std::string &id, unsigned long scope ) const; 80 75 81 typedef std::function<bool(IdData &, const std::string &)> ConflictFunction; 82 83 void addId( DeclarationWithType * decl, Expression * baseExpr = nullptr ); 84 void addDeletedId( DeclarationWithType * decl, BaseSyntaxNode * deleteStmt ); 85 76 void addId( DeclarationWithType *decl, Expression * baseExpr = nullptr ); 86 77 void addType( NamedTypeDecl *decl ); 87 78 void addStruct( const std::string &id ); … … 93 84 94 85 /// adds all of the IDs from WithStmt exprs 95 void addWith( std::list< Expression * > & withExprs , BaseSyntaxNode * withStmt);86 void addWith( std::list< Expression * > & withExprs ); 96 87 97 88 /// adds all of the members of the Aggregate (addWith helper) 98 void addMembers( AggregateDecl * aggr, Expression * expr , ConflictFunction);89 void addMembers( AggregateDecl * aggr, Expression * expr ); 99 90 100 91 /// convenience function for adding a list of Ids to the indexer … … 126 117 /// Ensures that tables variable is writable (i.e. allocated, uniquely owned by this Indexer, and at the current scope) 127 118 void makeWritable(); 128 129 /// common code for addId, addDeletedId, etc.130 void addId( DeclarationWithType * decl, ConflictFunction, Expression * baseExpr = nullptr, BaseSyntaxNode * deleteStmt = nullptr );131 119 }; 132 120 } // namespace SymTab -
src/SymTab/Mangler.cc
r7c782af r62cd621 37 37 struct Mangler : public WithShortCircuiting, public WithVisitorRef<Mangler> { 38 38 Mangler( bool mangleOverridable, bool typeMode, bool mangleGenericParams ); 39 Mangler( const Mangler & ) = delete;39 Mangler( const Mangler & ); 40 40 41 41 void previsit( BaseSyntaxNode * ) { visit_children = false; } -
src/SymTab/Validate.cc
r7c782af r62cd621 351 351 namespace { 352 352 template< typename DWTList > 353 void fixFunctionList( DWTList & dwts, bool isVarArgs, FunctionType * func ) { 354 auto nvals = dwts.size(); 355 bool containsVoid = false; 356 for ( auto & dwt : dwts ) { 357 // fix each DWT and record whether a void was found 358 containsVoid |= fixFunction( dwt ); 359 } 360 361 // the only case in which "void" is valid is where it is the only one in the list 362 if ( containsVoid && ( nvals > 1 || isVarArgs ) ) { 363 throw SemanticError( func, "invalid type void in function type " ); 364 } 365 366 // one void is the only thing in the list; remove it. 367 if ( containsVoid ) { 368 delete dwts.front(); 369 dwts.clear(); 370 } 353 void fixFunctionList( DWTList & dwts, FunctionType * func ) { 354 // the only case in which "void" is valid is where it is the only one in the list; then it should be removed 355 // entirely. other fix ups are handled by the FixFunction class 356 typedef typename DWTList::iterator DWTIterator; 357 DWTIterator begin( dwts.begin() ), end( dwts.end() ); 358 if ( begin == end ) return; 359 PassVisitor<FixFunction> fixer; 360 DWTIterator i = begin; 361 *i = (*i)->acceptMutator( fixer ); 362 if ( fixer.pass.isVoid ) { 363 DWTIterator j = i; 364 ++i; 365 delete *j; 366 dwts.erase( j ); 367 if ( i != end ) { 368 throw SemanticError( func, "invalid type void in function type " ); 369 } // if 370 } else { 371 ++i; 372 for ( ; i != end; ++i ) { 373 PassVisitor<FixFunction> fixer; 374 *i = (*i)->acceptMutator( fixer ); 375 if ( fixer.pass.isVoid ) { 376 throw SemanticError( func, "invalid type void in function type " ); 377 } // if 378 } // for 379 } // if 371 380 } 372 381 } … … 374 383 void EnumAndPointerDecay::previsit( FunctionType *func ) { 375 384 // Fix up parameters and return types 376 fixFunctionList( func-> parameters, func->isVarArgs, func );377 fixFunctionList( func-> returnVals, false, func );385 fixFunctionList( func->get_parameters(), func ); 386 fixFunctionList( func->get_returnVals(), func ); 378 387 } 379 388 … … 617 626 // apply FixFunction to every assertion to check for invalid void type 618 627 for ( DeclarationWithType *& assertion : type->assertions ) { 619 bool isVoid = fixFunction( assertion ); 620 if ( isVoid ) { 628 PassVisitor<FixFunction> fixer; 629 assertion = assertion->acceptMutator( fixer ); 630 if ( fixer.pass.isVoid ) { 621 631 throw SemanticError( node, "invalid type void in assertion of function " ); 622 632 } // if -
src/SynTree/Attribute.cc
r7c782af r62cd621 15 15 16 16 #include <ostream> // for operator<<, ostream, basic_ostream, endl 17 #include <set>18 17 19 18 #include "Attribute.h" … … 22 21 23 22 Attribute::Attribute( const Attribute &other ) : name( other.name ) { 24 23 cloneAll( other.parameters, parameters ); 25 24 } 26 25 27 26 Attribute::~Attribute() { 28 deleteAll( parameters ); 29 } 30 31 bool Attribute::isValidOnFuncParam() const { 32 // attributes such as aligned, cleanup, etc. produce GCC errors when they appear 33 // on function parameters. Maintain here a whitelist of attribute names that are 34 // allowed to appear on parameters. 35 static std::set< std::string > valid = { 36 "noreturn", "unused" 37 }; 38 return valid.count( normalizedName() ); 39 } 40 41 std::string Attribute::normalizedName() const { 42 // trim beginning/ending _, convert to lowercase 43 auto begin = name.find_first_not_of('_'); 44 auto end = name.find_last_not_of('_'); 45 if (begin == std::string::npos || end == std::string::npos) return ""; 46 std::string ret; 47 ret.reserve( end-begin+1 ); 48 std::transform( &name[begin], &name[end+1], back_inserter( ret ), tolower ); 49 return ret; 27 deleteAll( parameters ); 50 28 } 51 29 52 30 void Attribute::print( std::ostream &os, Indenter indent ) const { 53 54 31 using std::endl; 32 using std::string; 55 33 56 57 58 59 60 61 62 34 if ( ! empty() ) { 35 os << "Attribute with name: " << name; 36 if ( ! parameters.empty() ) { 37 os << " with parameters: " << endl; 38 printAll( parameters, os, indent+1 ); 39 } 40 } 63 41 } 64 42 -
src/SynTree/Attribute.h
r7c782af r62cd621 43 43 bool empty() const { return name == ""; } 44 44 45 std::string normalizedName() const;46 47 /// true if this attribute is allowed to appear attached to a function parameter48 bool isValidOnFuncParam() const;49 50 45 Attribute * clone() const override { return new Attribute( *this ); } 51 46 virtual void accept( Visitor & v ) override { v.visit( this ); } -
src/SynTree/Expression.cc
r7c782af r62cd621 710 710 } 711 711 712 DeletedExpr::DeletedExpr( Expression * expr, BaseSyntaxNode * deleteStmt ) : expr( expr ), deleteStmt( deleteStmt ) {713 assert( expr->result );714 result = expr->result->clone();715 }716 DeletedExpr::DeletedExpr( const DeletedExpr & other ) : Expression( other ), expr( maybeClone( other.expr ) ), deleteStmt( other.deleteStmt ) {}717 DeletedExpr::~DeletedExpr() {718 delete expr;719 }720 721 void DeletedExpr::print( std::ostream & os, Indenter indent ) const {722 os << "Deleted Expression" << std::endl << indent+1;723 expr->print( os, indent+1 );724 os << std::endl << indent+1 << "... deleted by: ";725 deleteStmt->print( os, indent+1 );726 }727 728 729 712 // Local Variables: // 730 713 // tab-width: 4 // -
src/SynTree/Expression.h
r7c782af r62cd621 822 822 }; 823 823 824 /// expression that contains a deleted identifier - should never make it past the resolver.825 class DeletedExpr : public Expression {826 public:827 Expression * expr;828 BaseSyntaxNode * deleteStmt;829 830 DeletedExpr( Expression * expr, BaseSyntaxNode * deleteStmt );831 DeletedExpr( const DeletedExpr & other );832 ~DeletedExpr();833 834 virtual DeletedExpr * clone() const { return new DeletedExpr( * this ); }835 virtual void accept( Visitor & v ) { v.visit( this ); }836 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }837 virtual void print( std::ostream & os, Indenter indent = {} ) const;838 };839 840 824 // Local Variables: // 841 825 // tab-width: 4 // -
src/SynTree/Mutator.h
r7c782af r62cd621 55 55 virtual Statement * mutate( ImplicitCtorDtorStmt * impCtorDtorStmt ); 56 56 57 virtual Expression * mutate( ApplicationExpr * applicationExpr ); 58 virtual Expression * mutate( UntypedExpr * untypedExpr ); 59 virtual Expression * mutate( NameExpr * nameExpr ); 60 virtual Expression * mutate( AddressExpr * castExpr ); 61 virtual Expression * mutate( LabelAddressExpr * labAddressExpr ); 62 virtual Expression * mutate( CastExpr * castExpr ); 63 virtual Expression * mutate( VirtualCastExpr * castExpr ); 64 virtual Expression * mutate( UntypedMemberExpr * memberExpr ); 65 virtual Expression * mutate( MemberExpr * memberExpr ); 66 virtual Expression * mutate( VariableExpr * variableExpr ); 67 virtual Expression * mutate( ConstantExpr * constantExpr ); 68 virtual Expression * mutate( SizeofExpr * sizeofExpr ); 69 virtual Expression * mutate( AlignofExpr * alignofExpr ); 70 virtual Expression * mutate( UntypedOffsetofExpr * offsetofExpr ); 71 virtual Expression * mutate( OffsetofExpr * offsetofExpr ); 72 virtual Expression * mutate( OffsetPackExpr * offsetPackExpr ); 73 virtual Expression * mutate( AttrExpr * attrExpr ); 74 virtual Expression * mutate( LogicalExpr * logicalExpr ); 75 virtual Expression * mutate( ConditionalExpr * conditionalExpr ); 76 virtual Expression * mutate( CommaExpr * commaExpr ); 77 virtual Expression * mutate( TypeExpr * typeExpr ); 78 virtual Expression * mutate( AsmExpr * asmExpr ); 79 virtual Expression * mutate( ImplicitCopyCtorExpr * impCpCtorExpr ); 80 virtual Expression * mutate( ConstructorExpr * ctorExpr ); 81 virtual Expression * mutate( CompoundLiteralExpr * compLitExpr ); 82 virtual Expression * mutate( RangeExpr * rangeExpr ); 83 virtual Expression * mutate( UntypedTupleExpr * tupleExpr ); 84 virtual Expression * mutate( TupleExpr * tupleExpr ); 85 virtual Expression * mutate( TupleIndexExpr * tupleExpr ); 86 virtual Expression * mutate( TupleAssignExpr * assignExpr ); 87 virtual Expression * mutate( StmtExpr * stmtExpr ); 88 virtual Expression * mutate( UniqueExpr * uniqueExpr ); 89 virtual Expression * mutate( UntypedInitExpr * initExpr ); 90 virtual Expression * mutate( InitExpr * initExpr ); 91 virtual Expression * mutate( DeletedExpr * delExpr ) = 0; 57 virtual Expression* mutate( ApplicationExpr * applicationExpr ); 58 virtual Expression* mutate( UntypedExpr * untypedExpr ); 59 virtual Expression* mutate( NameExpr * nameExpr ); 60 virtual Expression* mutate( AddressExpr * castExpr ); 61 virtual Expression* mutate( LabelAddressExpr * labAddressExpr ); 62 virtual Expression* mutate( CastExpr * castExpr ); 63 virtual Expression* mutate( VirtualCastExpr * castExpr ); 64 virtual Expression* mutate( UntypedMemberExpr * memberExpr ); 65 virtual Expression* mutate( MemberExpr * memberExpr ); 66 virtual Expression* mutate( VariableExpr * variableExpr ); 67 virtual Expression* mutate( ConstantExpr * constantExpr ); 68 virtual Expression* mutate( SizeofExpr * sizeofExpr ); 69 virtual Expression* mutate( AlignofExpr * alignofExpr ); 70 virtual Expression* mutate( UntypedOffsetofExpr * offsetofExpr ); 71 virtual Expression* mutate( OffsetofExpr * offsetofExpr ); 72 virtual Expression* mutate( OffsetPackExpr * offsetPackExpr ); 73 virtual Expression* mutate( AttrExpr * attrExpr ); 74 virtual Expression* mutate( LogicalExpr * logicalExpr ); 75 virtual Expression* mutate( ConditionalExpr * conditionalExpr ); 76 virtual Expression* mutate( CommaExpr * commaExpr ); 77 virtual Expression* mutate( TypeExpr * typeExpr ); 78 virtual Expression* mutate( AsmExpr * asmExpr ); 79 virtual Expression* mutate( ImplicitCopyCtorExpr * impCpCtorExpr ); 80 virtual Expression* mutate( ConstructorExpr * ctorExpr ); 81 virtual Expression* mutate( CompoundLiteralExpr * compLitExpr ); 82 virtual Expression* mutate( RangeExpr * rangeExpr ); 83 virtual Expression* mutate( UntypedTupleExpr * tupleExpr ); 84 virtual Expression* mutate( TupleExpr * tupleExpr ); 85 virtual Expression* mutate( TupleIndexExpr * tupleExpr ); 86 virtual Expression* mutate( TupleAssignExpr * assignExpr ); 87 virtual Expression* mutate( StmtExpr * stmtExpr ); 88 virtual Expression* mutate( UniqueExpr * uniqueExpr ); 89 virtual Expression* mutate( UntypedInitExpr * initExpr ); 90 virtual Expression* mutate( InitExpr * initExpr ); 92 91 93 92 virtual Type * mutate( VoidType * basicType ); -
src/SynTree/Statement.cc
r7c782af r62cd621 468 468 void WithStmt::print( std::ostream & os, Indenter indent ) const { 469 469 os << "With statement" << endl; 470 os << indent << "... with expressions: " << endl;471 printAll( exprs, os, indent+1 );472 470 os << indent << "... with statement:" << endl << indent+1; 473 471 stmt->print( os, indent+1 ); -
src/SynTree/SynTree.h
r7c782af r62cd621 97 97 class UntypedInitExpr; 98 98 class InitExpr; 99 class DeletedExpr;100 99 101 100 class Type; -
src/SynTree/Visitor.h
r7c782af r62cd621 91 91 virtual void visit( UntypedInitExpr * initExpr ); 92 92 virtual void visit( InitExpr * initExpr ); 93 virtual void visit( DeletedExpr * delExpr ) = 0;94 93 95 94 virtual void visit( VoidType * basicType ); -
src/Tuples/Explode.h
r7c782af r62cd621 43 43 /// Append alternative to an OutputIterator of Alternatives 44 44 template<typename OutputIterator> 45 void append( OutputIterator out, Expression* expr, const ResolvExpr::TypeEnvironment& env, 45 void append( OutputIterator out, Expression* expr, const ResolvExpr::TypeEnvironment& env, 46 46 const ResolvExpr::Cost& cost, const ResolvExpr::Cost& cvtCost ) { 47 47 *out++ = ResolvExpr::Alternative{ expr, env, cost, cvtCost }; … … 49 49 50 50 /// Append alternative to an ExplodedActual 51 static inline void append( ResolvExpr::ExplodedActual& ea, Expression* expr, 51 static inline void append( ResolvExpr::ExplodedActual& ea, Expression* expr, 52 52 const ResolvExpr::TypeEnvironment&, const ResolvExpr::Cost&, const ResolvExpr::Cost& ) { 53 53 ea.exprs.emplace_back( expr ); … … 57 57 /// helper function used by explode 58 58 template< typename Output > 59 void explodeUnique( Expression * expr, const ResolvExpr::Alternative & alt, 59 void explodeUnique( Expression * expr, const ResolvExpr::Alternative & alt, 60 60 const SymTab::Indexer & indexer, Output&& out, bool isTupleAssign ) { 61 61 if ( isTupleAssign ) { … … 63 63 if ( CastExpr * castExpr = isReferenceCast( expr ) ) { 64 64 ResolvExpr::AltList alts; 65 explodeUnique( 65 explodeUnique( 66 66 castExpr->get_arg(), alt, indexer, back_inserter( alts ), isTupleAssign ); 67 67 for ( ResolvExpr::Alternative & alt : alts ) { 68 68 // distribute reference cast over all components 69 append( std::forward<Output>(out), distributeReference( alt.release_expr() ), 69 append( std::forward<Output>(out), distributeReference( alt.release_expr() ), 70 70 alt.env, alt.cost, alt.cvtCost ); 71 71 } … … 108 108 /// expands a tuple-valued alternative into multiple alternatives, each with a non-tuple-type 109 109 template< typename Output > 110 void explode( const ResolvExpr::Alternative &alt, const SymTab::Indexer & indexer, 110 void explode( const ResolvExpr::Alternative &alt, const SymTab::Indexer & indexer, 111 111 Output&& out, bool isTupleAssign = false ) { 112 112 explodeUnique( alt.expr, alt, indexer, std::forward<Output>(out), isTupleAssign ); … … 115 115 // explode list of alternatives 116 116 template< typename AltIterator, typename Output > 117 void explode( AltIterator altBegin, AltIterator altEnd, const SymTab::Indexer & indexer, 117 void explode( AltIterator altBegin, AltIterator altEnd, const SymTab::Indexer & indexer, 118 118 Output&& out, bool isTupleAssign = false ) { 119 119 for ( ; altBegin != altEnd; ++altBegin ) { … … 123 123 124 124 template< typename Output > 125 void explode( const ResolvExpr::AltList & alts, const SymTab::Indexer & indexer, Output&& out, 125 void explode( const ResolvExpr::AltList & alts, const SymTab::Indexer & indexer, Output&& out, 126 126 bool isTupleAssign = false ) { 127 127 explode( alts.begin(), alts.end(), indexer, std::forward<Output>(out), isTupleAssign ); -
src/libcfa/assert.c
r7c782af r62cd621 22 22 extern const char * __progname; // global name of running executable (argv[0]) 23 23 24 #define CFA_ASSERT_FMT "Cforall Assertion error \"%s\"from program \"%s\" in \"%s\" at line %d in file \"%s\""24 #define CFA_ASSERT_FMT "Cforall Assertion error from program \"%s\" in \"%s\" at line %d in file \"%s\"" 25 25 26 26 // called by macro assert in assert.h 27 27 void __assert_fail( const char *assertion, const char *file, unsigned int line, const char *function ) { 28 __cfaabi_dbg_bits_print_safe( CFA_ASSERT_FMT ".\n", assertion,__progname, function, line, file );28 __cfaabi_dbg_bits_print_safe( CFA_ASSERT_FMT ".\n", __progname, function, line, file ); 29 29 abort(); 30 30 } … … 33 33 void __assert_fail_f( const char *assertion, const char *file, unsigned int line, const char *function, const char *fmt, ... ) { 34 34 __cfaabi_dbg_bits_acquire(); 35 __cfaabi_dbg_bits_print_nolock( CFA_ASSERT_FMT ": ", assertion,__progname, function, line, file );35 __cfaabi_dbg_bits_print_nolock( CFA_ASSERT_FMT ": ", __progname, function, line, file ); 36 36 37 37 va_list args; -
src/tests/.expect/attributes.x64.txt
r7c782af r62cd621 63 63 static inline void ___destructor__F_R4sFdl_autogen___1(struct Fdl *___dst__R4sFdl_1); 64 64 static inline struct Fdl ___operator_assign__F4sFdl_R4sFdl4sFdl_autogen___1(struct Fdl *___dst__R4sFdl_1, struct Fdl ___src__4sFdl_1); 65 static inline void ___constructor__F_R4sFdli_autogen___1(struct Fdl *___dst__R4sFdl_1, __attribute__ ((unused))signed int __f1__i_1);66 static inline void ___constructor__F_R4sFdlii_autogen___1(struct Fdl *___dst__R4sFdl_1, __attribute__ ((unused)) signed int __f1__i_1, __attribute__ ((unused))signed int __f2__i_1);67 static inline void ___constructor__F_R4sFdliii_autogen___1(struct Fdl *___dst__R4sFdl_1, __attribute__ ((unused)) signed int __f1__i_1, __attribute__ ((unused)) signed int __f2__i_1, __attribute__ ((unused,unused))signed int __f3__i_1);68 static inline void ___constructor__F_R4sFdliiii_autogen___1(struct Fdl *___dst__R4sFdl_1, __attribute__ ((unused)) signed int __f1__i_1, __attribute__ ((unused)) signed int __f2__i_1, __attribute__ ((unused,unused)) signed int __f3__i_1, __attribute__ ((unused))signed int __f4__i_1);69 static inline void ___constructor__F_R4sFdliiiii_autogen___1(struct Fdl *___dst__R4sFdl_1, __attribute__ ((unused)) signed int __f1__i_1, __attribute__ ((unused)) signed int __f2__i_1, __attribute__ ((unused,unused)) signed int __f3__i_1, __attribute__ ((unused)) signed int __f4__i_1, __attribute__ ((unused,unused))signed int __f5__i_1);70 static inline void ___constructor__F_R4sFdliiiiii_autogen___1(struct Fdl *___dst__R4sFdl_1, __attribute__ ((unused)) signed int __f1__i_1, __attribute__ ((unused)) signed int __f2__i_1, __attribute__ ((unused,unused)) signed int __f3__i_1, __attribute__ ((unused)) signed int __f4__i_1, __attribute__ ((unused,unused))signed int __f5__i_1, signed int __f6__i_1);71 static inline void ___constructor__F_R4sFdliiiiiii_autogen___1(struct Fdl *___dst__R4sFdl_1, __attribute__ ((unused)) signed int __f1__i_1, __attribute__ ((unused)) signed int __f2__i_1, __attribute__ ((unused,unused)) signed int __f3__i_1, __attribute__ ((unused)) signed int __f4__i_1, __attribute__ ((unused,unused)) signed int __f5__i_1, signed int __f6__i_1, __attribute__ ((unused,unused))signed int __f7__i_1);72 static inline void ___constructor__F_R4sFdliiiiiiii_autogen___1(struct Fdl *___dst__R4sFdl_1, __attribute__ ((unused)) signed int __f1__i_1, __attribute__ ((unused)) signed int __f2__i_1, __attribute__ ((unused,unused)) signed int __f3__i_1, __attribute__ ((unused)) signed int __f4__i_1, __attribute__ ((unused,unused)) signed int __f5__i_1, signed int __f6__i_1, __attribute__ ((unused,unused)) signed int __f7__i_1, __attribute__ ((unused))signed int __f8__i_1);73 static inline void ___constructor__F_R4sFdliiiiiiiii_autogen___1(struct Fdl *___dst__R4sFdl_1, __attribute__ ((unused)) signed int __f1__i_1, __attribute__ ((unused)) signed int __f2__i_1, __attribute__ ((unused,unused)) signed int __f3__i_1, __attribute__ ((unused)) signed int __f4__i_1, __attribute__ ((unused,unused)) signed int __f5__i_1, signed int __f6__i_1, __attribute__ ((unused,unused)) signed int __f7__i_1, __attribute__ ((unused)) signed int __f8__i_1, __attribute__ ((unused))signed int __anonymous_object1);74 static inline void ___constructor__F_R4sFdliiiiiiiiiPi_autogen___1(struct Fdl *___dst__R4sFdl_1, __attribute__ ((unused)) signed int __f1__i_1, __attribute__ ((unused)) signed int __f2__i_1, __attribute__ ((unused,unused)) signed int __f3__i_1, __attribute__ ((unused)) signed int __f4__i_1, __attribute__ ((unused,unused)) signed int __f5__i_1, signed int __f6__i_1, __attribute__ ((unused,unused)) signed int __f7__i_1, __attribute__ ((unused)) signed int __f8__i_1, __attribute__ ((unused)) signed int __anonymous_object2, __attribute__ ((unused,unused))signed int *__f9__Pi_1);65 static inline void ___constructor__F_R4sFdli_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1); 66 static inline void ___constructor__F_R4sFdlii_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1); 67 static inline void ___constructor__F_R4sFdliii_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1); 68 static inline void ___constructor__F_R4sFdliiii_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1, signed int __f4__i_1); 69 static inline void ___constructor__F_R4sFdliiiii_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1, signed int __f4__i_1, signed int __f5__i_1); 70 static inline void ___constructor__F_R4sFdliiiiii_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1, signed int __f4__i_1, signed int __f5__i_1, signed int __f6__i_1); 71 static inline void ___constructor__F_R4sFdliiiiiii_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1, signed int __f4__i_1, signed int __f5__i_1, signed int __f6__i_1, signed int __f7__i_1); 72 static inline void ___constructor__F_R4sFdliiiiiiii_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1, signed int __f4__i_1, signed int __f5__i_1, signed int __f6__i_1, signed int __f7__i_1, signed int __f8__i_1); 73 static inline void ___constructor__F_R4sFdliiiiiiiii_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1, signed int __f4__i_1, signed int __f5__i_1, signed int __f6__i_1, signed int __f7__i_1, signed int __f8__i_1, signed int __anonymous_object1); 74 static inline void ___constructor__F_R4sFdliiiiiiiiiPi_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1, signed int __f4__i_1, signed int __f5__i_1, signed int __f6__i_1, signed int __f7__i_1, signed int __f8__i_1, signed int __anonymous_object2, signed int *__f9__Pi_1); 75 75 static inline void ___constructor__F_R4sFdl_autogen___1(struct Fdl *___dst__R4sFdl_1){ 76 76 ((void)((*___dst__R4sFdl_1).__f1__i_1) /* ?{} */); … … 124 124 return ___ret__4sFdl_1; 125 125 } 126 static inline void ___constructor__F_R4sFdli_autogen___1(struct Fdl *___dst__R4sFdl_1, __attribute__ ((unused))signed int __f1__i_1){126 static inline void ___constructor__F_R4sFdli_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1){ 127 127 ((void)((*___dst__R4sFdl_1).__f1__i_1=__f1__i_1) /* ?{} */); 128 128 ((void)((*___dst__R4sFdl_1).__f2__i_1) /* ?{} */); … … 136 136 ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */); 137 137 } 138 static inline void ___constructor__F_R4sFdlii_autogen___1(struct Fdl *___dst__R4sFdl_1, __attribute__ ((unused)) signed int __f1__i_1, __attribute__ ((unused))signed int __f2__i_1){138 static inline void ___constructor__F_R4sFdlii_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1){ 139 139 ((void)((*___dst__R4sFdl_1).__f1__i_1=__f1__i_1) /* ?{} */); 140 140 ((void)((*___dst__R4sFdl_1).__f2__i_1=__f2__i_1) /* ?{} */); … … 148 148 ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */); 149 149 } 150 static inline void ___constructor__F_R4sFdliii_autogen___1(struct Fdl *___dst__R4sFdl_1, __attribute__ ((unused)) signed int __f1__i_1, __attribute__ ((unused)) signed int __f2__i_1, __attribute__ ((unused,unused))signed int __f3__i_1){150 static inline void ___constructor__F_R4sFdliii_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1){ 151 151 ((void)((*___dst__R4sFdl_1).__f1__i_1=__f1__i_1) /* ?{} */); 152 152 ((void)((*___dst__R4sFdl_1).__f2__i_1=__f2__i_1) /* ?{} */); … … 160 160 ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */); 161 161 } 162 static inline void ___constructor__F_R4sFdliiii_autogen___1(struct Fdl *___dst__R4sFdl_1, __attribute__ ((unused)) signed int __f1__i_1, __attribute__ ((unused)) signed int __f2__i_1, __attribute__ ((unused,unused)) signed int __f3__i_1, __attribute__ ((unused))signed int __f4__i_1){162 static inline void ___constructor__F_R4sFdliiii_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1, signed int __f4__i_1){ 163 163 ((void)((*___dst__R4sFdl_1).__f1__i_1=__f1__i_1) /* ?{} */); 164 164 ((void)((*___dst__R4sFdl_1).__f2__i_1=__f2__i_1) /* ?{} */); … … 172 172 ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */); 173 173 } 174 static inline void ___constructor__F_R4sFdliiiii_autogen___1(struct Fdl *___dst__R4sFdl_1, __attribute__ ((unused)) signed int __f1__i_1, __attribute__ ((unused)) signed int __f2__i_1, __attribute__ ((unused,unused)) signed int __f3__i_1, __attribute__ ((unused)) signed int __f4__i_1, __attribute__ ((unused,unused))signed int __f5__i_1){175 ((void)((*___dst__R4sFdl_1).__f1__i_1=__f1__i_1) /* ?{} */); 176 ((void)((*___dst__R4sFdl_1).__f2__i_1=__f2__i_1) /* ?{} */); 177 ((void)((*___dst__R4sFdl_1).__f3__i_1=__f3__i_1) /* ?{} */); 178 ((void)((*___dst__R4sFdl_1).__f4__i_1=__f4__i_1) /* ?{} */); 179 ((void)((*___dst__R4sFdl_1).__f5__i_1=__f5__i_1) /* ?{} */); 180 ((void)((*___dst__R4sFdl_1).__f6__i_1) /* ?{} */); 181 ((void)((*___dst__R4sFdl_1).__f7__i_1) /* ?{} */); 182 ((void)((*___dst__R4sFdl_1).__f8__i_1) /* ?{} */); 183 ((void)((*___dst__R4sFdl_1).__anonymous_object0) /* ?{} */); 184 ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */); 185 } 186 static inline void ___constructor__F_R4sFdliiiiii_autogen___1(struct Fdl *___dst__R4sFdl_1, __attribute__ ((unused)) signed int __f1__i_1, __attribute__ ((unused)) signed int __f2__i_1, __attribute__ ((unused,unused)) signed int __f3__i_1, __attribute__ ((unused)) signed int __f4__i_1, __attribute__ ((unused,unused))signed int __f5__i_1, signed int __f6__i_1){174 static inline void ___constructor__F_R4sFdliiiii_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1, signed int __f4__i_1, signed int __f5__i_1){ 175 ((void)((*___dst__R4sFdl_1).__f1__i_1=__f1__i_1) /* ?{} */); 176 ((void)((*___dst__R4sFdl_1).__f2__i_1=__f2__i_1) /* ?{} */); 177 ((void)((*___dst__R4sFdl_1).__f3__i_1=__f3__i_1) /* ?{} */); 178 ((void)((*___dst__R4sFdl_1).__f4__i_1=__f4__i_1) /* ?{} */); 179 ((void)((*___dst__R4sFdl_1).__f5__i_1=__f5__i_1) /* ?{} */); 180 ((void)((*___dst__R4sFdl_1).__f6__i_1) /* ?{} */); 181 ((void)((*___dst__R4sFdl_1).__f7__i_1) /* ?{} */); 182 ((void)((*___dst__R4sFdl_1).__f8__i_1) /* ?{} */); 183 ((void)((*___dst__R4sFdl_1).__anonymous_object0) /* ?{} */); 184 ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */); 185 } 186 static inline void ___constructor__F_R4sFdliiiiii_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1, signed int __f4__i_1, signed int __f5__i_1, signed int __f6__i_1){ 187 187 ((void)((*___dst__R4sFdl_1).__f1__i_1=__f1__i_1) /* ?{} */); 188 188 ((void)((*___dst__R4sFdl_1).__f2__i_1=__f2__i_1) /* ?{} */); … … 196 196 ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */); 197 197 } 198 static inline void ___constructor__F_R4sFdliiiiiii_autogen___1(struct Fdl *___dst__R4sFdl_1, __attribute__ ((unused)) signed int __f1__i_1, __attribute__ ((unused)) signed int __f2__i_1, __attribute__ ((unused,unused)) signed int __f3__i_1, __attribute__ ((unused)) signed int __f4__i_1, __attribute__ ((unused,unused)) signed int __f5__i_1, signed int __f6__i_1, __attribute__ ((unused,unused))signed int __f7__i_1){198 static inline void ___constructor__F_R4sFdliiiiiii_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1, signed int __f4__i_1, signed int __f5__i_1, signed int __f6__i_1, signed int __f7__i_1){ 199 199 ((void)((*___dst__R4sFdl_1).__f1__i_1=__f1__i_1) /* ?{} */); 200 200 ((void)((*___dst__R4sFdl_1).__f2__i_1=__f2__i_1) /* ?{} */); … … 208 208 ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */); 209 209 } 210 static inline void ___constructor__F_R4sFdliiiiiiii_autogen___1(struct Fdl *___dst__R4sFdl_1, __attribute__ ((unused)) signed int __f1__i_1, __attribute__ ((unused)) signed int __f2__i_1, __attribute__ ((unused,unused)) signed int __f3__i_1, __attribute__ ((unused)) signed int __f4__i_1, __attribute__ ((unused,unused)) signed int __f5__i_1, signed int __f6__i_1, __attribute__ ((unused,unused)) signed int __f7__i_1, __attribute__ ((unused))signed int __f8__i_1){210 static inline void ___constructor__F_R4sFdliiiiiiii_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1, signed int __f4__i_1, signed int __f5__i_1, signed int __f6__i_1, signed int __f7__i_1, signed int __f8__i_1){ 211 211 ((void)((*___dst__R4sFdl_1).__f1__i_1=__f1__i_1) /* ?{} */); 212 212 ((void)((*___dst__R4sFdl_1).__f2__i_1=__f2__i_1) /* ?{} */); … … 220 220 ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */); 221 221 } 222 static inline void ___constructor__F_R4sFdliiiiiiiii_autogen___1(struct Fdl *___dst__R4sFdl_1, __attribute__ ((unused)) signed int __f1__i_1, __attribute__ ((unused)) signed int __f2__i_1, __attribute__ ((unused,unused)) signed int __f3__i_1, __attribute__ ((unused)) signed int __f4__i_1, __attribute__ ((unused,unused)) signed int __f5__i_1, signed int __f6__i_1, __attribute__ ((unused,unused)) signed int __f7__i_1, __attribute__ ((unused)) signed int __f8__i_1, __attribute__ ((unused))signed int __anonymous_object3){222 static inline void ___constructor__F_R4sFdliiiiiiiii_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1, signed int __f4__i_1, signed int __f5__i_1, signed int __f6__i_1, signed int __f7__i_1, signed int __f8__i_1, signed int __anonymous_object3){ 223 223 ((void)((*___dst__R4sFdl_1).__f1__i_1=__f1__i_1) /* ?{} */); 224 224 ((void)((*___dst__R4sFdl_1).__f2__i_1=__f2__i_1) /* ?{} */); … … 232 232 ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */); 233 233 } 234 static inline void ___constructor__F_R4sFdliiiiiiiiiPi_autogen___1(struct Fdl *___dst__R4sFdl_1, __attribute__ ((unused)) signed int __f1__i_1, __attribute__ ((unused)) signed int __f2__i_1, __attribute__ ((unused,unused)) signed int __f3__i_1, __attribute__ ((unused)) signed int __f4__i_1, __attribute__ ((unused,unused)) signed int __f5__i_1, signed int __f6__i_1, __attribute__ ((unused,unused)) signed int __f7__i_1, __attribute__ ((unused)) signed int __f8__i_1, __attribute__ ((unused)) signed int __anonymous_object4, __attribute__ ((unused,unused))signed int *__f9__Pi_1){234 static inline void ___constructor__F_R4sFdliiiiiiiiiPi_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1, signed int __f4__i_1, signed int __f5__i_1, signed int __f6__i_1, signed int __f7__i_1, signed int __f8__i_1, signed int __anonymous_object4, signed int *__f9__Pi_1){ 235 235 ((void)((*___dst__R4sFdl_1).__f1__i_1=__f1__i_1) /* ?{} */); 236 236 ((void)((*___dst__R4sFdl_1).__f2__i_1=__f2__i_1) /* ?{} */); … … 371 371 static inline void ___destructor__F_R4sVad_autogen___1(struct Vad *___dst__R4sVad_1); 372 372 static inline struct Vad ___operator_assign__F4sVad_R4sVad4sVad_autogen___1(struct Vad *___dst__R4sVad_1, struct Vad ___src__4sVad_1); 373 static inline void ___constructor__F_R4sVadi_autogen___1(struct Vad *___dst__R4sVad_1, __attribute__ ((unused))signed int __anonymous_object36);374 static inline void ___constructor__F_R4sVadiPi_autogen___1(struct Vad *___dst__R4sVad_1, __attribute__ ((unused)) signed int __anonymous_object37, __attribute__ ((unused,unused))signed int *__anonymous_object38);375 static inline void ___constructor__F_R4sVadiPiA0i_autogen___1(struct Vad *___dst__R4sVad_1, __attribute__ ((unused)) signed int __anonymous_object39, __attribute__ ((unused,unused)) signed int *__anonymous_object40, __attribute__ ((unused,unused))signed int __anonymous_object41[((unsigned long int )10)]);376 static inline void ___constructor__F_R4sVadiPiA0iPFi___autogen___1(struct Vad *___dst__R4sVad_1, __attribute__ ((unused)) signed int __anonymous_object42, __attribute__ ((unused,unused)) signed int *__anonymous_object43, __attribute__ ((unused,unused)) signed int __anonymous_object44[((unsigned long int )10)], __attribute__ ((unused,unused))signed int (*__anonymous_object45)());373 static inline void ___constructor__F_R4sVadi_autogen___1(struct Vad *___dst__R4sVad_1, signed int __anonymous_object36); 374 static inline void ___constructor__F_R4sVadiPi_autogen___1(struct Vad *___dst__R4sVad_1, signed int __anonymous_object37, signed int *__anonymous_object38); 375 static inline void ___constructor__F_R4sVadiPiA0i_autogen___1(struct Vad *___dst__R4sVad_1, signed int __anonymous_object39, signed int *__anonymous_object40, signed int __anonymous_object41[((unsigned long int )10)]); 376 static inline void ___constructor__F_R4sVadiPiA0iPFi___autogen___1(struct Vad *___dst__R4sVad_1, signed int __anonymous_object42, signed int *__anonymous_object43, signed int __anonymous_object44[((unsigned long int )10)], signed int (*__anonymous_object45)()); 377 377 static inline void ___constructor__F_R4sVad_autogen___1(struct Vad *___dst__R4sVad_1){ 378 378 ((void)((*___dst__R4sVad_1).__anonymous_object32) /* ?{} */); … … 430 430 return ___ret__4sVad_1; 431 431 } 432 static inline void ___constructor__F_R4sVadi_autogen___1(struct Vad *___dst__R4sVad_1, __attribute__ ((unused))signed int __anonymous_object46){432 static inline void ___constructor__F_R4sVadi_autogen___1(struct Vad *___dst__R4sVad_1, signed int __anonymous_object46){ 433 433 ((void)((*___dst__R4sVad_1).__anonymous_object32=__anonymous_object46) /* ?{} */); 434 434 ((void)((*___dst__R4sVad_1).__anonymous_object33) /* ?{} */); … … 443 443 ((void)((*___dst__R4sVad_1).__anonymous_object35) /* ?{} */); 444 444 } 445 static inline void ___constructor__F_R4sVadiPi_autogen___1(struct Vad *___dst__R4sVad_1, __attribute__ ((unused)) signed int __anonymous_object47, __attribute__ ((unused,unused))signed int *__anonymous_object48){445 static inline void ___constructor__F_R4sVadiPi_autogen___1(struct Vad *___dst__R4sVad_1, signed int __anonymous_object47, signed int *__anonymous_object48){ 446 446 ((void)((*___dst__R4sVad_1).__anonymous_object32=__anonymous_object47) /* ?{} */); 447 447 ((void)((*___dst__R4sVad_1).__anonymous_object33=__anonymous_object48) /* ?{} */); … … 456 456 ((void)((*___dst__R4sVad_1).__anonymous_object35) /* ?{} */); 457 457 } 458 static inline void ___constructor__F_R4sVadiPiA0i_autogen___1(struct Vad *___dst__R4sVad_1, __attribute__ ((unused)) signed int __anonymous_object49, __attribute__ ((unused,unused)) signed int *__anonymous_object50, __attribute__ ((unused,unused))signed int __anonymous_object51[((unsigned long int )10)]){458 static inline void ___constructor__F_R4sVadiPiA0i_autogen___1(struct Vad *___dst__R4sVad_1, signed int __anonymous_object49, signed int *__anonymous_object50, signed int __anonymous_object51[((unsigned long int )10)]){ 459 459 ((void)((*___dst__R4sVad_1).__anonymous_object32=__anonymous_object49) /* ?{} */); 460 460 ((void)((*___dst__R4sVad_1).__anonymous_object33=__anonymous_object50) /* ?{} */); … … 469 469 ((void)((*___dst__R4sVad_1).__anonymous_object35) /* ?{} */); 470 470 } 471 static inline void ___constructor__F_R4sVadiPiA0iPFi___autogen___1(struct Vad *___dst__R4sVad_1, __attribute__ ((unused)) signed int __anonymous_object52, __attribute__ ((unused,unused)) signed int *__anonymous_object53, __attribute__ ((unused,unused)) signed int __anonymous_object54[((unsigned long int )10)], __attribute__ ((unused,unused))signed int (*__anonymous_object55)()){471 static inline void ___constructor__F_R4sVadiPiA0iPFi___autogen___1(struct Vad *___dst__R4sVad_1, signed int __anonymous_object52, signed int *__anonymous_object53, signed int __anonymous_object54[((unsigned long int )10)], signed int (*__anonymous_object55)()){ 472 472 ((void)((*___dst__R4sVad_1).__anonymous_object32=__anonymous_object52) /* ?{} */); 473 473 ((void)((*___dst__R4sVad_1).__anonymous_object33=__anonymous_object53) /* ?{} */); -
src/tests/tuple/tupleVariadic.c
r7c782af r62cd621 95 95 } 96 96 97 forall(ttype T | { void foo(T); }) void bar(T x) {}98 void foo(int) {}99 100 97 int main() { 101 98 array * x0 = new(); … … 120 117 func(3, 2.0, 111, 4.145); 121 118 printf("finished func\n"); 122 123 {124 // T = [const int] -- this ensures that void(*)(int) satisfies void(*)(const int)125 const int x;126 bar(x);127 }128 119 } 129 120
Note:
See TracChangeset
for help on using the changeset viewer.