Changes in / [12bc63a:fc4a0fa]
- Location:
- src
- Files:
-
- 5 added
- 2 deleted
- 43 edited
-
CodeGen/CodeGenerator.cc (modified) (3 diffs)
-
CodeGen/CodeGenerator.h (modified) (1 diff)
-
ControlStruct/LabelTypeChecker.cc (added)
-
ControlStruct/LabelTypeChecker.h (added)
-
ControlStruct/Mutate.cc (modified) (2 diffs)
-
ControlStruct/module.mk (modified) (2 diffs)
-
GenPoly/Box.cc (modified) (18 diffs)
-
GenPoly/Lvalue.cc (modified) (6 diffs)
-
GenPoly/Specialize.cc (modified) (4 diffs)
-
InitTweak/FixInit.cc (modified) (6 diffs)
-
InitTweak/InitTweak.cc (modified) (3 diffs)
-
Makefile.in (modified) (12 diffs)
-
Parser/ExpressionNode.cc (modified) (1 diff)
-
Parser/ParseNode.h (modified) (1 diff)
-
Parser/parser.cc (modified) (239 diffs)
-
Parser/parser.yy (modified) (1 diff)
-
ResolvExpr/Alternative.cc (modified) (3 diffs)
-
ResolvExpr/AlternativeFinder.cc (modified) (28 diffs)
-
ResolvExpr/AlternativeFinder.h (modified) (2 diffs)
-
ResolvExpr/AlternativePrinter.cc (modified) (2 diffs)
-
ResolvExpr/ConversionCost.cc (modified) (1 diff)
-
ResolvExpr/ResolveTypeof.cc (modified) (2 diffs)
-
ResolvExpr/Resolver.cc (modified) (6 diffs)
-
ResolvExpr/Unify.cc (modified) (1 diff)
-
ResolvExpr/typeops.h (modified) (6 diffs)
-
SymTab/Autogen.cc (modified) (1 diff)
-
SymTab/Indexer.cc (modified) (11 diffs)
-
SymTab/Indexer.h (modified) (1 diff)
-
SynTree/AddressExpr.cc (modified) (2 diffs)
-
SynTree/ApplicationExpr.cc (modified) (2 diffs)
-
SynTree/CommaExpr.cc (modified) (1 diff)
-
SynTree/Expression.cc (modified) (19 diffs)
-
SynTree/Expression.h (modified) (8 diffs)
-
SynTree/Mutator.cc (modified) (20 diffs)
-
SynTree/Mutator.h (modified) (2 diffs)
-
SynTree/ReferenceToType.cc (modified) (1 diff)
-
SynTree/SynTree.h (modified) (2 diffs)
-
SynTree/TupleExpr.cc (modified) (3 diffs)
-
SynTree/TupleType.cc (modified) (2 diffs)
-
SynTree/Type.h (modified) (6 diffs)
-
SynTree/Visitor.cc (modified) (11 diffs)
-
SynTree/Visitor.h (modified) (2 diffs)
-
Tuples/NameMatcher.cc (added)
-
Tuples/NameMatcher.h (added)
-
Tuples/TupleAssignment.cc (modified) (3 diffs)
-
Tuples/TupleAssignment.h (added)
-
Tuples/TupleExpansion.cc (deleted)
-
Tuples/Tuples.h (deleted)
-
Tuples/module.mk (modified) (2 diffs)
-
main.cc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/CodeGenerator.cc
r12bc63a rfc4a0fa 309 309 UntypedExpr * newExpr = new UntypedExpr( new NameExpr( "*?" ) ); 310 310 newExpr->get_args().push_back( *arg ); 311 Type * type = InitTweak::getPointerBase( (*arg)->get_result() ); 311 assert( (*arg)->get_results().size() == 1 ); 312 Type * type = InitTweak::getPointerBase( (*arg)->get_results().front() ); 312 313 assert( type ); 313 newExpr-> set_result( type->clone() );314 newExpr->get_results().push_back( type->clone() ); 314 315 *arg = newExpr; 315 316 } // if … … 526 527 extension( castExpr ); 527 528 output << "("; 528 if ( castExpr->get_result ()->isVoid() ) {529 if ( castExpr->get_results().empty() ) { 529 530 output << "(void)" ; 530 } else if ( ! castExpr->get_result ()->get_isLvalue() ) {531 } else if ( ! castExpr->get_results().front()->get_isLvalue() ) { 531 532 // at least one result type of cast, but not an lvalue 532 533 output << "("; 533 output << genType( castExpr->get_result (), "" );534 output << genType( castExpr->get_results().front(), "" ); 534 535 output << ")"; 535 536 } else { … … 653 654 asmExpr->get_operand()->accept( *this ); 654 655 output << " )"; 655 }656 657 void CodeGenerator::visit( StmtExpr * stmtExpr ) {658 output << "(";659 stmtExpr->get_statements()->accept( *this );660 output << ")";661 656 } 662 657 -
src/CodeGen/CodeGenerator.h
r12bc63a rfc4a0fa 73 73 virtual void visit( TypeExpr *typeExpr ); 74 74 virtual void visit( AsmExpr * ); 75 virtual void visit( StmtExpr * );76 75 77 76 //*** Statements -
src/ControlStruct/Mutate.cc
r12bc63a rfc4a0fa 23 23 #include "MLEMutator.h" 24 24 #include "ForExprMutator.h" 25 #include "LabelTypeChecker.h" 25 26 //#include "ExceptMutator.h" 26 27 … … 40 41 41 42 //ExceptMutator exc; 43 // LabelTypeChecker lbl; 42 44 43 45 mutateAll( translationUnit, formut ); 44 46 acceptAll( translationUnit, lfix ); 45 47 //mutateAll( translationUnit, exc ); 48 //acceptAll( translationUnit, lbl ); 46 49 } 47 50 } // namespace CodeGen -
src/ControlStruct/module.mk
r12bc63a rfc4a0fa 6 6 ## file "LICENCE" distributed with Cforall. 7 7 ## 8 ## module.mk -- 8 ## module.mk -- 9 9 ## 10 10 ## Author : Richard C. Bilson … … 19 19 ControlStruct/MLEMutator.cc \ 20 20 ControlStruct/Mutate.cc \ 21 ControlStruct/ForExprMutator.cc 21 ControlStruct/ForExprMutator.cc \ 22 ControlStruct/LabelTypeChecker.cc 22 23 -
src/GenPoly/Box.cc
r12bc63a rfc4a0fa 782 782 783 783 // add size/align for generic types to parameter list 784 if ( ! appExpr->get_function()->has_result() ) return;785 FunctionType *funcType = getFunctionType( appExpr->get_function()->get_result () );784 if ( appExpr->get_function()->get_results().empty() ) return; 785 FunctionType *funcType = getFunctionType( appExpr->get_function()->get_results().front() ); 786 786 assert( funcType ); 787 787 … … 799 799 for ( ; fnParm != funcType->get_parameters().end() && fnArg != appExpr->get_args().end(); ++fnParm, ++fnArg ) { 800 800 VariableExpr *fnArgBase = getBaseVar( *fnArg ); 801 if ( ! fnArgBase ) continue; // xxx - previously had check for non-empty fnArgBase results802 passArgTypeVars( appExpr, (*fnParm)->get_type(), fnArgBase->get_result (), arg, exprTyVars, seenTypes );801 if ( ! fnArgBase || fnArgBase->get_results().empty() ) continue; 802 passArgTypeVars( appExpr, (*fnParm)->get_type(), fnArgBase->get_results().front(), arg, exprTyVars, seenTypes ); 803 803 } 804 804 } … … 890 890 Type * adapteeType = new PointerType( Type::Qualifiers(), new FunctionType( Type::Qualifiers(), true ) ); 891 891 appExpr->get_args().push_front( new CastExpr( appExpr->get_function(), adapteeType ) ); 892 appExpr->set_function( new NameExpr( adapterName ) ); // xxx - result is never set on NameExpr892 appExpr->set_function( new NameExpr( adapterName ) ); 893 893 894 894 return ret; … … 896 896 897 897 void Pass1::boxParam( Type *param, Expression *&arg, const TyVarMap &exprTyVars ) { 898 assert( arg->has_result() );898 assert( ! arg->get_results().empty() ); 899 899 if ( isPolyType( param, exprTyVars ) ) { 900 if ( isPolyType( arg->get_result () ) ) {900 if ( isPolyType( arg->get_results().front() ) ) { 901 901 // if the argument's type is polymorphic, we don't need to box again! 902 902 return; 903 } else if ( arg->get_result ()->get_isLvalue() ) {903 } else if ( arg->get_results().front()->get_isLvalue() ) { 904 904 // VariableExpr and MemberExpr are lvalues; need to check this isn't coming from the second arg of a comma expression though (not an lvalue) 905 905 // xxx - need to test that this code is still reachable … … 987 987 UntypedExpr *deref = new UntypedExpr( new NameExpr( "*?" ) ); 988 988 deref->get_args().push_back( new CastExpr( new VariableExpr( param ), new PointerType( Type::Qualifiers(), arg->get_type()->clone() ) ) ); 989 deref-> set_result( arg->get_type()->clone() );989 deref->get_results().push_back( arg->get_type()->clone() ); 990 990 return deref; 991 991 } // if … … 1124 1124 } // if 1125 1125 addAssign->get_args().push_back( new NameExpr( sizeofName( mangleType( polyType ) ) ) ); 1126 addAssign-> set_result( appExpr->get_result()->clone());1126 addAssign->get_results().front() = appExpr->get_results().front()->clone(); 1127 1127 if ( appExpr->get_env() ) { 1128 1128 addAssign->set_env( appExpr->get_env() ); … … 1138 1138 if ( varExpr->get_var()->get_linkage() == LinkageSpec::Intrinsic ) { 1139 1139 if ( varExpr->get_var()->get_name() == "?[?]" ) { 1140 assert( appExpr->has_result() );1140 assert( ! appExpr->get_results().empty() ); 1141 1141 assert( appExpr->get_args().size() == 2 ); 1142 Type *baseType1 = isPolyPtr( appExpr->get_args().front()->get_result (), scopeTyVars, env );1143 Type *baseType2 = isPolyPtr( appExpr->get_args().back()->get_result (), scopeTyVars, env );1142 Type *baseType1 = isPolyPtr( appExpr->get_args().front()->get_results().front(), scopeTyVars, env ); 1143 Type *baseType2 = isPolyPtr( appExpr->get_args().back()->get_results().front(), scopeTyVars, env ); 1144 1144 assert( ! baseType1 || ! baseType2 ); // the arguments cannot both be polymorphic pointers 1145 1145 UntypedExpr *ret = 0; … … 1161 1161 } // if 1162 1162 if ( baseType1 || baseType2 ) { 1163 ret-> set_result( appExpr->get_result()->clone() );1163 ret->get_results().push_front( appExpr->get_results().front()->clone() ); 1164 1164 if ( appExpr->get_env() ) { 1165 1165 ret->set_env( appExpr->get_env() ); … … 1171 1171 } // if 1172 1172 } else if ( varExpr->get_var()->get_name() == "*?" ) { 1173 assert( appExpr->has_result() );1173 assert( ! appExpr->get_results().empty() ); 1174 1174 assert( ! appExpr->get_args().empty() ); 1175 if ( isPolyType( appExpr->get_result (), scopeTyVars, env ) ) {1175 if ( isPolyType( appExpr->get_results().front(), scopeTyVars, env ) ) { 1176 1176 Expression *ret = appExpr->get_args().front(); 1177 delete ret->get_result ();1178 ret-> set_result( appExpr->get_result()->clone());1177 delete ret->get_results().front(); 1178 ret->get_results().front() = appExpr->get_results().front()->clone(); 1179 1179 if ( appExpr->get_env() ) { 1180 1180 ret->set_env( appExpr->get_env() ); … … 1186 1186 } // if 1187 1187 } else if ( varExpr->get_var()->get_name() == "?++" || varExpr->get_var()->get_name() == "?--" ) { 1188 assert( appExpr->has_result() );1188 assert( ! appExpr->get_results().empty() ); 1189 1189 assert( appExpr->get_args().size() == 1 ); 1190 if ( Type *baseType = isPolyPtr( appExpr->get_result (), scopeTyVars, env ) ) {1191 Type *tempType = appExpr->get_result ()->clone();1190 if ( Type *baseType = isPolyPtr( appExpr->get_results().front(), scopeTyVars, env ) ) { 1191 Type *tempType = appExpr->get_results().front()->clone(); 1192 1192 if ( env ) { 1193 1193 env->apply( tempType ); … … 1206 1206 } // if 1207 1207 } else if ( varExpr->get_var()->get_name() == "++?" || varExpr->get_var()->get_name() == "--?" ) { 1208 assert( appExpr->has_result() );1208 assert( ! appExpr->get_results().empty() ); 1209 1209 assert( appExpr->get_args().size() == 1 ); 1210 if ( Type *baseType = isPolyPtr( appExpr->get_result (), scopeTyVars, env ) ) {1210 if ( Type *baseType = isPolyPtr( appExpr->get_results().front(), scopeTyVars, env ) ) { 1211 1211 return makeIncrDecrExpr( appExpr, baseType, varExpr->get_var()->get_name() == "++?" ); 1212 1212 } // if 1213 1213 } else if ( varExpr->get_var()->get_name() == "?+?" || varExpr->get_var()->get_name() == "?-?" ) { 1214 assert( appExpr->has_result() );1214 assert( ! appExpr->get_results().empty() ); 1215 1215 assert( appExpr->get_args().size() == 2 ); 1216 Type *baseType1 = isPolyPtr( appExpr->get_args().front()->get_result (), scopeTyVars, env );1217 Type *baseType2 = isPolyPtr( appExpr->get_args().back()->get_result (), scopeTyVars, env );1216 Type *baseType1 = isPolyPtr( appExpr->get_args().front()->get_results().front(), scopeTyVars, env ); 1217 Type *baseType2 = isPolyPtr( appExpr->get_args().back()->get_results().front(), scopeTyVars, env ); 1218 1218 if ( baseType1 && baseType2 ) { 1219 1219 UntypedExpr *divide = new UntypedExpr( new NameExpr( "?/?" ) ); 1220 1220 divide->get_args().push_back( appExpr ); 1221 1221 divide->get_args().push_back( new SizeofExpr( baseType1->clone() ) ); 1222 divide-> set_result( appExpr->get_result()->clone() );1222 divide->get_results().push_front( appExpr->get_results().front()->clone() ); 1223 1223 if ( appExpr->get_env() ) { 1224 1224 divide->set_env( appExpr->get_env() ); … … 1238 1238 } // if 1239 1239 } else if ( varExpr->get_var()->get_name() == "?+=?" || varExpr->get_var()->get_name() == "?-=?" ) { 1240 assert( appExpr->has_result() );1240 assert( ! appExpr->get_results().empty() ); 1241 1241 assert( appExpr->get_args().size() == 2 ); 1242 Type *baseType = isPolyPtr( appExpr->get_result (), scopeTyVars, env );1242 Type *baseType = isPolyPtr( appExpr->get_results().front(), scopeTyVars, env ); 1243 1243 if ( baseType ) { 1244 1244 UntypedExpr *multiply = new UntypedExpr( new NameExpr( "?*?" ) ); … … 1266 1266 useRetval = oldUseRetval; 1267 1267 1268 assert( appExpr->get_function()->has_result() ); 1269 PointerType *pointer = safe_dynamic_cast< PointerType *>( appExpr->get_function()->get_result() ); 1270 FunctionType *function = safe_dynamic_cast< FunctionType *>( pointer->get_base() ); 1268 assert( ! appExpr->get_function()->get_results().empty() ); 1269 PointerType *pointer = dynamic_cast< PointerType *>( appExpr->get_function()->get_results().front() ); 1270 assert( pointer ); 1271 FunctionType *function = dynamic_cast< FunctionType *>( pointer->get_base() ); 1272 assert( function ); 1271 1273 1272 1274 if ( Expression *newExpr = handleIntrinsics( appExpr ) ) { … … 1306 1308 1307 1309 Expression *Pass1::mutate( UntypedExpr *expr ) { 1308 if ( expr->has_result() && isPolyType( expr->get_result(), scopeTyVars, env ) ) {1310 if ( ! expr->get_results().empty() && isPolyType( expr->get_results().front(), scopeTyVars, env ) ) { 1309 1311 if ( NameExpr *name = dynamic_cast< NameExpr *>( expr->get_function() ) ) { 1310 1312 if ( name->get_name() == "*?" ) { … … 1320 1322 1321 1323 Expression *Pass1::mutate( AddressExpr *addrExpr ) { 1322 assert( addrExpr->get_arg()->has_result() && ! addrExpr->get_arg()->get_result()->isVoid() );1324 assert( ! addrExpr->get_arg()->get_results().empty() ); 1323 1325 1324 1326 bool needs = false; 1325 1327 if ( UntypedExpr *expr = dynamic_cast< UntypedExpr *>( addrExpr->get_arg() ) ) { 1326 if ( expr->has_result() && isPolyType( expr->get_result(), scopeTyVars, env ) ) {1328 if ( ! expr->get_results().empty() && isPolyType( expr->get_results().front(), scopeTyVars, env ) ) { 1327 1329 if ( NameExpr *name = dynamic_cast< NameExpr *>( expr->get_function() ) ) { 1328 1330 if ( name->get_name() == "*?" ) { 1329 1331 if ( ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * >( expr->get_args().front() ) ) { 1330 assert( appExpr->get_function()->has_result() ); 1331 PointerType *pointer = safe_dynamic_cast< PointerType *>( appExpr->get_function()->get_result() ); 1332 FunctionType *function = safe_dynamic_cast< FunctionType *>( pointer->get_base() ); 1332 assert( ! appExpr->get_function()->get_results().empty() ); 1333 PointerType *pointer = dynamic_cast< PointerType *>( appExpr->get_function()->get_results().front() ); 1334 assert( pointer ); 1335 FunctionType *function = dynamic_cast< FunctionType *>( pointer->get_base() ); 1336 assert( function ); 1333 1337 needs = needsAdapter( function, scopeTyVars ); 1334 1338 } // if … … 1339 1343 // isPolyType check needs to happen before mutating addrExpr arg, so pull it forward 1340 1344 // out of the if condition. 1341 bool polytype = isPolyType( addrExpr->get_arg()->get_result (), scopeTyVars, env );1345 bool polytype = isPolyType( addrExpr->get_arg()->get_results().front(), scopeTyVars, env ); 1342 1346 addrExpr->set_arg( mutateExpression( addrExpr->get_arg() ) ); 1343 1347 if ( polytype || needs ) { 1344 1348 Expression *ret = addrExpr->get_arg(); 1345 delete ret->get_result ();1346 ret-> set_result( addrExpr->get_result()->clone());1349 delete ret->get_results().front(); 1350 ret->get_results().front() = addrExpr->get_results().front()->clone(); 1347 1351 addrExpr->set_arg( 0 ); 1348 1352 delete addrExpr; … … 1382 1386 Statement * Pass1::mutate( ReturnStmt *returnStmt ) { 1383 1387 if ( retval && returnStmt->get_expr() ) { 1384 assert( returnStmt->get_expr()->has_result() && ! returnStmt->get_expr()->get_result()->isVoid() );1388 assert( ! returnStmt->get_expr()->get_results().empty() ); 1385 1389 // ***** Code Removal ***** After introducing a temporary variable for all return expressions, the following code appears superfluous. 1386 1390 // if ( returnStmt->get_expr()->get_results().front()->get_isLvalue() ) { … … 1462 1466 // replace return statement with appropriate assignment to out parameter 1463 1467 Expression *retParm = new NameExpr( retval->get_name() ); 1464 retParm-> set_result( new PointerType( Type::Qualifiers(), retval->get_type()->clone() ) );1468 retParm->get_results().push_back( new PointerType( Type::Qualifiers(), retval->get_type()->clone() ) ); 1465 1469 assignExpr->get_args().push_back( retParm ); 1466 1470 assignExpr->get_args().push_back( returnStmt->get_expr() ); -
src/GenPoly/Lvalue.cc
r12bc63a rfc4a0fa 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // Lvalue.cc -- 7 // Lvalue.cc -- 8 8 // 9 9 // Author : Richard C. Bilson … … 41 41 public: 42 42 Pass1(); 43 43 44 44 virtual Expression *mutate( ApplicationExpr *appExpr ); 45 45 virtual Statement *mutate( ReturnStmt *appExpr ); … … 99 99 appExpr->get_function()->acceptMutator( *this ); 100 100 mutateAll( appExpr->get_args(), *this ); 101 102 assert( ! appExpr->get_function()->get_results().empty() ); 101 103 102 PointerType *pointer = safe_dynamic_cast< PointerType* >( appExpr->get_function()->get_result() ); 103 FunctionType *function = safe_dynamic_cast< FunctionType* >( pointer->get_base() ); 104 PointerType *pointer = dynamic_cast< PointerType* >( appExpr->get_function()->get_results().front() ); 105 assert( pointer ); 106 FunctionType *function = dynamic_cast< FunctionType* >( pointer->get_base() ); 107 assert( function ); 104 108 105 109 Type *funType = isLvalueRet( function ); 106 110 if ( funType && ! isIntrinsicApp( appExpr ) ) { 107 111 Expression *expr = appExpr; 108 Type *appType = appExpr->get_result ();112 Type *appType = appExpr->get_results().front(); 109 113 if ( isPolyType( funType ) && ! isPolyType( appType ) ) { 110 114 // make sure cast for polymorphic type is inside dereference … … 112 116 } 113 117 UntypedExpr *deref = new UntypedExpr( new NameExpr( "*?" ) ); 114 deref-> set_result( appType->clone() );115 appExpr-> set_result( new PointerType( Type::Qualifiers(), appType ));118 deref->get_results().push_back( appType->clone() ); 119 appExpr->get_results().front() = new PointerType( Type::Qualifiers(), appType ); 116 120 deref->get_args().push_back( expr ); 117 121 return deref; … … 123 127 Statement * Pass1::mutate(ReturnStmt *retStmt) { 124 128 if ( retval && retStmt->get_expr() ) { 125 if ( retStmt->get_expr()->get_result()->get_isLvalue() ) { 129 assert( ! retStmt->get_expr()->get_results().empty() ); 130 if ( retStmt->get_expr()->get_results().front()->get_isLvalue() ) { 126 131 // ***** Code Removal ***** because casts may be stripped already 127 132 … … 150 155 retParm->set_type( new PointerType( Type::Qualifiers(), retParm->get_type() ) ); 151 156 } // if 152 157 153 158 Visitor::visit( funType ); 154 159 } -
src/GenPoly/Specialize.cc
r12bc63a rfc4a0fa 147 147 148 148 Expression * Specialize::doSpecialization( Type *formalType, Expression *actual, InferredParams *inferParams ) { 149 assert( actual->has_result() );150 if ( needsSpecialization( formalType, actual->get_result (), env ) ) {149 assert( ! actual->get_results().empty() ); // using front, should have this assert 150 if ( needsSpecialization( formalType, actual->get_results().front(), env ) ) { 151 151 FunctionType *funType; 152 152 if ( ( funType = getFunctionType( formalType ) ) ) { … … 171 171 void Specialize::handleExplicitParams( ApplicationExpr *appExpr ) { 172 172 // create thunks for the explicit parameters 173 assert( appExpr->get_function()->has_result() );174 FunctionType *function = getFunctionType( appExpr->get_function()->get_result () );173 assert( ! appExpr->get_function()->get_results().empty() ); 174 FunctionType *function = getFunctionType( appExpr->get_function()->get_results().front() ); 175 175 assert( function ); 176 176 std::list< DeclarationWithType* >::iterator formal; … … 200 200 Expression * Specialize::mutate( AddressExpr *addrExpr ) { 201 201 addrExpr->get_arg()->acceptMutator( *this ); 202 assert( addrExpr->has_result() );203 addrExpr->set_arg( doSpecialization( addrExpr->get_result (), addrExpr->get_arg() ) );202 assert( ! addrExpr->get_results().empty() ); 203 addrExpr->set_arg( doSpecialization( addrExpr->get_results().front(), addrExpr->get_arg() ) ); 204 204 return addrExpr; 205 205 } … … 207 207 Expression * Specialize::mutate( CastExpr *castExpr ) { 208 208 castExpr->get_arg()->acceptMutator( *this ); 209 if ( castExpr->get_result ()->isVoid() ) {209 if ( castExpr->get_results().empty() ) { 210 210 // can't specialize if we don't have a return value 211 211 return castExpr; 212 212 } 213 Expression *specialized = doSpecialization( castExpr->get_result (), castExpr->get_arg() );213 Expression *specialized = doSpecialization( castExpr->get_results().front(), castExpr->get_arg() ); 214 214 if ( specialized != castExpr->get_arg() ) { 215 215 // assume here that the specialization incorporates the cast -
src/InitTweak/FixInit.cc
r12bc63a rfc4a0fa 391 391 CP_CTOR_PRINT( std::cerr << "Type Substitution: " << *impCpCtorExpr->get_env() << std::endl; ) 392 392 // xxx - need to handle tuple arguments 393 assert( arg->has_result() );394 Type * result = arg->get_result ();393 assert( ! arg->get_results().empty() ); 394 Type * result = arg->get_results().front(); 395 395 if ( skipCopyConstruct( result ) ) continue; // skip certain non-copyable types 396 396 // type may involve type variables, so apply type substitution to get temporary variable's actual type … … 423 423 // level. Trying to pass that environment along. 424 424 callExpr->set_env( impCpCtorExpr->get_env()->clone() ); 425 Type * result = appExpr->get_result(); 426 if ( ! result->isVoid() ) { 427 // need to flatten result type and construct each 425 for ( Type * result : appExpr->get_results() ) { 428 426 result = result->clone(); 429 427 impCpCtorExpr->get_env()->apply( result ); … … 481 479 // know the result type of the assignment is the type of the LHS (minus the pointer), so 482 480 // add that onto the assignment expression so that later steps have the necessary information 483 assign-> set_result( returnDecl->get_type()->clone() );481 assign->add_result( returnDecl->get_type()->clone() ); 484 482 485 483 Expression * retExpr = new CommaExpr( assign, new VariableExpr( returnDecl ) ); 486 if ( callExpr->get_result ()->get_isLvalue() ) {484 if ( callExpr->get_results().front()->get_isLvalue() ) { 487 485 // lvalue returning functions are funny. Lvalue.cc inserts a *? in front of any lvalue returning 488 486 // non-intrinsic function. Add an AddressExpr to the call to negate the derefence and change the … … 502 500 UntypedExpr * deref = new UntypedExpr( new NameExpr( "*?" ) ); 503 501 deref->get_args().push_back( retExpr ); 504 deref-> set_result( resultType );502 deref->add_result( resultType ); 505 503 retExpr = deref; 506 504 } // if … … 941 939 Expression * FixCtorExprs::mutate( ConstructorExpr * ctorExpr ) { 942 940 static UniqueName tempNamer( "_tmp_ctor_expr" ); 943 assert( ctorExpr-> has_result() && ctorExpr->get_result()->size() == 1 );944 ObjectDecl * tmp = new ObjectDecl( tempNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, nullptr, ctorExpr->get_result ()->clone(), nullptr );941 assert( ctorExpr->get_results().size() == 1 ); 942 ObjectDecl * tmp = new ObjectDecl( tempNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, nullptr, ctorExpr->get_results().front()->clone(), nullptr ); 945 943 addDeclaration( tmp ); 946 944 … … 954 952 assign->get_args().push_back( new VariableExpr( tmp ) ); 955 953 assign->get_args().push_back( firstArg ); 956 assign->set_result( ctorExpr->get_result()->clone() );954 cloneAll( ctorExpr->get_results(), assign->get_results() ); 957 955 firstArg = assign; 958 956 -
src/InitTweak/InitTweak.cc
r12bc63a rfc4a0fa 340 340 return allofCtorDtor( stmt, []( Expression * callExpr ){ 341 341 if ( ApplicationExpr * appExpr = isIntrinsicCallExpr( callExpr ) ) { 342 FunctionType *funcType = GenPoly::getFunctionType( appExpr->get_function()->get_result() ); 342 assert( ! appExpr->get_function()->get_results().empty() ); 343 FunctionType *funcType = GenPoly::getFunctionType( appExpr->get_function()->get_results().front() ); 343 344 assert( funcType ); 344 345 return funcType->get_parameters().size() == 1; … … 387 388 return memberExpr->get_member()->get_name(); 388 389 } else if ( UntypedMemberExpr * memberExpr = dynamic_cast< UntypedMemberExpr * > ( func ) ) { 389 return funcName( memberExpr->get_member());390 return memberExpr->get_member(); 390 391 } else { 391 392 assertf( false, "Unexpected expression type being called as a function in call expression" ); … … 450 451 // virtual void visit( LogicalExpr *logicalExpr ); 451 452 // virtual void visit( ConditionalExpr *conditionalExpr ); 453 virtual void visit( TupleExpr *tupleExpr ) { isConstExpr = false; } 454 virtual void visit( SolvedTupleExpr *tupleExpr ) { isConstExpr = false; } 452 455 virtual void visit( TypeExpr *typeExpr ) { isConstExpr = false; } 453 456 virtual void visit( AsmExpr *asmExpr ) { isConstExpr = false; } 454 457 virtual void visit( UntypedValofExpr *valofExpr ) { isConstExpr = false; } 455 458 virtual void visit( CompoundLiteralExpr *compLitExpr ) { isConstExpr = false; } 456 virtual void visit( TupleExpr *tupleExpr ) { isConstExpr = false; }457 virtual void visit( TupleAssignExpr *tupleExpr ) { isConstExpr = false; }458 459 459 460 bool isConstExpr; -
src/Makefile.in
r12bc63a rfc4a0fa 104 104 ControlStruct/driver_cfa_cpp-Mutate.$(OBJEXT) \ 105 105 ControlStruct/driver_cfa_cpp-ForExprMutator.$(OBJEXT) \ 106 ControlStruct/driver_cfa_cpp-LabelTypeChecker.$(OBJEXT) \ 106 107 GenPoly/driver_cfa_cpp-Box.$(OBJEXT) \ 107 108 GenPoly/driver_cfa_cpp-GenPoly.$(OBJEXT) \ … … 188 189 SynTree/driver_cfa_cpp-Attribute.$(OBJEXT) \ 189 190 Tuples/driver_cfa_cpp-TupleAssignment.$(OBJEXT) \ 190 Tuples/driver_cfa_cpp- TupleExpansion.$(OBJEXT)191 Tuples/driver_cfa_cpp-NameMatcher.$(OBJEXT) 191 192 am_driver_cfa_cpp_OBJECTS = $(am__objects_1) 192 193 driver_cfa_cpp_OBJECTS = $(am_driver_cfa_cpp_OBJECTS) … … 360 361 ControlStruct/LabelGenerator.cc ControlStruct/LabelFixer.cc \ 361 362 ControlStruct/MLEMutator.cc ControlStruct/Mutate.cc \ 362 ControlStruct/ForExprMutator.cc GenPoly/Box.cc \ 363 ControlStruct/ForExprMutator.cc \ 364 ControlStruct/LabelTypeChecker.cc GenPoly/Box.cc \ 363 365 GenPoly/GenPoly.cc GenPoly/PolyMutator.cc \ 364 366 GenPoly/ScrubTyVars.cc GenPoly/Lvalue.cc GenPoly/Specialize.cc \ … … 400 402 SynTree/AddStmtVisitor.cc SynTree/TypeSubstitution.cc \ 401 403 SynTree/Attribute.cc Tuples/TupleAssignment.cc \ 402 Tuples/ TupleExpansion.cc404 Tuples/NameMatcher.cc 403 405 MAINTAINERCLEANFILES = Parser/parser.output ${libdir}/${notdir \ 404 406 ${cfa_cpplib_PROGRAMS}} … … 533 535 ControlStruct/$(DEPDIR)/$(am__dirstamp) 534 536 ControlStruct/driver_cfa_cpp-ForExprMutator.$(OBJEXT): \ 537 ControlStruct/$(am__dirstamp) \ 538 ControlStruct/$(DEPDIR)/$(am__dirstamp) 539 ControlStruct/driver_cfa_cpp-LabelTypeChecker.$(OBJEXT): \ 535 540 ControlStruct/$(am__dirstamp) \ 536 541 ControlStruct/$(DEPDIR)/$(am__dirstamp) … … 764 769 Tuples/driver_cfa_cpp-TupleAssignment.$(OBJEXT): \ 765 770 Tuples/$(am__dirstamp) Tuples/$(DEPDIR)/$(am__dirstamp) 766 Tuples/driver_cfa_cpp- TupleExpansion.$(OBJEXT):\767 Tuples/$( am__dirstamp) Tuples/$(DEPDIR)/$(am__dirstamp)771 Tuples/driver_cfa_cpp-NameMatcher.$(OBJEXT): Tuples/$(am__dirstamp) \ 772 Tuples/$(DEPDIR)/$(am__dirstamp) 768 773 driver/$(am__dirstamp): 769 774 @$(MKDIR_P) driver … … 786 791 -rm -f ControlStruct/driver_cfa_cpp-LabelFixer.$(OBJEXT) 787 792 -rm -f ControlStruct/driver_cfa_cpp-LabelGenerator.$(OBJEXT) 793 -rm -f ControlStruct/driver_cfa_cpp-LabelTypeChecker.$(OBJEXT) 788 794 -rm -f ControlStruct/driver_cfa_cpp-MLEMutator.$(OBJEXT) 789 795 -rm -f ControlStruct/driver_cfa_cpp-Mutate.$(OBJEXT) … … 871 877 -rm -f SynTree/driver_cfa_cpp-Visitor.$(OBJEXT) 872 878 -rm -f SynTree/driver_cfa_cpp-VoidType.$(OBJEXT) 879 -rm -f Tuples/driver_cfa_cpp-NameMatcher.$(OBJEXT) 873 880 -rm -f Tuples/driver_cfa_cpp-TupleAssignment.$(OBJEXT) 874 -rm -f Tuples/driver_cfa_cpp-TupleExpansion.$(OBJEXT)875 881 876 882 distclean-compile: … … 890 896 @AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelFixer.Po@am__quote@ 891 897 @AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelGenerator.Po@am__quote@ 898 @AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelTypeChecker.Po@am__quote@ 892 899 @AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-MLEMutator.Po@am__quote@ 893 900 @AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-Mutate.Po@am__quote@ … … 975 982 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-Visitor.Po@am__quote@ 976 983 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-VoidType.Po@am__quote@ 984 @AMDEP_TRUE@@am__include@ @am__quote@Tuples/$(DEPDIR)/driver_cfa_cpp-NameMatcher.Po@am__quote@ 977 985 @AMDEP_TRUE@@am__include@ @am__quote@Tuples/$(DEPDIR)/driver_cfa_cpp-TupleAssignment.Po@am__quote@ 978 @AMDEP_TRUE@@am__include@ @am__quote@Tuples/$(DEPDIR)/driver_cfa_cpp-TupleExpansion.Po@am__quote@979 986 980 987 .cc.o: … … 1204 1211 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ControlStruct/driver_cfa_cpp-ForExprMutator.obj `if test -f 'ControlStruct/ForExprMutator.cc'; then $(CYGPATH_W) 'ControlStruct/ForExprMutator.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/ForExprMutator.cc'; fi` 1205 1212 1213 ControlStruct/driver_cfa_cpp-LabelTypeChecker.o: ControlStruct/LabelTypeChecker.cc 1214 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ControlStruct/driver_cfa_cpp-LabelTypeChecker.o -MD -MP -MF ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelTypeChecker.Tpo -c -o ControlStruct/driver_cfa_cpp-LabelTypeChecker.o `test -f 'ControlStruct/LabelTypeChecker.cc' || echo '$(srcdir)/'`ControlStruct/LabelTypeChecker.cc 1215 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelTypeChecker.Tpo ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelTypeChecker.Po 1216 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='ControlStruct/LabelTypeChecker.cc' object='ControlStruct/driver_cfa_cpp-LabelTypeChecker.o' libtool=no @AMDEPBACKSLASH@ 1217 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1218 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ControlStruct/driver_cfa_cpp-LabelTypeChecker.o `test -f 'ControlStruct/LabelTypeChecker.cc' || echo '$(srcdir)/'`ControlStruct/LabelTypeChecker.cc 1219 1220 ControlStruct/driver_cfa_cpp-LabelTypeChecker.obj: ControlStruct/LabelTypeChecker.cc 1221 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ControlStruct/driver_cfa_cpp-LabelTypeChecker.obj -MD -MP -MF ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelTypeChecker.Tpo -c -o ControlStruct/driver_cfa_cpp-LabelTypeChecker.obj `if test -f 'ControlStruct/LabelTypeChecker.cc'; then $(CYGPATH_W) 'ControlStruct/LabelTypeChecker.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/LabelTypeChecker.cc'; fi` 1222 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelTypeChecker.Tpo ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelTypeChecker.Po 1223 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='ControlStruct/LabelTypeChecker.cc' object='ControlStruct/driver_cfa_cpp-LabelTypeChecker.obj' libtool=no @AMDEPBACKSLASH@ 1224 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1225 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ControlStruct/driver_cfa_cpp-LabelTypeChecker.obj `if test -f 'ControlStruct/LabelTypeChecker.cc'; then $(CYGPATH_W) 'ControlStruct/LabelTypeChecker.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/LabelTypeChecker.cc'; fi` 1226 1206 1227 GenPoly/driver_cfa_cpp-Box.o: GenPoly/Box.cc 1207 1228 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT GenPoly/driver_cfa_cpp-Box.o -MD -MP -MF GenPoly/$(DEPDIR)/driver_cfa_cpp-Box.Tpo -c -o GenPoly/driver_cfa_cpp-Box.o `test -f 'GenPoly/Box.cc' || echo '$(srcdir)/'`GenPoly/Box.cc … … 2380 2401 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Tuples/driver_cfa_cpp-TupleAssignment.obj `if test -f 'Tuples/TupleAssignment.cc'; then $(CYGPATH_W) 'Tuples/TupleAssignment.cc'; else $(CYGPATH_W) '$(srcdir)/Tuples/TupleAssignment.cc'; fi` 2381 2402 2382 Tuples/driver_cfa_cpp- TupleExpansion.o: Tuples/TupleExpansion.cc2383 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Tuples/driver_cfa_cpp- TupleExpansion.o -MD -MP -MF Tuples/$(DEPDIR)/driver_cfa_cpp-TupleExpansion.Tpo -c -o Tuples/driver_cfa_cpp-TupleExpansion.o `test -f 'Tuples/TupleExpansion.cc' || echo '$(srcdir)/'`Tuples/TupleExpansion.cc2384 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) Tuples/$(DEPDIR)/driver_cfa_cpp- TupleExpansion.Tpo Tuples/$(DEPDIR)/driver_cfa_cpp-TupleExpansion.Po2385 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Tuples/ TupleExpansion.cc' object='Tuples/driver_cfa_cpp-TupleExpansion.o' libtool=no @AMDEPBACKSLASH@2386 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 2387 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Tuples/driver_cfa_cpp- TupleExpansion.o `test -f 'Tuples/TupleExpansion.cc' || echo '$(srcdir)/'`Tuples/TupleExpansion.cc2388 2389 Tuples/driver_cfa_cpp- TupleExpansion.obj: Tuples/TupleExpansion.cc2390 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Tuples/driver_cfa_cpp- TupleExpansion.obj -MD -MP -MF Tuples/$(DEPDIR)/driver_cfa_cpp-TupleExpansion.Tpo -c -o Tuples/driver_cfa_cpp-TupleExpansion.obj `if test -f 'Tuples/TupleExpansion.cc'; then $(CYGPATH_W) 'Tuples/TupleExpansion.cc'; else $(CYGPATH_W) '$(srcdir)/Tuples/TupleExpansion.cc'; fi`2391 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) Tuples/$(DEPDIR)/driver_cfa_cpp- TupleExpansion.Tpo Tuples/$(DEPDIR)/driver_cfa_cpp-TupleExpansion.Po2392 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Tuples/ TupleExpansion.cc' object='Tuples/driver_cfa_cpp-TupleExpansion.obj' libtool=no @AMDEPBACKSLASH@2393 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 2394 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Tuples/driver_cfa_cpp- TupleExpansion.obj `if test -f 'Tuples/TupleExpansion.cc'; then $(CYGPATH_W) 'Tuples/TupleExpansion.cc'; else $(CYGPATH_W) '$(srcdir)/Tuples/TupleExpansion.cc'; fi`2403 Tuples/driver_cfa_cpp-NameMatcher.o: Tuples/NameMatcher.cc 2404 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Tuples/driver_cfa_cpp-NameMatcher.o -MD -MP -MF Tuples/$(DEPDIR)/driver_cfa_cpp-NameMatcher.Tpo -c -o Tuples/driver_cfa_cpp-NameMatcher.o `test -f 'Tuples/NameMatcher.cc' || echo '$(srcdir)/'`Tuples/NameMatcher.cc 2405 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) Tuples/$(DEPDIR)/driver_cfa_cpp-NameMatcher.Tpo Tuples/$(DEPDIR)/driver_cfa_cpp-NameMatcher.Po 2406 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Tuples/NameMatcher.cc' object='Tuples/driver_cfa_cpp-NameMatcher.o' libtool=no @AMDEPBACKSLASH@ 2407 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 2408 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Tuples/driver_cfa_cpp-NameMatcher.o `test -f 'Tuples/NameMatcher.cc' || echo '$(srcdir)/'`Tuples/NameMatcher.cc 2409 2410 Tuples/driver_cfa_cpp-NameMatcher.obj: Tuples/NameMatcher.cc 2411 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Tuples/driver_cfa_cpp-NameMatcher.obj -MD -MP -MF Tuples/$(DEPDIR)/driver_cfa_cpp-NameMatcher.Tpo -c -o Tuples/driver_cfa_cpp-NameMatcher.obj `if test -f 'Tuples/NameMatcher.cc'; then $(CYGPATH_W) 'Tuples/NameMatcher.cc'; else $(CYGPATH_W) '$(srcdir)/Tuples/NameMatcher.cc'; fi` 2412 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) Tuples/$(DEPDIR)/driver_cfa_cpp-NameMatcher.Tpo Tuples/$(DEPDIR)/driver_cfa_cpp-NameMatcher.Po 2413 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Tuples/NameMatcher.cc' object='Tuples/driver_cfa_cpp-NameMatcher.obj' libtool=no @AMDEPBACKSLASH@ 2414 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 2415 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Tuples/driver_cfa_cpp-NameMatcher.obj `if test -f 'Tuples/NameMatcher.cc'; then $(CYGPATH_W) 'Tuples/NameMatcher.cc'; else $(CYGPATH_W) '$(srcdir)/Tuples/NameMatcher.cc'; fi` 2395 2416 2396 2417 .ll.cc: -
src/Parser/ExpressionNode.cc
r12bc63a rfc4a0fa 200 200 } 201 201 202 Expression *build_fieldSel( ExpressionNode *expr_node, Expression *member ) { 203 UntypedMemberExpr *ret = new UntypedMemberExpr( member, maybeMoveBuild< Expression >(expr_node) ); 204 return ret; 205 } 206 207 Expression *build_pfieldSel( ExpressionNode *expr_node, Expression *member ) { 202 Expression *build_fieldSel( ExpressionNode *expr_node, NameExpr *member ) { 203 UntypedMemberExpr *ret = new UntypedMemberExpr( member->get_name(), maybeMoveBuild< Expression >(expr_node) ); 204 delete member; 205 return ret; 206 } 207 208 Expression *build_pfieldSel( ExpressionNode *expr_node, NameExpr *member ) { 208 209 UntypedExpr *deref = new UntypedExpr( new NameExpr( "*?" ) ); 209 210 deref->get_args().push_back( maybeMoveBuild< Expression >(expr_node) ); 210 UntypedMemberExpr *ret = new UntypedMemberExpr( member, deref ); 211 UntypedMemberExpr *ret = new UntypedMemberExpr( member->get_name(), deref ); 212 delete member; 211 213 return ret; 212 214 } -
src/Parser/ParseNode.h
r12bc63a rfc4a0fa 165 165 166 166 Expression * build_cast( DeclarationNode * decl_node, ExpressionNode * expr_node ); 167 Expression * build_fieldSel( ExpressionNode * expr_node, Expression* member );168 Expression * build_pfieldSel( ExpressionNode * expr_node, Expression* member );167 Expression * build_fieldSel( ExpressionNode * expr_node, NameExpr * member ); 168 Expression * build_pfieldSel( ExpressionNode * expr_node, NameExpr * member ); 169 169 Expression * build_addressOf( ExpressionNode * expr_node ); 170 170 Expression * build_sizeOfexpr( ExpressionNode * expr_node ); -
src/Parser/parser.cc
r12bc63a rfc4a0fa 1023 1023 0, 300, 300, 304, 311, 312, 313, 317, 318, 319, 1024 1024 323, 324, 328, 329, 333, 334, 338, 342, 343, 354, 1025 356, 358, 360, 365, 366, 372, 376, 378, 3 80, 382,1026 38 4, 386, 388, 390, 399, 400, 406, 407, 411, 412,1027 41 6, 420, 422, 424, 426, 431, 434, 436, 438, 443,1028 45 6, 458, 460, 462, 464, 466, 468, 470, 472, 474,1029 47 6, 483, 484, 490, 491, 492, 493, 497, 498, 500,1030 50 5, 506, 508, 510, 515, 516, 518, 523, 524, 526,1031 5 31, 532, 534, 536, 538, 543, 544, 546, 551, 552,1032 55 7, 558, 563, 564, 569, 570, 575, 576, 581, 582,1033 58 5, 587, 592, 597, 598, 600, 606, 607, 611, 612,1034 61 3, 614, 615, 616, 617, 618, 619, 620, 621, 622,1035 62 8, 630, 632, 634, 639, 640, 645, 646, 652, 653,1036 65 9, 660, 661, 662, 663, 664, 665, 666, 667, 677,1037 68 4, 686, 696, 697, 702, 704, 710, 712, 716, 717,1038 72 2, 727, 730, 732, 734, 744, 746, 757, 758, 760,1039 76 4, 766, 770, 771, 776, 777, 781, 786, 787, 791,1040 79 3, 799, 800, 804, 806, 808, 810, 816, 817, 821,1041 82 3, 828, 830, 832, 837, 839, 844, 846, 850, 853,1042 85 7, 860, 864, 866, 868, 870, 875, 877, 879, 884,1043 88 6, 888, 890, 892, 897, 899, 901, 903, 908, 920,1044 9 21, 926, 928, 933, 937, 939, 941, 943, 945, 951,1045 95 2, 958, 959, 963, 964, 969, 971, 977, 978, 980,1046 98 5, 990, 1000, 1002, 1006, 1007, 1012, 1014, 1018, 1019,1047 102 3, 1025, 1029, 1030, 1034, 1035, 1039, 1040, 1055, 1056,1048 105 7, 1058, 1059, 1063, 1068, 1075, 1085, 1090, 1095, 1103,1049 110 8, 1113, 1118, 1123, 1131, 1153, 1158, 1165, 1167, 1174,1050 117 9, 1184, 1195, 1200, 1205, 1210, 1215, 1224, 1229, 1237,1051 123 8, 1239, 1240, 1246, 1251, 1259, 1260, 1261, 1262, 1266,1052 126 7, 1268, 1269, 1274, 1275, 1284, 1285, 1290, 1291, 1296,1053 129 8, 1300, 1302, 1304, 1307, 1306, 1318, 1319, 1321, 1331,1054 133 2, 1337, 1339, 1341, 1343, 1345, 1348, 1350, 1353, 1358,1055 13 60, 1362, 1364, 1366, 1368, 1370, 1372, 1374, 1376, 1378,1056 13 80, 1382, 1388, 1389, 1391, 1393, 1395, 1400, 1401, 1407,1057 140 8, 1410, 1412, 1417, 1419, 1421, 1423, 1428, 1429, 1431,1058 143 3, 1438, 1439, 1441, 1446, 1447, 1449, 1451, 1456, 1458,1059 14 60, 1465, 1466, 1470, 1472, 1478, 1477, 1481, 1483, 1488,1060 14 90, 1496, 1497, 1502, 1503, 1505, 1506, 1515, 1516, 1518,1061 15 20, 1525, 1527, 1533, 1534, 1536, 1539, 1542, 1547, 1548,1062 155 3, 1558, 1562, 1564, 1570, 1569, 1576, 1578, 1584, 1585,1063 159 3, 1594, 1598, 1599, 1600, 1602, 1604, 1611, 1612, 1614,1064 161 6, 1621, 1622, 1628, 1629, 1633, 1634, 1639, 1640, 1641,1065 164 3, 1651, 1652, 1654, 1657, 1659, 1663, 1664, 1665, 1667,1066 166 9, 1673, 1678, 1686, 1687, 1696, 1698, 1703, 1704, 1705,1067 170 9, 1710, 1711, 1715, 1716, 1717, 1721, 1722, 1723, 1728,1068 172 9, 1730, 1731, 1737, 1738, 1740, 1745, 1746, 1751, 1752,1069 175 3, 1754, 1755, 1770, 1771, 1776, 1777, 1783, 1785, 1788,1070 17 90, 1792, 1815, 1816, 1818, 1820, 1825, 1826, 1828, 1833,1071 183 8, 1839, 1845, 1844, 1848, 1852, 1854, 1856, 1862, 1863,1072 186 8, 1873, 1875, 1880, 1882, 1883, 1885, 1890, 1892, 1894,1073 189 9, 1901, 1906, 1911, 1919, 1925, 1924, 1938, 1939, 1944,1074 194 5, 1949, 1954, 1959, 1967, 1972, 1983, 1984, 1989, 1990,1075 199 6, 1997, 2001, 2002, 2003, 2006, 2005, 2016, 2025, 2031,1076 203 7, 2046, 2052, 2058, 2064, 2070, 2078, 2084, 2092, 2098,1077 210 7, 2108, 2109, 2113, 2117, 2119, 2124, 2125, 2129, 2130,1078 213 5, 2141, 2142, 2145, 2147, 2148, 2152, 2153, 2154, 2155,1079 218 9, 2191, 2192, 2194, 2199, 2204, 2209, 2211, 2213, 2218,1080 22 20, 2222, 2224, 2229, 2231, 2240, 2242, 2243, 2248, 2250,1081 225 2, 2257, 2259, 2261, 2266, 2268, 2270, 2279, 2280, 2281,1082 228 5, 2287, 2289, 2294, 2296, 2298, 2303, 2305, 2307, 2322,1083 232 4, 2325, 2327, 2332, 2333, 2338, 2340, 2342, 2347, 2349,1084 23 51, 2353, 2358, 2360, 2362, 2372, 2374, 2375, 2377, 2382,1085 238 4, 2386, 2391, 2393, 2395, 2397, 2402, 2404, 2406, 2437,1086 243 9, 2440, 2442, 2447, 2452, 2460, 2462, 2464, 2469, 2471,1087 247 6, 2478, 2492, 2493, 2495, 2500, 2502, 2504, 2506, 2508,1088 251 3, 2514, 2516, 2518, 2523, 2525, 2527, 2533, 2535, 2537,1089 25 41, 2543, 2545, 2547, 2561, 2562, 2564, 2569, 2571, 2573,1090 257 5, 2577, 2582, 2583, 2585, 2587, 2592, 2594, 2596, 2602,1091 260 3, 2605, 2614, 2617, 2619, 2622, 2624, 2626, 2639, 2640,1092 264 2, 2647, 2649, 2651, 2653, 2655, 2660, 2661, 2663, 2665,1093 26 70, 2672, 2680, 2681, 2682, 2687, 2688, 2692, 2694, 2696,1094 269 8, 2700, 2702, 2709, 2711, 2713, 2715, 2717, 2719, 2721,1095 272 3, 2725, 2727, 2732, 2734, 2736, 2741, 2767, 2768, 2770,1096 277 4, 2775, 2779, 2781, 2783, 2785, 2787, 2789, 2796, 2798,1097 2 800, 2802, 2804, 2806, 2811, 2816, 2818, 2820, 2838, 2840,1098 284 5, 28461025 356, 358, 360, 365, 366, 372, 376, 378, 379, 381, 1026 382, 384, 386, 388, 397, 398, 404, 405, 409, 410, 1027 414, 418, 420, 422, 424, 429, 432, 434, 436, 441, 1028 454, 456, 458, 460, 462, 464, 466, 468, 470, 472, 1029 474, 481, 482, 488, 489, 490, 491, 495, 496, 498, 1030 503, 504, 506, 508, 513, 514, 516, 521, 522, 524, 1031 529, 530, 532, 534, 536, 541, 542, 544, 549, 550, 1032 555, 556, 561, 562, 567, 568, 573, 574, 579, 580, 1033 583, 585, 590, 595, 596, 598, 604, 605, 609, 610, 1034 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 1035 626, 628, 630, 632, 637, 638, 643, 644, 650, 651, 1036 657, 658, 659, 660, 661, 662, 663, 664, 665, 675, 1037 682, 684, 694, 695, 700, 702, 708, 710, 714, 715, 1038 720, 725, 728, 730, 732, 742, 744, 755, 756, 758, 1039 762, 764, 768, 769, 774, 775, 779, 784, 785, 789, 1040 791, 797, 798, 802, 804, 806, 808, 814, 815, 819, 1041 821, 826, 828, 830, 835, 837, 842, 844, 848, 851, 1042 855, 858, 862, 864, 866, 868, 873, 875, 877, 882, 1043 884, 886, 888, 890, 895, 897, 899, 901, 906, 918, 1044 919, 924, 926, 931, 935, 937, 939, 941, 943, 949, 1045 950, 956, 957, 961, 962, 967, 969, 975, 976, 978, 1046 983, 988, 998, 1000, 1004, 1005, 1010, 1012, 1016, 1017, 1047 1021, 1023, 1027, 1028, 1032, 1033, 1037, 1038, 1053, 1054, 1048 1055, 1056, 1057, 1061, 1066, 1073, 1083, 1088, 1093, 1101, 1049 1106, 1111, 1116, 1121, 1129, 1151, 1156, 1163, 1165, 1172, 1050 1177, 1182, 1193, 1198, 1203, 1208, 1213, 1222, 1227, 1235, 1051 1236, 1237, 1238, 1244, 1249, 1257, 1258, 1259, 1260, 1264, 1052 1265, 1266, 1267, 1272, 1273, 1282, 1283, 1288, 1289, 1294, 1053 1296, 1298, 1300, 1302, 1305, 1304, 1316, 1317, 1319, 1329, 1054 1330, 1335, 1337, 1339, 1341, 1343, 1346, 1348, 1351, 1356, 1055 1358, 1360, 1362, 1364, 1366, 1368, 1370, 1372, 1374, 1376, 1056 1378, 1380, 1386, 1387, 1389, 1391, 1393, 1398, 1399, 1405, 1057 1406, 1408, 1410, 1415, 1417, 1419, 1421, 1426, 1427, 1429, 1058 1431, 1436, 1437, 1439, 1444, 1445, 1447, 1449, 1454, 1456, 1059 1458, 1463, 1464, 1468, 1470, 1476, 1475, 1479, 1481, 1486, 1060 1488, 1494, 1495, 1500, 1501, 1503, 1504, 1513, 1514, 1516, 1061 1518, 1523, 1525, 1531, 1532, 1534, 1537, 1540, 1545, 1546, 1062 1551, 1556, 1560, 1562, 1568, 1567, 1574, 1576, 1582, 1583, 1063 1591, 1592, 1596, 1597, 1598, 1600, 1602, 1609, 1610, 1612, 1064 1614, 1619, 1620, 1626, 1627, 1631, 1632, 1637, 1638, 1639, 1065 1641, 1649, 1650, 1652, 1655, 1657, 1661, 1662, 1663, 1665, 1066 1667, 1671, 1676, 1684, 1685, 1694, 1696, 1701, 1702, 1703, 1067 1707, 1708, 1709, 1713, 1714, 1715, 1719, 1720, 1721, 1726, 1068 1727, 1728, 1729, 1735, 1736, 1738, 1743, 1744, 1749, 1750, 1069 1751, 1752, 1753, 1768, 1769, 1774, 1775, 1781, 1783, 1786, 1070 1788, 1790, 1813, 1814, 1816, 1818, 1823, 1824, 1826, 1831, 1071 1836, 1837, 1843, 1842, 1846, 1850, 1852, 1854, 1860, 1861, 1072 1866, 1871, 1873, 1878, 1880, 1881, 1883, 1888, 1890, 1892, 1073 1897, 1899, 1904, 1909, 1917, 1923, 1922, 1936, 1937, 1942, 1074 1943, 1947, 1952, 1957, 1965, 1970, 1981, 1982, 1987, 1988, 1075 1994, 1995, 1999, 2000, 2001, 2004, 2003, 2014, 2023, 2029, 1076 2035, 2044, 2050, 2056, 2062, 2068, 2076, 2082, 2090, 2096, 1077 2105, 2106, 2107, 2111, 2115, 2117, 2122, 2123, 2127, 2128, 1078 2133, 2139, 2140, 2143, 2145, 2146, 2150, 2151, 2152, 2153, 1079 2187, 2189, 2190, 2192, 2197, 2202, 2207, 2209, 2211, 2216, 1080 2218, 2220, 2222, 2227, 2229, 2238, 2240, 2241, 2246, 2248, 1081 2250, 2255, 2257, 2259, 2264, 2266, 2268, 2277, 2278, 2279, 1082 2283, 2285, 2287, 2292, 2294, 2296, 2301, 2303, 2305, 2320, 1083 2322, 2323, 2325, 2330, 2331, 2336, 2338, 2340, 2345, 2347, 1084 2349, 2351, 2356, 2358, 2360, 2370, 2372, 2373, 2375, 2380, 1085 2382, 2384, 2389, 2391, 2393, 2395, 2400, 2402, 2404, 2435, 1086 2437, 2438, 2440, 2445, 2450, 2458, 2460, 2462, 2467, 2469, 1087 2474, 2476, 2490, 2491, 2493, 2498, 2500, 2502, 2504, 2506, 1088 2511, 2512, 2514, 2516, 2521, 2523, 2525, 2531, 2533, 2535, 1089 2539, 2541, 2543, 2545, 2559, 2560, 2562, 2567, 2569, 2571, 1090 2573, 2575, 2580, 2581, 2583, 2585, 2590, 2592, 2594, 2600, 1091 2601, 2603, 2612, 2615, 2617, 2620, 2622, 2624, 2637, 2638, 1092 2640, 2645, 2647, 2649, 2651, 2653, 2658, 2659, 2661, 2663, 1093 2668, 2670, 2678, 2679, 2680, 2685, 2686, 2690, 2692, 2694, 1094 2696, 2698, 2700, 2707, 2709, 2711, 2713, 2715, 2717, 2719, 1095 2721, 2723, 2725, 2730, 2732, 2734, 2739, 2765, 2766, 2768, 1096 2772, 2773, 2777, 2779, 2781, 2783, 2785, 2787, 2794, 2796, 1097 2798, 2800, 2802, 2804, 2809, 2814, 2816, 2818, 2836, 2838, 1098 2843, 2844 1099 1099 }; 1100 1100 #endif … … 5077 5077 break; 5078 5078 5079 case 27:5080 5081 /* Line 1806 of yacc.c */5082 #line 379 "parser.yy"5083 { (yyval.en) = new ExpressionNode( build_fieldSel( (yyvsp[(1) - (7)].en), build_tuple( (yyvsp[(5) - (7)].en) ) ) ); }5084 break;5085 5086 5079 case 28: 5087 5080 5088 5081 /* Line 1806 of yacc.c */ 5089 #line 38 1"parser.yy"5082 #line 380 "parser.yy" 5090 5083 { (yyval.en) = new ExpressionNode( build_pfieldSel( (yyvsp[(1) - (3)].en), build_varref( (yyvsp[(3) - (3)].tok) ) ) ); } 5091 5084 break; 5092 5085 5093 case 29:5086 case 30: 5094 5087 5095 5088 /* Line 1806 of yacc.c */ 5096 5089 #line 383 "parser.yy" 5097 { (yyval.en) = new ExpressionNode( build_ pfieldSel( (yyvsp[(1) - (7)].en), build_tuple( (yyvsp[(5) - (7)].en)) ) ); }5098 break; 5099 5100 case 3 0:5090 { (yyval.en) = new ExpressionNode( build_unary_ptr( OperKinds::IncrPost, (yyvsp[(1) - (2)].en) ) ); } 5091 break; 5092 5093 case 31: 5101 5094 5102 5095 /* Line 1806 of yacc.c */ 5103 5096 #line 385 "parser.yy" 5104 { (yyval.en) = new ExpressionNode( build_unary_ptr( OperKinds:: IncrPost, (yyvsp[(1) - (2)].en) ) ); }5105 break; 5106 5107 case 3 1:5097 { (yyval.en) = new ExpressionNode( build_unary_ptr( OperKinds::DecrPost, (yyvsp[(1) - (2)].en) ) ); } 5098 break; 5099 5100 case 32: 5108 5101 5109 5102 /* Line 1806 of yacc.c */ 5110 5103 #line 387 "parser.yy" 5111 { (yyval.en) = new ExpressionNode( build_ unary_ptr( OperKinds::DecrPost, (yyvsp[(1) - (2)].en) ) ); }5112 break; 5113 5114 case 3 2:5104 { (yyval.en) = new ExpressionNode( build_compoundLiteral( (yyvsp[(2) - (7)].decl), new InitializerNode( (yyvsp[(5) - (7)].in), true ) ) ); } 5105 break; 5106 5107 case 33: 5115 5108 5116 5109 /* Line 1806 of yacc.c */ 5117 5110 #line 389 "parser.yy" 5118 { (yyval.en) = new ExpressionNode( build_compoundLiteral( (yyvsp[(2) - (7)].decl), new InitializerNode( (yyvsp[(5) - (7)].in), true ) ) ); }5119 break;5120 5121 case 33:5122 5123 /* Line 1806 of yacc.c */5124 #line 391 "parser.yy"5125 5111 { 5126 5112 Token fn; … … 5133 5119 5134 5120 /* Line 1806 of yacc.c */ 5135 #line 401"parser.yy"5121 #line 399 "parser.yy" 5136 5122 { (yyval.en) = (ExpressionNode *)( (yyvsp[(1) - (3)].en)->set_last( (yyvsp[(3) - (3)].en) )); } 5137 5123 break; … … 5140 5126 5141 5127 /* Line 1806 of yacc.c */ 5142 #line 40 6"parser.yy"5128 #line 404 "parser.yy" 5143 5129 { (yyval.en) = 0; } 5144 5130 break; … … 5147 5133 5148 5134 /* Line 1806 of yacc.c */ 5149 #line 41 2"parser.yy"5135 #line 410 "parser.yy" 5150 5136 { (yyval.en) = (ExpressionNode *)(yyvsp[(1) - (3)].en)->set_last( (yyvsp[(3) - (3)].en) ); } 5151 5137 break; … … 5154 5140 5155 5141 /* Line 1806 of yacc.c */ 5156 #line 41 7"parser.yy"5142 #line 415 "parser.yy" 5157 5143 { (yyval.en) = new ExpressionNode( build_varref( (yyvsp[(1) - (1)].tok) ) ); } 5158 5144 break; … … 5161 5147 5162 5148 /* Line 1806 of yacc.c */ 5149 #line 419 "parser.yy" 5150 { (yyval.en) = new ExpressionNode( build_fieldSel( (yyvsp[(3) - (3)].en), build_varref( (yyvsp[(1) - (3)].tok) ) ) ); } 5151 break; 5152 5153 case 42: 5154 5155 /* Line 1806 of yacc.c */ 5163 5156 #line 421 "parser.yy" 5164 { (yyval.en) = new ExpressionNode( build_fieldSel( (yyvsp[( 3) - (3)].en), build_varref( (yyvsp[(1) - (3)].tok) ) ) ); }5165 break; 5166 5167 case 4 2:5157 { (yyval.en) = new ExpressionNode( build_fieldSel( (yyvsp[(5) - (7)].en), build_varref( (yyvsp[(1) - (7)].tok) ) ) ); } 5158 break; 5159 5160 case 43: 5168 5161 5169 5162 /* Line 1806 of yacc.c */ 5170 5163 #line 423 "parser.yy" 5171 { (yyval.en) = new ExpressionNode( build_ fieldSel( (yyvsp[(5) - (7)].en), build_varref( (yyvsp[(1) - (7)].tok) ) ) ); }5172 break; 5173 5174 case 4 3:5164 { (yyval.en) = new ExpressionNode( build_pfieldSel( (yyvsp[(3) - (3)].en), build_varref( (yyvsp[(1) - (3)].tok) ) ) ); } 5165 break; 5166 5167 case 44: 5175 5168 5176 5169 /* Line 1806 of yacc.c */ 5177 5170 #line 425 "parser.yy" 5178 { (yyval.en) = new ExpressionNode( build_pfieldSel( (yyvsp[(3) - (3)].en), build_varref( (yyvsp[(1) - (3)].tok) ) ) ); }5179 break;5180 5181 case 44:5182 5183 /* Line 1806 of yacc.c */5184 #line 427 "parser.yy"5185 5171 { (yyval.en) = new ExpressionNode( build_pfieldSel( (yyvsp[(5) - (7)].en), build_varref( (yyvsp[(1) - (7)].tok) ) ) ); } 5186 5172 break; … … 5189 5175 5190 5176 /* Line 1806 of yacc.c */ 5177 #line 433 "parser.yy" 5178 { (yyval.en) = (yyvsp[(1) - (1)].en); } 5179 break; 5180 5181 case 47: 5182 5183 /* Line 1806 of yacc.c */ 5191 5184 #line 435 "parser.yy" 5192 { (yyval.en) = (yyvsp[(1) - (1)].en); }5193 break; 5194 5195 case 4 7:5185 { (yyval.en) = new ExpressionNode( (yyvsp[(1) - (1)].constant) ); } 5186 break; 5187 5188 case 48: 5196 5189 5197 5190 /* Line 1806 of yacc.c */ 5198 5191 #line 437 "parser.yy" 5199 { (yyval.en) = new ExpressionNode( (yyvsp[(1) - (1)].constant) ); }5200 break;5201 5202 case 48:5203 5204 /* Line 1806 of yacc.c */5205 #line 439 "parser.yy"5206 5192 { (yyval.en) = (yyvsp[(2) - (2)].en)->set_extension( true ); } 5207 5193 break; … … 5210 5196 5211 5197 /* Line 1806 of yacc.c */ 5212 #line 44 4"parser.yy"5198 #line 442 "parser.yy" 5213 5199 { 5214 5200 switch ( (yyvsp[(1) - (2)].op) ) { … … 5228 5214 5229 5215 /* Line 1806 of yacc.c */ 5216 #line 455 "parser.yy" 5217 { (yyval.en) = new ExpressionNode( build_unary_val( (yyvsp[(1) - (2)].op), (yyvsp[(2) - (2)].en) ) ); } 5218 break; 5219 5220 case 51: 5221 5222 /* Line 1806 of yacc.c */ 5230 5223 #line 457 "parser.yy" 5231 { (yyval.en) = new ExpressionNode( build_unary_ val( (yyvsp[(1) - (2)].op), (yyvsp[(2) - (2)].en) ) ); }5232 break; 5233 5234 case 5 1:5224 { (yyval.en) = new ExpressionNode( build_unary_ptr( OperKinds::Incr, (yyvsp[(2) - (2)].en) ) ); } 5225 break; 5226 5227 case 52: 5235 5228 5236 5229 /* Line 1806 of yacc.c */ 5237 5230 #line 459 "parser.yy" 5238 { (yyval.en) = new ExpressionNode( build_unary_ptr( OperKinds:: Incr, (yyvsp[(2) - (2)].en) ) ); }5239 break; 5240 5241 case 5 2:5231 { (yyval.en) = new ExpressionNode( build_unary_ptr( OperKinds::Decr, (yyvsp[(2) - (2)].en) ) ); } 5232 break; 5233 5234 case 53: 5242 5235 5243 5236 /* Line 1806 of yacc.c */ 5244 5237 #line 461 "parser.yy" 5245 { (yyval.en) = new ExpressionNode( build_ unary_ptr( OperKinds::Decr,(yyvsp[(2) - (2)].en) ) ); }5246 break; 5247 5248 case 5 3:5238 { (yyval.en) = new ExpressionNode( build_sizeOfexpr( (yyvsp[(2) - (2)].en) ) ); } 5239 break; 5240 5241 case 54: 5249 5242 5250 5243 /* Line 1806 of yacc.c */ 5251 5244 #line 463 "parser.yy" 5252 { (yyval.en) = new ExpressionNode( build_sizeOf expr( (yyvsp[(2) - (2)].en) ) ); }5253 break; 5254 5255 case 5 4:5245 { (yyval.en) = new ExpressionNode( build_sizeOftype( (yyvsp[(3) - (4)].decl) ) ); } 5246 break; 5247 5248 case 55: 5256 5249 5257 5250 /* Line 1806 of yacc.c */ 5258 5251 #line 465 "parser.yy" 5259 { (yyval.en) = new ExpressionNode( build_ sizeOftype( (yyvsp[(3) - (4)].decl) ) ); }5260 break; 5261 5262 case 5 5:5252 { (yyval.en) = new ExpressionNode( build_alignOfexpr( (yyvsp[(2) - (2)].en) ) ); } 5253 break; 5254 5255 case 56: 5263 5256 5264 5257 /* Line 1806 of yacc.c */ 5265 5258 #line 467 "parser.yy" 5266 { (yyval.en) = new ExpressionNode( build_alignOf expr( (yyvsp[(2) - (2)].en) ) ); }5267 break; 5268 5269 case 5 6:5259 { (yyval.en) = new ExpressionNode( build_alignOftype( (yyvsp[(3) - (4)].decl) ) ); } 5260 break; 5261 5262 case 57: 5270 5263 5271 5264 /* Line 1806 of yacc.c */ 5272 5265 #line 469 "parser.yy" 5273 { (yyval.en) = new ExpressionNode( build_ alignOftype( (yyvsp[(3) - (4)].decl) ) ); }5274 break; 5275 5276 case 5 7:5266 { (yyval.en) = new ExpressionNode( build_offsetOf( (yyvsp[(3) - (6)].decl), build_varref( (yyvsp[(5) - (6)].tok) ) ) ); } 5267 break; 5268 5269 case 58: 5277 5270 5278 5271 /* Line 1806 of yacc.c */ 5279 5272 #line 471 "parser.yy" 5280 { (yyval.en) = new ExpressionNode( build_ offsetOf( (yyvsp[(3) - (6)].decl), build_varref( (yyvsp[(5) - (6)].tok) )) ); }5281 break; 5282 5283 case 5 8:5273 { (yyval.en) = new ExpressionNode( build_attrexpr( build_varref( (yyvsp[(1) - (1)].tok) ), nullptr ) ); } 5274 break; 5275 5276 case 59: 5284 5277 5285 5278 /* Line 1806 of yacc.c */ 5286 5279 #line 473 "parser.yy" 5287 { (yyval.en) = new ExpressionNode( build_attrexpr( build_varref( (yyvsp[(1) - ( 1)].tok) ), nullptr) ); }5288 break; 5289 5290 case 59:5280 { (yyval.en) = new ExpressionNode( build_attrexpr( build_varref( (yyvsp[(1) - (4)].tok) ), (yyvsp[(3) - (4)].en) ) ); } 5281 break; 5282 5283 case 60: 5291 5284 5292 5285 /* Line 1806 of yacc.c */ 5293 5286 #line 475 "parser.yy" 5294 { (yyval.en) = new ExpressionNode( build_attrexpr( build_varref( (yyvsp[(1) - (4)].tok) ), (yyvsp[(3) - (4)].en) ) ); }5295 break;5296 5297 case 60:5298 5299 /* Line 1806 of yacc.c */5300 #line 477 "parser.yy"5301 5287 { (yyval.en) = new ExpressionNode( build_attrtype( build_varref( (yyvsp[(1) - (4)].tok) ), (yyvsp[(3) - (4)].decl) ) ); } 5302 5288 break; … … 5305 5291 5306 5292 /* Line 1806 of yacc.c */ 5307 #line 48 3"parser.yy"5293 #line 481 "parser.yy" 5308 5294 { (yyval.op) = OperKinds::PointTo; } 5309 5295 break; … … 5312 5298 5313 5299 /* Line 1806 of yacc.c */ 5314 #line 48 4"parser.yy"5300 #line 482 "parser.yy" 5315 5301 { (yyval.op) = OperKinds::AddressOf; } 5316 5302 break; … … 5319 5305 5320 5306 /* Line 1806 of yacc.c */ 5307 #line 488 "parser.yy" 5308 { (yyval.op) = OperKinds::UnPlus; } 5309 break; 5310 5311 case 64: 5312 5313 /* Line 1806 of yacc.c */ 5314 #line 489 "parser.yy" 5315 { (yyval.op) = OperKinds::UnMinus; } 5316 break; 5317 5318 case 65: 5319 5320 /* Line 1806 of yacc.c */ 5321 5321 #line 490 "parser.yy" 5322 { (yyval.op) = OperKinds:: UnPlus; }5323 break; 5324 5325 case 6 4:5322 { (yyval.op) = OperKinds::Neg; } 5323 break; 5324 5325 case 66: 5326 5326 5327 5327 /* Line 1806 of yacc.c */ 5328 5328 #line 491 "parser.yy" 5329 { (yyval.op) = OperKinds::UnMinus; }5330 break;5331 5332 case 65:5333 5334 /* Line 1806 of yacc.c */5335 #line 492 "parser.yy"5336 { (yyval.op) = OperKinds::Neg; }5337 break;5338 5339 case 66:5340 5341 /* Line 1806 of yacc.c */5342 #line 493 "parser.yy"5343 5329 { (yyval.op) = OperKinds::BitNeg; } 5344 5330 break; 5345 5331 5346 5332 case 68: 5333 5334 /* Line 1806 of yacc.c */ 5335 #line 497 "parser.yy" 5336 { (yyval.en) = new ExpressionNode( build_cast( (yyvsp[(2) - (4)].decl), (yyvsp[(4) - (4)].en) ) ); } 5337 break; 5338 5339 case 69: 5347 5340 5348 5341 /* Line 1806 of yacc.c */ … … 5351 5344 break; 5352 5345 5353 case 69:5354 5355 /* Line 1806 of yacc.c */5356 #line 501 "parser.yy"5357 { (yyval.en) = new ExpressionNode( build_cast( (yyvsp[(2) - (4)].decl), (yyvsp[(4) - (4)].en) ) ); }5358 break;5359 5360 5346 case 71: 5361 5347 5362 5348 /* Line 1806 of yacc.c */ 5349 #line 505 "parser.yy" 5350 { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Mul, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); } 5351 break; 5352 5353 case 72: 5354 5355 /* Line 1806 of yacc.c */ 5363 5356 #line 507 "parser.yy" 5364 { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds:: Mul, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }5365 break; 5366 5367 case 7 2:5357 { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Div, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); } 5358 break; 5359 5360 case 73: 5368 5361 5369 5362 /* Line 1806 of yacc.c */ 5370 5363 #line 509 "parser.yy" 5371 { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Div, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }5372 break;5373 5374 case 73:5375 5376 /* Line 1806 of yacc.c */5377 #line 511 "parser.yy"5378 5364 { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Mod, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); } 5379 5365 break; … … 5382 5368 5383 5369 /* Line 1806 of yacc.c */ 5370 #line 515 "parser.yy" 5371 { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Plus, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); } 5372 break; 5373 5374 case 76: 5375 5376 /* Line 1806 of yacc.c */ 5384 5377 #line 517 "parser.yy" 5385 { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Plus, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }5386 break;5387 5388 case 76:5389 5390 /* Line 1806 of yacc.c */5391 #line 519 "parser.yy"5392 5378 { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Minus, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); } 5393 5379 break; … … 5396 5382 5397 5383 /* Line 1806 of yacc.c */ 5384 #line 523 "parser.yy" 5385 { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::LShift, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); } 5386 break; 5387 5388 case 79: 5389 5390 /* Line 1806 of yacc.c */ 5398 5391 #line 525 "parser.yy" 5399 { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::LShift, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }5400 break;5401 5402 case 79:5403 5404 /* Line 1806 of yacc.c */5405 #line 527 "parser.yy"5406 5392 { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::RShift, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); } 5407 5393 break; … … 5410 5396 5411 5397 /* Line 1806 of yacc.c */ 5398 #line 531 "parser.yy" 5399 { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::LThan, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); } 5400 break; 5401 5402 case 82: 5403 5404 /* Line 1806 of yacc.c */ 5412 5405 #line 533 "parser.yy" 5413 { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds:: LThan, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }5414 break; 5415 5416 case 8 2:5406 { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::GThan, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); } 5407 break; 5408 5409 case 83: 5417 5410 5418 5411 /* Line 1806 of yacc.c */ 5419 5412 #line 535 "parser.yy" 5420 { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds:: GThan, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }5421 break; 5422 5423 case 8 3:5413 { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::LEThan, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); } 5414 break; 5415 5416 case 84: 5424 5417 5425 5418 /* Line 1806 of yacc.c */ 5426 5419 #line 537 "parser.yy" 5427 { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::LEThan, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }5428 break;5429 5430 case 84:5431 5432 /* Line 1806 of yacc.c */5433 #line 539 "parser.yy"5434 5420 { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::GEThan, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); } 5435 5421 break; … … 5438 5424 5439 5425 /* Line 1806 of yacc.c */ 5426 #line 543 "parser.yy" 5427 { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Eq, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); } 5428 break; 5429 5430 case 87: 5431 5432 /* Line 1806 of yacc.c */ 5440 5433 #line 545 "parser.yy" 5441 { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Eq, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }5442 break;5443 5444 case 87:5445 5446 /* Line 1806 of yacc.c */5447 #line 547 "parser.yy"5448 5434 { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Neq, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); } 5449 5435 break; … … 5452 5438 5453 5439 /* Line 1806 of yacc.c */ 5454 #line 55 3"parser.yy"5440 #line 551 "parser.yy" 5455 5441 { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::BitAnd, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); } 5456 5442 break; … … 5459 5445 5460 5446 /* Line 1806 of yacc.c */ 5461 #line 55 9"parser.yy"5447 #line 557 "parser.yy" 5462 5448 { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Xor, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); } 5463 5449 break; … … 5466 5452 5467 5453 /* Line 1806 of yacc.c */ 5468 #line 56 5"parser.yy"5454 #line 563 "parser.yy" 5469 5455 { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::BitOr, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); } 5470 5456 break; … … 5473 5459 5474 5460 /* Line 1806 of yacc.c */ 5475 #line 5 71"parser.yy"5461 #line 569 "parser.yy" 5476 5462 { (yyval.en) = new ExpressionNode( build_and_or( (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en), true ) ); } 5477 5463 break; … … 5480 5466 5481 5467 /* Line 1806 of yacc.c */ 5482 #line 57 7"parser.yy"5468 #line 575 "parser.yy" 5483 5469 { (yyval.en) = new ExpressionNode( build_and_or( (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en), false ) ); } 5484 5470 break; … … 5487 5473 5488 5474 /* Line 1806 of yacc.c */ 5489 #line 58 3"parser.yy"5475 #line 581 "parser.yy" 5490 5476 { (yyval.en) = new ExpressionNode( build_cond( (yyvsp[(1) - (5)].en), (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].en) ) ); } 5491 5477 break; … … 5494 5480 5495 5481 /* Line 1806 of yacc.c */ 5482 #line 584 "parser.yy" 5483 { (yyval.en) = new ExpressionNode( build_cond( (yyvsp[(1) - (4)].en), (yyvsp[(1) - (4)].en), (yyvsp[(4) - (4)].en) ) ); } 5484 break; 5485 5486 case 101: 5487 5488 /* Line 1806 of yacc.c */ 5496 5489 #line 586 "parser.yy" 5497 { (yyval.en) = new ExpressionNode( build_cond( (yyvsp[(1) - (4)].en), (yyvsp[(1) - (4)].en), (yyvsp[(4) - (4)].en) ) ); }5498 break;5499 5500 case 101:5501 5502 /* Line 1806 of yacc.c */5503 #line 588 "parser.yy"5504 5490 { (yyval.en) = new ExpressionNode( build_cond( (yyvsp[(1) - (5)].en), (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].en) ) ); } 5505 5491 break; … … 5508 5494 5509 5495 /* Line 1806 of yacc.c */ 5496 #line 597 "parser.yy" 5497 { (yyval.en) = new ExpressionNode( build_binary_ptr( (yyvsp[(2) - (3)].op), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); } 5498 break; 5499 5500 case 105: 5501 5502 /* Line 1806 of yacc.c */ 5510 5503 #line 599 "parser.yy" 5511 { (yyval.en) = new ExpressionNode( build_binary_ptr( (yyvsp[(2) - (3)].op), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }5512 break;5513 5514 case 105:5515 5516 /* Line 1806 of yacc.c */5517 #line 601 "parser.yy"5518 5504 { (yyval.en) = ( (yyvsp[(2) - (2)].en) == 0 ) ? (yyvsp[(1) - (2)].en) : new ExpressionNode( build_binary_ptr( OperKinds::Assign, (yyvsp[(1) - (2)].en), (yyvsp[(2) - (2)].en) ) ); } 5519 5505 break; … … 5522 5508 5523 5509 /* Line 1806 of yacc.c */ 5524 #line 60 6"parser.yy"5510 #line 604 "parser.yy" 5525 5511 { (yyval.en) = nullptr; } 5526 5512 break; … … 5529 5515 5530 5516 /* Line 1806 of yacc.c */ 5517 #line 609 "parser.yy" 5518 { (yyval.op) = OperKinds::Assign; } 5519 break; 5520 5521 case 109: 5522 5523 /* Line 1806 of yacc.c */ 5524 #line 610 "parser.yy" 5525 { (yyval.op) = OperKinds::AtAssn; } 5526 break; 5527 5528 case 110: 5529 5530 /* Line 1806 of yacc.c */ 5531 5531 #line 611 "parser.yy" 5532 { (yyval.op) = OperKinds:: Assign; }5533 break; 5534 5535 case 1 09:5532 { (yyval.op) = OperKinds::MulAssn; } 5533 break; 5534 5535 case 111: 5536 5536 5537 5537 /* Line 1806 of yacc.c */ 5538 5538 #line 612 "parser.yy" 5539 { (yyval.op) = OperKinds:: AtAssn; }5540 break; 5541 5542 case 11 0:5539 { (yyval.op) = OperKinds::DivAssn; } 5540 break; 5541 5542 case 112: 5543 5543 5544 5544 /* Line 1806 of yacc.c */ 5545 5545 #line 613 "parser.yy" 5546 { (yyval.op) = OperKinds::M ulAssn; }5547 break; 5548 5549 case 11 1:5546 { (yyval.op) = OperKinds::ModAssn; } 5547 break; 5548 5549 case 113: 5550 5550 5551 5551 /* Line 1806 of yacc.c */ 5552 5552 #line 614 "parser.yy" 5553 { (yyval.op) = OperKinds:: DivAssn; }5554 break; 5555 5556 case 11 2:5553 { (yyval.op) = OperKinds::PlusAssn; } 5554 break; 5555 5556 case 114: 5557 5557 5558 5558 /* Line 1806 of yacc.c */ 5559 5559 #line 615 "parser.yy" 5560 { (yyval.op) = OperKinds::M odAssn; }5561 break; 5562 5563 case 11 3:5560 { (yyval.op) = OperKinds::MinusAssn; } 5561 break; 5562 5563 case 115: 5564 5564 5565 5565 /* Line 1806 of yacc.c */ 5566 5566 #line 616 "parser.yy" 5567 { (yyval.op) = OperKinds:: PlusAssn; }5568 break; 5569 5570 case 11 4:5567 { (yyval.op) = OperKinds::LSAssn; } 5568 break; 5569 5570 case 116: 5571 5571 5572 5572 /* Line 1806 of yacc.c */ 5573 5573 #line 617 "parser.yy" 5574 { (yyval.op) = OperKinds:: MinusAssn; }5575 break; 5576 5577 case 11 5:5574 { (yyval.op) = OperKinds::RSAssn; } 5575 break; 5576 5577 case 117: 5578 5578 5579 5579 /* Line 1806 of yacc.c */ 5580 5580 #line 618 "parser.yy" 5581 { (yyval.op) = OperKinds:: LSAssn; }5582 break; 5583 5584 case 11 6:5581 { (yyval.op) = OperKinds::AndAssn; } 5582 break; 5583 5584 case 118: 5585 5585 5586 5586 /* Line 1806 of yacc.c */ 5587 5587 #line 619 "parser.yy" 5588 { (yyval.op) = OperKinds:: RSAssn; }5589 break; 5590 5591 case 11 7:5588 { (yyval.op) = OperKinds::ERAssn; } 5589 break; 5590 5591 case 119: 5592 5592 5593 5593 /* Line 1806 of yacc.c */ 5594 5594 #line 620 "parser.yy" 5595 { (yyval.op) = OperKinds::AndAssn; }5596 break;5597 5598 case 118:5599 5600 /* Line 1806 of yacc.c */5601 #line 621 "parser.yy"5602 { (yyval.op) = OperKinds::ERAssn; }5603 break;5604 5605 case 119:5606 5607 /* Line 1806 of yacc.c */5608 #line 622 "parser.yy"5609 5595 { (yyval.op) = OperKinds::OrAssn; } 5610 5596 break; … … 5613 5599 5614 5600 /* Line 1806 of yacc.c */ 5601 #line 627 "parser.yy" 5602 { (yyval.en) = new ExpressionNode( build_tuple() ); } 5603 break; 5604 5605 case 121: 5606 5607 /* Line 1806 of yacc.c */ 5615 5608 #line 629 "parser.yy" 5616 { (yyval.en) = new ExpressionNode( build_tuple( ) ); }5617 break; 5618 5619 case 12 1:5609 { (yyval.en) = new ExpressionNode( build_tuple( (yyvsp[(3) - (5)].en) ) ); } 5610 break; 5611 5612 case 122: 5620 5613 5621 5614 /* Line 1806 of yacc.c */ 5622 5615 #line 631 "parser.yy" 5623 { (yyval.en) = new ExpressionNode( build_tuple( ( yyvsp[(3) - (5)].en) ) ); }5624 break; 5625 5626 case 12 2:5616 { (yyval.en) = new ExpressionNode( build_tuple( (ExpressionNode *)(new ExpressionNode( nullptr ) )->set_last( (yyvsp[(4) - (6)].en) ) ) ); } 5617 break; 5618 5619 case 123: 5627 5620 5628 5621 /* Line 1806 of yacc.c */ 5629 5622 #line 633 "parser.yy" 5630 { (yyval.en) = new ExpressionNode( build_tuple( (ExpressionNode *)(new ExpressionNode( nullptr ) )->set_last( (yyvsp[(4) - (6)].en) ) ) ); }5631 break;5632 5633 case 123:5634 5635 /* Line 1806 of yacc.c */5636 #line 635 "parser.yy"5637 5623 { (yyval.en) = new ExpressionNode( build_tuple( (ExpressionNode *)(yyvsp[(3) - (7)].en)->set_last( (yyvsp[(5) - (7)].en) ) ) ); } 5638 5624 break; … … 5641 5627 5642 5628 /* Line 1806 of yacc.c */ 5643 #line 6 41"parser.yy"5629 #line 639 "parser.yy" 5644 5630 { (yyval.en) = (ExpressionNode *)(yyvsp[(1) - (3)].en)->set_last( (yyvsp[(3) - (3)].en) ); } 5645 5631 break; … … 5648 5634 5649 5635 /* Line 1806 of yacc.c */ 5650 #line 64 7"parser.yy"5636 #line 645 "parser.yy" 5651 5637 { (yyval.en) = new ExpressionNode( build_comma( (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); } 5652 5638 break; … … 5655 5641 5656 5642 /* Line 1806 of yacc.c */ 5657 #line 65 2"parser.yy"5643 #line 650 "parser.yy" 5658 5644 { (yyval.en) = 0; } 5659 5645 break; … … 5662 5648 5663 5649 /* Line 1806 of yacc.c */ 5664 #line 6 61"parser.yy"5650 #line 659 "parser.yy" 5665 5651 { (yyval.sn) = (yyvsp[(1) - (1)].sn); } 5666 5652 break; … … 5669 5655 5670 5656 /* Line 1806 of yacc.c */ 5671 #line 66 8"parser.yy"5657 #line 666 "parser.yy" 5672 5658 { 5673 5659 Token fn; … … 5680 5666 5681 5667 /* Line 1806 of yacc.c */ 5682 #line 67 8"parser.yy"5668 #line 676 "parser.yy" 5683 5669 { 5684 5670 (yyval.sn) = (yyvsp[(4) - (4)].sn)->add_label( (yyvsp[(1) - (4)].tok) ); … … 5689 5675 5690 5676 /* Line 1806 of yacc.c */ 5691 #line 68 5"parser.yy"5677 #line 683 "parser.yy" 5692 5678 { (yyval.sn) = new StatementNode( build_compound( (StatementNode *)0 ) ); } 5693 5679 break; … … 5696 5682 5697 5683 /* Line 1806 of yacc.c */ 5698 #line 69 2"parser.yy"5684 #line 690 "parser.yy" 5699 5685 { (yyval.sn) = new StatementNode( build_compound( (yyvsp[(5) - (7)].sn) ) ); } 5700 5686 break; … … 5703 5689 5704 5690 /* Line 1806 of yacc.c */ 5705 #line 69 8"parser.yy"5691 #line 696 "parser.yy" 5706 5692 { if ( (yyvsp[(1) - (3)].sn) != 0 ) { (yyvsp[(1) - (3)].sn)->set_last( (yyvsp[(3) - (3)].sn) ); (yyval.sn) = (yyvsp[(1) - (3)].sn); } } 5707 5693 break; … … 5710 5696 5711 5697 /* Line 1806 of yacc.c */ 5698 #line 701 "parser.yy" 5699 { (yyval.sn) = new StatementNode( (yyvsp[(1) - (1)].decl) ); } 5700 break; 5701 5702 case 145: 5703 5704 /* Line 1806 of yacc.c */ 5712 5705 #line 703 "parser.yy" 5713 { (yyval.sn) = new StatementNode( (yyvsp[(1) - (1)].decl) ); }5714 break;5715 5716 case 145:5717 5718 /* Line 1806 of yacc.c */5719 #line 705 "parser.yy"5720 5706 { // mark all fields in list 5721 5707 for ( DeclarationNode *iter = (yyvsp[(2) - (2)].decl); iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) … … 5728 5714 5729 5715 /* Line 1806 of yacc.c */ 5730 #line 7 11"parser.yy"5716 #line 709 "parser.yy" 5731 5717 { (yyval.sn) = new StatementNode( (yyvsp[(1) - (1)].decl) ); } 5732 5718 break; … … 5735 5721 5736 5722 /* Line 1806 of yacc.c */ 5737 #line 71 8"parser.yy"5723 #line 716 "parser.yy" 5738 5724 { if ( (yyvsp[(1) - (2)].sn) != 0 ) { (yyvsp[(1) - (2)].sn)->set_last( (yyvsp[(2) - (2)].sn) ); (yyval.sn) = (yyvsp[(1) - (2)].sn); } } 5739 5725 break; … … 5742 5728 5743 5729 /* Line 1806 of yacc.c */ 5744 #line 72 3"parser.yy"5730 #line 721 "parser.yy" 5745 5731 { (yyval.sn) = new StatementNode( build_expr( (yyvsp[(1) - (2)].en) ) ); } 5746 5732 break; … … 5749 5735 5750 5736 /* Line 1806 of yacc.c */ 5737 #line 727 "parser.yy" 5738 { (yyval.sn) = new StatementNode( build_if( (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].sn), nullptr ) ); } 5739 break; 5740 5741 case 152: 5742 5743 /* Line 1806 of yacc.c */ 5751 5744 #line 729 "parser.yy" 5752 { (yyval.sn) = new StatementNode( build_if( (yyvsp[(3) - ( 5)].en), (yyvsp[(5) - (5)].sn), nullptr) ); }5753 break; 5754 5755 case 15 2:5745 { (yyval.sn) = new StatementNode( build_if( (yyvsp[(3) - (7)].en), (yyvsp[(5) - (7)].sn), (yyvsp[(7) - (7)].sn) ) ); } 5746 break; 5747 5748 case 153: 5756 5749 5757 5750 /* Line 1806 of yacc.c */ 5758 5751 #line 731 "parser.yy" 5759 { (yyval.sn) = new StatementNode( build_ if( (yyvsp[(3) - (7)].en), (yyvsp[(5) - (7)].sn), (yyvsp[(7) - (7)].sn) ) ); }5760 break; 5761 5762 case 15 3:5752 { (yyval.sn) = new StatementNode( build_switch( (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].sn) ) ); } 5753 break; 5754 5755 case 154: 5763 5756 5764 5757 /* Line 1806 of yacc.c */ 5765 5758 #line 733 "parser.yy" 5766 { (yyval.sn) = new StatementNode( build_switch( (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].sn) ) ); }5767 break;5768 5769 case 154:5770 5771 /* Line 1806 of yacc.c */5772 #line 735 "parser.yy"5773 5759 { 5774 5760 StatementNode *sw = new StatementNode( build_switch( (yyvsp[(3) - (9)].en), (yyvsp[(8) - (9)].sn) ) ); … … 5785 5771 5786 5772 /* Line 1806 of yacc.c */ 5773 #line 743 "parser.yy" 5774 { (yyval.sn) = new StatementNode( build_switch( (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].sn) ) ); } 5775 break; 5776 5777 case 156: 5778 5779 /* Line 1806 of yacc.c */ 5787 5780 #line 745 "parser.yy" 5788 { (yyval.sn) = new StatementNode( build_switch( (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].sn) ) ); }5789 break;5790 5791 case 156:5792 5793 /* Line 1806 of yacc.c */5794 #line 747 "parser.yy"5795 5781 { 5796 5782 StatementNode *sw = new StatementNode( build_switch( (yyvsp[(3) - (9)].en), (yyvsp[(8) - (9)].sn) ) ); … … 5802 5788 5803 5789 /* Line 1806 of yacc.c */ 5790 #line 755 "parser.yy" 5791 { (yyval.en) = (yyvsp[(1) - (1)].en); } 5792 break; 5793 5794 case 158: 5795 5796 /* Line 1806 of yacc.c */ 5804 5797 #line 757 "parser.yy" 5805 { (yyval.en) = (yyvsp[(1) - (1)].en); }5806 break;5807 5808 case 158:5809 5810 /* Line 1806 of yacc.c */5811 #line 759 "parser.yy"5812 5798 { (yyval.en) = new ExpressionNode( build_range( (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); } 5813 5799 break; … … 5816 5802 5817 5803 /* Line 1806 of yacc.c */ 5804 #line 762 "parser.yy" 5805 { (yyval.sn) = new StatementNode( build_case( (yyvsp[(1) - (1)].en) ) ); } 5806 break; 5807 5808 case 161: 5809 5810 /* Line 1806 of yacc.c */ 5818 5811 #line 764 "parser.yy" 5819 { (yyval.sn) = new StatementNode( build_case( (yyvsp[(1) - (1)].en) ) ); }5820 break;5821 5822 case 161:5823 5824 /* Line 1806 of yacc.c */5825 #line 766 "parser.yy"5826 5812 { (yyval.sn) = (StatementNode *)((yyvsp[(1) - (3)].sn)->set_last( new StatementNode( build_case( (yyvsp[(3) - (3)].en) ) ) ) ); } 5827 5813 break; … … 5830 5816 5831 5817 /* Line 1806 of yacc.c */ 5832 #line 7 70"parser.yy"5818 #line 768 "parser.yy" 5833 5819 { (yyval.sn) = (yyvsp[(2) - (3)].sn); } 5834 5820 break; … … 5837 5823 5838 5824 /* Line 1806 of yacc.c */ 5839 #line 7 71"parser.yy"5825 #line 769 "parser.yy" 5840 5826 { (yyval.sn) = new StatementNode( build_default() ); } 5841 5827 break; … … 5844 5830 5845 5831 /* Line 1806 of yacc.c */ 5846 #line 77 7"parser.yy"5832 #line 775 "parser.yy" 5847 5833 { (yyval.sn) = (StatementNode *)( (yyvsp[(1) - (2)].sn)->set_last( (yyvsp[(2) - (2)].sn) )); } 5848 5834 break; … … 5851 5837 5852 5838 /* Line 1806 of yacc.c */ 5853 #line 7 81"parser.yy"5839 #line 779 "parser.yy" 5854 5840 { (yyval.sn) = (yyvsp[(1) - (2)].sn)->append_last_case( new StatementNode( build_compound( (yyvsp[(2) - (2)].sn) ) ) ); } 5855 5841 break; … … 5858 5844 5859 5845 /* Line 1806 of yacc.c */ 5860 #line 78 6"parser.yy"5846 #line 784 "parser.yy" 5861 5847 { (yyval.sn) = 0; } 5862 5848 break; … … 5865 5851 5866 5852 /* Line 1806 of yacc.c */ 5853 #line 790 "parser.yy" 5854 { (yyval.sn) = (yyvsp[(1) - (2)].sn)->append_last_case( new StatementNode( build_compound( (yyvsp[(2) - (2)].sn) ) ) ); } 5855 break; 5856 5857 case 170: 5858 5859 /* Line 1806 of yacc.c */ 5867 5860 #line 792 "parser.yy" 5868 { (yyval.sn) = (yyvsp[(1) - (2)].sn)->append_last_case( new StatementNode( build_compound( (yyvsp[(2) - (2)].sn) ) ) ); }5869 break;5870 5871 case 170:5872 5873 /* Line 1806 of yacc.c */5874 #line 794 "parser.yy"5875 5861 { (yyval.sn) = (StatementNode *)( (yyvsp[(1) - (3)].sn)->set_last( (yyvsp[(2) - (3)].sn)->append_last_case( new StatementNode( build_compound( (yyvsp[(3) - (3)].sn) ) ) ) ) ); } 5876 5862 break; … … 5879 5865 5880 5866 /* Line 1806 of yacc.c */ 5881 #line 79 9"parser.yy"5867 #line 797 "parser.yy" 5882 5868 { (yyval.sn) = 0; } 5883 5869 break; … … 5886 5872 5887 5873 /* Line 1806 of yacc.c */ 5874 #line 803 "parser.yy" 5875 { (yyval.sn) = (yyvsp[(1) - (2)].sn)->append_last_case( (yyvsp[(2) - (2)].sn) ); } 5876 break; 5877 5878 case 174: 5879 5880 /* Line 1806 of yacc.c */ 5888 5881 #line 805 "parser.yy" 5889 { (yyval.sn) = (yyvsp[(1) - ( 2)].sn)->append_last_case( (yyvsp[(2) - (2)].sn) ); }5890 break; 5891 5892 case 17 4:5882 { (yyval.sn) = (yyvsp[(1) - (3)].sn)->append_last_case( new StatementNode( build_compound( (StatementNode *)(yyvsp[(2) - (3)].sn)->set_last( (yyvsp[(3) - (3)].sn) ) ) ) ); } 5883 break; 5884 5885 case 175: 5893 5886 5894 5887 /* Line 1806 of yacc.c */ 5895 5888 #line 807 "parser.yy" 5896 { (yyval.sn) = ( yyvsp[(1) - (3)].sn)->append_last_case( new StatementNode( build_compound( (StatementNode *)(yyvsp[(2) - (3)].sn)->set_last( (yyvsp[(3) - (3)].sn) ) ) )); }5897 break; 5898 5899 case 17 5:5889 { (yyval.sn) = (StatementNode *)( (yyvsp[(1) - (3)].sn)->set_last( (yyvsp[(2) - (3)].sn)->append_last_case( (yyvsp[(3) - (3)].sn) ))); } 5890 break; 5891 5892 case 176: 5900 5893 5901 5894 /* Line 1806 of yacc.c */ 5902 5895 #line 809 "parser.yy" 5903 { (yyval.sn) = (StatementNode *)( (yyvsp[(1) - (3)].sn)->set_last( (yyvsp[(2) - (3)].sn)->append_last_case( (yyvsp[(3) - (3)].sn) ))); }5904 break;5905 5906 case 176:5907 5908 /* Line 1806 of yacc.c */5909 #line 811 "parser.yy"5910 5896 { (yyval.sn) = (StatementNode *)( (yyvsp[(1) - (4)].sn)->set_last( (yyvsp[(2) - (4)].sn)->append_last_case( new StatementNode( build_compound( (StatementNode *)(yyvsp[(3) - (4)].sn)->set_last( (yyvsp[(4) - (4)].sn) ) ) ) ) ) ); } 5911 5897 break; … … 5914 5900 5915 5901 /* Line 1806 of yacc.c */ 5916 #line 81 6"parser.yy"5902 #line 814 "parser.yy" 5917 5903 { (yyval.sn) = new StatementNode( build_branch( BranchStmt::Break ) ); } 5918 5904 break; 5919 5905 5920 5906 case 179: 5907 5908 /* Line 1806 of yacc.c */ 5909 #line 820 "parser.yy" 5910 { (yyval.sn) = 0; } 5911 break; 5912 5913 case 180: 5921 5914 5922 5915 /* Line 1806 of yacc.c */ … … 5925 5918 break; 5926 5919 5927 case 180:5928 5929 /* Line 1806 of yacc.c */5930 #line 824 "parser.yy"5931 { (yyval.sn) = 0; }5932 break;5933 5934 5920 case 181: 5935 5921 5936 5922 /* Line 1806 of yacc.c */ 5923 #line 827 "parser.yy" 5924 { (yyval.sn) = new StatementNode( build_while( (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].sn) ) ); } 5925 break; 5926 5927 case 182: 5928 5929 /* Line 1806 of yacc.c */ 5937 5930 #line 829 "parser.yy" 5938 { (yyval.sn) = new StatementNode( build_while( (yyvsp[( 3) - (5)].en), (yyvsp[(5) - (5)].sn)) ); }5939 break; 5940 5941 case 18 2:5931 { (yyval.sn) = new StatementNode( build_while( (yyvsp[(5) - (7)].en), (yyvsp[(2) - (7)].sn), true ) ); } 5932 break; 5933 5934 case 183: 5942 5935 5943 5936 /* Line 1806 of yacc.c */ 5944 5937 #line 831 "parser.yy" 5945 { (yyval.sn) = new StatementNode( build_while( (yyvsp[(5) - (7)].en), (yyvsp[(2) - (7)].sn), true ) ); }5946 break;5947 5948 case 183:5949 5950 /* Line 1806 of yacc.c */5951 #line 833 "parser.yy"5952 5938 { (yyval.sn) = new StatementNode( build_for( (yyvsp[(4) - (6)].fctl), (yyvsp[(6) - (6)].sn) ) ); } 5953 5939 break; … … 5956 5942 5957 5943 /* Line 1806 of yacc.c */ 5944 #line 836 "parser.yy" 5945 { (yyval.fctl) = new ForCtl( (yyvsp[(1) - (6)].en), (yyvsp[(4) - (6)].en), (yyvsp[(6) - (6)].en) ); } 5946 break; 5947 5948 case 185: 5949 5950 /* Line 1806 of yacc.c */ 5958 5951 #line 838 "parser.yy" 5959 { (yyval.fctl) = new ForCtl( (yyvsp[(1) - (6)].en), (yyvsp[(4) - (6)].en), (yyvsp[(6) - (6)].en) ); }5960 break;5961 5962 case 185:5963 5964 /* Line 1806 of yacc.c */5965 #line 840 "parser.yy"5966 5952 { (yyval.fctl) = new ForCtl( (yyvsp[(1) - (4)].decl), (yyvsp[(2) - (4)].en), (yyvsp[(4) - (4)].en) ); } 5967 5953 break; … … 5970 5956 5971 5957 /* Line 1806 of yacc.c */ 5972 #line 84 5"parser.yy"5958 #line 843 "parser.yy" 5973 5959 { (yyval.sn) = new StatementNode( build_branch( (yyvsp[(2) - (3)].tok), BranchStmt::Goto ) ); } 5974 5960 break; … … 5977 5963 5978 5964 /* Line 1806 of yacc.c */ 5979 #line 84 9"parser.yy"5965 #line 847 "parser.yy" 5980 5966 { (yyval.sn) = new StatementNode( build_computedgoto( (yyvsp[(3) - (4)].en) ) ); } 5981 5967 break; … … 5984 5970 5985 5971 /* Line 1806 of yacc.c */ 5986 #line 85 2"parser.yy"5972 #line 850 "parser.yy" 5987 5973 { (yyval.sn) = new StatementNode( build_branch( BranchStmt::Continue ) ); } 5988 5974 break; … … 5991 5977 5992 5978 /* Line 1806 of yacc.c */ 5993 #line 85 6"parser.yy"5979 #line 854 "parser.yy" 5994 5980 { (yyval.sn) = new StatementNode( build_branch( (yyvsp[(2) - (3)].tok), BranchStmt::Continue ) ); } 5995 5981 break; … … 5998 5984 5999 5985 /* Line 1806 of yacc.c */ 6000 #line 85 9"parser.yy"5986 #line 857 "parser.yy" 6001 5987 { (yyval.sn) = new StatementNode( build_branch( BranchStmt::Break ) ); } 6002 5988 break; … … 6005 5991 6006 5992 /* Line 1806 of yacc.c */ 5993 #line 861 "parser.yy" 5994 { (yyval.sn) = new StatementNode( build_branch( (yyvsp[(2) - (3)].tok), BranchStmt::Break ) ); } 5995 break; 5996 5997 case 192: 5998 5999 /* Line 1806 of yacc.c */ 6007 6000 #line 863 "parser.yy" 6008 { (yyval.sn) = new StatementNode( build_ branch( (yyvsp[(2) - (3)].tok), BranchStmt::Break) ); }6009 break; 6010 6011 case 19 2:6001 { (yyval.sn) = new StatementNode( build_return( (yyvsp[(2) - (3)].en) ) ); } 6002 break; 6003 6004 case 193: 6012 6005 6013 6006 /* Line 1806 of yacc.c */ 6014 6007 #line 865 "parser.yy" 6015 { (yyval.sn) = new StatementNode( build_ return( (yyvsp[(2) - (3)].en) ) ); }6016 break; 6017 6018 case 19 3:6008 { (yyval.sn) = new StatementNode( build_throw( (yyvsp[(2) - (3)].en) ) ); } 6009 break; 6010 6011 case 194: 6019 6012 6020 6013 /* Line 1806 of yacc.c */ … … 6023 6016 break; 6024 6017 6025 case 19 4:6018 case 195: 6026 6019 6027 6020 /* Line 1806 of yacc.c */ 6028 6021 #line 869 "parser.yy" 6029 { (yyval.sn) = new StatementNode( build_throw( (yyvsp[(2) - (3)].en) ) ); }6030 break;6031 6032 case 195:6033 6034 /* Line 1806 of yacc.c */6035 #line 871 "parser.yy"6036 6022 { (yyval.sn) = new StatementNode( build_throw( (yyvsp[(2) - (5)].en) ) ); } 6037 6023 break; … … 6040 6026 6041 6027 /* Line 1806 of yacc.c */ 6028 #line 874 "parser.yy" 6029 { (yyval.sn) = new StatementNode( build_try( (yyvsp[(2) - (3)].sn), (yyvsp[(3) - (3)].sn), 0 ) ); } 6030 break; 6031 6032 case 197: 6033 6034 /* Line 1806 of yacc.c */ 6042 6035 #line 876 "parser.yy" 6043 { (yyval.sn) = new StatementNode( build_try( (yyvsp[(2) - (3)].sn), (yyvsp[(3) - (3)].sn), 0) ); }6044 break; 6045 6046 case 19 7:6036 { (yyval.sn) = new StatementNode( build_try( (yyvsp[(2) - (3)].sn), 0, (yyvsp[(3) - (3)].sn) ) ); } 6037 break; 6038 6039 case 198: 6047 6040 6048 6041 /* Line 1806 of yacc.c */ 6049 6042 #line 878 "parser.yy" 6050 { (yyval.sn) = new StatementNode( build_try( (yyvsp[(2) - (3)].sn), 0, (yyvsp[(3) - (3)].sn) ) ); }6051 break;6052 6053 case 198:6054 6055 /* Line 1806 of yacc.c */6056 #line 880 "parser.yy"6057 6043 { (yyval.sn) = new StatementNode( build_try( (yyvsp[(2) - (4)].sn), (yyvsp[(3) - (4)].sn), (yyvsp[(4) - (4)].sn) ) ); } 6058 6044 break; … … 6061 6047 6062 6048 /* Line 1806 of yacc.c */ 6049 #line 885 "parser.yy" 6050 { (yyval.sn) = new StatementNode( build_catch( 0, (yyvsp[(5) - (5)].sn), true ) ); } 6051 break; 6052 6053 case 201: 6054 6055 /* Line 1806 of yacc.c */ 6063 6056 #line 887 "parser.yy" 6057 { (yyval.sn) = (StatementNode *)(yyvsp[(1) - (6)].sn)->set_last( new StatementNode( build_catch( 0, (yyvsp[(6) - (6)].sn), true ) ) ); } 6058 break; 6059 6060 case 202: 6061 6062 /* Line 1806 of yacc.c */ 6063 #line 889 "parser.yy" 6064 6064 { (yyval.sn) = new StatementNode( build_catch( 0, (yyvsp[(5) - (5)].sn), true ) ); } 6065 6065 break; 6066 6066 6067 case 20 1:6068 6069 /* Line 1806 of yacc.c */ 6070 #line 8 89"parser.yy"6067 case 203: 6068 6069 /* Line 1806 of yacc.c */ 6070 #line 891 "parser.yy" 6071 6071 { (yyval.sn) = (StatementNode *)(yyvsp[(1) - (6)].sn)->set_last( new StatementNode( build_catch( 0, (yyvsp[(6) - (6)].sn), true ) ) ); } 6072 6072 break; 6073 6073 6074 case 202:6075 6076 /* Line 1806 of yacc.c */6077 #line 891 "parser.yy"6078 { (yyval.sn) = new StatementNode( build_catch( 0, (yyvsp[(5) - (5)].sn), true ) ); }6079 break;6080 6081 case 203:6082 6083 /* Line 1806 of yacc.c */6084 #line 893 "parser.yy"6085 { (yyval.sn) = (StatementNode *)(yyvsp[(1) - (6)].sn)->set_last( new StatementNode( build_catch( 0, (yyvsp[(6) - (6)].sn), true ) ) ); }6086 break;6087 6088 6074 case 204: 6089 6075 6090 6076 /* Line 1806 of yacc.c */ 6077 #line 896 "parser.yy" 6078 { (yyval.sn) = new StatementNode( build_catch( (yyvsp[(5) - (9)].decl), (yyvsp[(8) - (9)].sn) ) ); } 6079 break; 6080 6081 case 205: 6082 6083 /* Line 1806 of yacc.c */ 6091 6084 #line 898 "parser.yy" 6085 { (yyval.sn) = (StatementNode *)(yyvsp[(1) - (10)].sn)->set_last( new StatementNode( build_catch( (yyvsp[(6) - (10)].decl), (yyvsp[(9) - (10)].sn) ) ) ); } 6086 break; 6087 6088 case 206: 6089 6090 /* Line 1806 of yacc.c */ 6091 #line 900 "parser.yy" 6092 6092 { (yyval.sn) = new StatementNode( build_catch( (yyvsp[(5) - (9)].decl), (yyvsp[(8) - (9)].sn) ) ); } 6093 6093 break; 6094 6094 6095 case 20 5:6096 6097 /* Line 1806 of yacc.c */ 6098 #line 90 0"parser.yy"6095 case 207: 6096 6097 /* Line 1806 of yacc.c */ 6098 #line 902 "parser.yy" 6099 6099 { (yyval.sn) = (StatementNode *)(yyvsp[(1) - (10)].sn)->set_last( new StatementNode( build_catch( (yyvsp[(6) - (10)].decl), (yyvsp[(9) - (10)].sn) ) ) ); } 6100 6100 break; 6101 6101 6102 case 206:6103 6104 /* Line 1806 of yacc.c */6105 #line 902 "parser.yy"6106 { (yyval.sn) = new StatementNode( build_catch( (yyvsp[(5) - (9)].decl), (yyvsp[(8) - (9)].sn) ) ); }6107 break;6108 6109 case 207:6110 6111 /* Line 1806 of yacc.c */6112 #line 904 "parser.yy"6113 { (yyval.sn) = (StatementNode *)(yyvsp[(1) - (10)].sn)->set_last( new StatementNode( build_catch( (yyvsp[(6) - (10)].decl), (yyvsp[(9) - (10)].sn) ) ) ); }6114 break;6115 6116 6102 case 208: 6117 6103 6118 6104 /* Line 1806 of yacc.c */ 6119 #line 90 9"parser.yy"6105 #line 907 "parser.yy" 6120 6106 { 6121 6107 (yyval.sn) = new StatementNode( build_finally( (yyvsp[(2) - (2)].sn) ) ); … … 6126 6112 6127 6113 /* Line 1806 of yacc.c */ 6128 #line 92 2"parser.yy"6114 #line 920 "parser.yy" 6129 6115 { 6130 6116 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 6136 6122 6137 6123 /* Line 1806 of yacc.c */ 6124 #line 925 "parser.yy" 6125 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addType( (yyvsp[(1) - (2)].decl) ); } 6126 break; 6127 6128 case 212: 6129 6130 /* Line 1806 of yacc.c */ 6138 6131 #line 927 "parser.yy" 6139 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addType( (yyvsp[(1) - (2)].decl) ); }6140 break;6141 6142 case 212:6143 6144 /* Line 1806 of yacc.c */6145 #line 929 "parser.yy"6146 6132 { 6147 6133 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 6153 6139 6154 6140 /* Line 1806 of yacc.c */ 6141 #line 936 "parser.yy" 6142 { (yyval.sn) = new StatementNode( build_asmstmt( (yyvsp[(2) - (6)].flag), (yyvsp[(4) - (6)].constant), 0 ) ); } 6143 break; 6144 6145 case 215: 6146 6147 /* Line 1806 of yacc.c */ 6155 6148 #line 938 "parser.yy" 6156 { (yyval.sn) = new StatementNode( build_asmstmt( (yyvsp[(2) - ( 6)].flag), (yyvsp[(4) - (6)].constant), 0) ); }6157 break; 6158 6159 case 21 5:6149 { (yyval.sn) = new StatementNode( build_asmstmt( (yyvsp[(2) - (8)].flag), (yyvsp[(4) - (8)].constant), (yyvsp[(6) - (8)].en) ) ); } 6150 break; 6151 6152 case 216: 6160 6153 6161 6154 /* Line 1806 of yacc.c */ 6162 6155 #line 940 "parser.yy" 6163 { (yyval.sn) = new StatementNode( build_asmstmt( (yyvsp[(2) - ( 8)].flag), (yyvsp[(4) - (8)].constant), (yyvsp[(6) - (8)].en) ) ); }6164 break; 6165 6166 case 21 6:6156 { (yyval.sn) = new StatementNode( build_asmstmt( (yyvsp[(2) - (10)].flag), (yyvsp[(4) - (10)].constant), (yyvsp[(6) - (10)].en), (yyvsp[(8) - (10)].en) ) ); } 6157 break; 6158 6159 case 217: 6167 6160 6168 6161 /* Line 1806 of yacc.c */ 6169 6162 #line 942 "parser.yy" 6170 { (yyval.sn) = new StatementNode( build_asmstmt( (yyvsp[(2) - (1 0)].flag), (yyvsp[(4) - (10)].constant), (yyvsp[(6) - (10)].en), (yyvsp[(8) - (10)].en) ) ); }6171 break; 6172 6173 case 21 7:6163 { (yyval.sn) = new StatementNode( build_asmstmt( (yyvsp[(2) - (12)].flag), (yyvsp[(4) - (12)].constant), (yyvsp[(6) - (12)].en), (yyvsp[(8) - (12)].en), (yyvsp[(10) - (12)].en) ) ); } 6164 break; 6165 6166 case 218: 6174 6167 6175 6168 /* Line 1806 of yacc.c */ 6176 6169 #line 944 "parser.yy" 6177 { (yyval.sn) = new StatementNode( build_asmstmt( (yyvsp[(2) - (12)].flag), (yyvsp[(4) - (12)].constant), (yyvsp[(6) - (12)].en), (yyvsp[(8) - (12)].en), (yyvsp[(10) - (12)].en) ) ); }6178 break;6179 6180 case 218:6181 6182 /* Line 1806 of yacc.c */6183 #line 946 "parser.yy"6184 6170 { (yyval.sn) = new StatementNode( build_asmstmt( (yyvsp[(2) - (14)].flag), (yyvsp[(5) - (14)].constant), 0, (yyvsp[(8) - (14)].en), (yyvsp[(10) - (14)].en), (yyvsp[(12) - (14)].label) ) ); } 6185 6171 break; … … 6188 6174 6189 6175 /* Line 1806 of yacc.c */ 6176 #line 949 "parser.yy" 6177 { (yyval.flag) = false; } 6178 break; 6179 6180 case 220: 6181 6182 /* Line 1806 of yacc.c */ 6190 6183 #line 951 "parser.yy" 6191 { (yyval.flag) = false; }6192 break;6193 6194 case 220:6195 6196 /* Line 1806 of yacc.c */6197 #line 953 "parser.yy"6198 6184 { (yyval.flag) = true; } 6199 6185 break; … … 6202 6188 6203 6189 /* Line 1806 of yacc.c */ 6204 #line 95 8"parser.yy"6190 #line 956 "parser.yy" 6205 6191 { (yyval.en) = 0; } 6206 6192 break; … … 6209 6195 6210 6196 /* Line 1806 of yacc.c */ 6211 #line 96 5"parser.yy"6197 #line 963 "parser.yy" 6212 6198 { (yyval.en) = (ExpressionNode *)(yyvsp[(1) - (3)].en)->set_last( (yyvsp[(3) - (3)].en) ); } 6213 6199 break; … … 6216 6202 6217 6203 /* Line 1806 of yacc.c */ 6204 #line 968 "parser.yy" 6205 { (yyval.en) = new ExpressionNode( build_asmexpr( 0, (yyvsp[(1) - (4)].constant), (yyvsp[(3) - (4)].en) ) ); } 6206 break; 6207 6208 case 226: 6209 6210 /* Line 1806 of yacc.c */ 6218 6211 #line 970 "parser.yy" 6219 { (yyval.en) = new ExpressionNode( build_asmexpr( 0, (yyvsp[(1) - (4)].constant), (yyvsp[(3) - (4)].en) ) ); }6220 break;6221 6222 case 226:6223 6224 /* Line 1806 of yacc.c */6225 #line 972 "parser.yy"6226 6212 { (yyval.en) = new ExpressionNode( build_asmexpr( (yyvsp[(2) - (7)].en), (yyvsp[(4) - (7)].constant), (yyvsp[(6) - (7)].en) ) ); } 6227 6213 break; … … 6230 6216 6231 6217 /* Line 1806 of yacc.c */ 6218 #line 975 "parser.yy" 6219 { (yyval.en) = 0; } 6220 break; 6221 6222 case 228: 6223 6224 /* Line 1806 of yacc.c */ 6232 6225 #line 977 "parser.yy" 6233 { (yyval.en) = 0; }6234 break; 6235 6236 case 22 8:6226 { (yyval.en) = new ExpressionNode( (yyvsp[(1) - (1)].constant) ); } 6227 break; 6228 6229 case 229: 6237 6230 6238 6231 /* Line 1806 of yacc.c */ 6239 6232 #line 979 "parser.yy" 6240 { (yyval.en) = new ExpressionNode( (yyvsp[(1) - (1)].constant) ); }6241 break;6242 6243 case 229:6244 6245 /* Line 1806 of yacc.c */6246 #line 981 "parser.yy"6247 6233 { (yyval.en) = (ExpressionNode *)(yyvsp[(1) - (3)].en)->set_last( new ExpressionNode( (yyvsp[(3) - (3)].constant) ) ); } 6248 6234 break; … … 6251 6237 6252 6238 /* Line 1806 of yacc.c */ 6253 #line 98 6"parser.yy"6239 #line 984 "parser.yy" 6254 6240 { 6255 6241 (yyval.label) = new LabelNode(); (yyval.label)->labels.push_back( *(yyvsp[(1) - (1)].tok) ); … … 6261 6247 6262 6248 /* Line 1806 of yacc.c */ 6263 #line 9 91"parser.yy"6249 #line 989 "parser.yy" 6264 6250 { 6265 6251 (yyval.label) = (yyvsp[(1) - (3)].label); (yyvsp[(1) - (3)].label)->labels.push_back( *(yyvsp[(3) - (3)].tok) ); … … 6271 6257 6272 6258 /* Line 1806 of yacc.c */ 6273 #line 1001"parser.yy"6259 #line 999 "parser.yy" 6274 6260 { (yyval.decl) = 0; } 6275 6261 break; … … 6278 6264 6279 6265 /* Line 1806 of yacc.c */ 6280 #line 100 8"parser.yy"6266 #line 1006 "parser.yy" 6281 6267 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(3) - (3)].decl) ); } 6282 6268 break; … … 6285 6271 6286 6272 /* Line 1806 of yacc.c */ 6287 #line 101 3"parser.yy"6273 #line 1011 "parser.yy" 6288 6274 { (yyval.decl) = 0; } 6289 6275 break; … … 6292 6278 6293 6279 /* Line 1806 of yacc.c */ 6294 #line 10 20"parser.yy"6280 #line 1018 "parser.yy" 6295 6281 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(3) - (3)].decl) ); } 6296 6282 break; … … 6299 6285 6300 6286 /* Line 1806 of yacc.c */ 6301 #line 103 4"parser.yy"6287 #line 1032 "parser.yy" 6302 6288 {} 6303 6289 break; … … 6306 6292 6307 6293 /* Line 1806 of yacc.c */ 6308 #line 103 5"parser.yy"6294 #line 1033 "parser.yy" 6309 6295 {} 6310 6296 break; … … 6313 6299 6314 6300 /* Line 1806 of yacc.c */ 6315 #line 106 4"parser.yy"6301 #line 1062 "parser.yy" 6316 6302 { 6317 6303 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 6323 6309 6324 6310 /* Line 1806 of yacc.c */ 6325 #line 10 71"parser.yy"6311 #line 1069 "parser.yy" 6326 6312 { 6327 6313 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 6333 6319 6334 6320 /* Line 1806 of yacc.c */ 6335 #line 107 6"parser.yy"6321 #line 1074 "parser.yy" 6336 6322 { 6337 6323 typedefTable.addToEnclosingScope( *(yyvsp[(5) - (6)].tok), TypedefTable::ID ); … … 6343 6329 6344 6330 /* Line 1806 of yacc.c */ 6345 #line 108 6"parser.yy"6331 #line 1084 "parser.yy" 6346 6332 { 6347 6333 typedefTable.setNextIdentifier( *(yyvsp[(2) - (3)].tok) ); … … 6353 6339 6354 6340 /* Line 1806 of yacc.c */ 6355 #line 10 91"parser.yy"6341 #line 1089 "parser.yy" 6356 6342 { 6357 6343 typedefTable.setNextIdentifier( *(yyvsp[(2) - (3)].tok) ); … … 6363 6349 6364 6350 /* Line 1806 of yacc.c */ 6365 #line 109 6"parser.yy"6351 #line 1094 "parser.yy" 6366 6352 { 6367 6353 typedefTable.setNextIdentifier( *(yyvsp[(3) - (4)].tok) ); … … 6373 6359 6374 6360 /* Line 1806 of yacc.c */ 6375 #line 110 4"parser.yy"6361 #line 1102 "parser.yy" 6376 6362 { 6377 6363 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 6383 6369 6384 6370 /* Line 1806 of yacc.c */ 6385 #line 110 9"parser.yy"6371 #line 1107 "parser.yy" 6386 6372 { 6387 6373 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 6393 6379 6394 6380 /* Line 1806 of yacc.c */ 6395 #line 111 4"parser.yy"6381 #line 1112 "parser.yy" 6396 6382 { 6397 6383 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 6403 6389 6404 6390 /* Line 1806 of yacc.c */ 6405 #line 111 9"parser.yy"6391 #line 1117 "parser.yy" 6406 6392 { 6407 6393 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 6413 6399 6414 6400 /* Line 1806 of yacc.c */ 6415 #line 112 4"parser.yy"6401 #line 1122 "parser.yy" 6416 6402 { 6417 6403 typedefTable.addToEnclosingScope( *(yyvsp[(5) - (5)].tok), TypedefTable::ID ); … … 6423 6409 6424 6410 /* Line 1806 of yacc.c */ 6425 #line 113 2"parser.yy"6411 #line 1130 "parser.yy" 6426 6412 { 6427 6413 (yyval.decl) = DeclarationNode::newFunction( (yyvsp[(3) - (8)].tok), DeclarationNode::newTuple( 0 ), (yyvsp[(6) - (8)].decl), 0, true ); … … 6432 6418 6433 6419 /* Line 1806 of yacc.c */ 6434 #line 115 5"parser.yy"6420 #line 1153 "parser.yy" 6435 6421 { 6436 6422 (yyval.decl) = DeclarationNode::newFunction( (yyvsp[(2) - (7)].tok), (yyvsp[(1) - (7)].decl), (yyvsp[(5) - (7)].decl), 0, true ); … … 6441 6427 6442 6428 /* Line 1806 of yacc.c */ 6443 #line 115 9"parser.yy"6429 #line 1157 "parser.yy" 6444 6430 { 6445 6431 (yyval.decl) = DeclarationNode::newFunction( (yyvsp[(2) - (7)].tok), (yyvsp[(1) - (7)].decl), (yyvsp[(5) - (7)].decl), 0, true ); … … 6450 6436 6451 6437 /* Line 1806 of yacc.c */ 6452 #line 116 6"parser.yy"6438 #line 1164 "parser.yy" 6453 6439 { (yyval.decl) = DeclarationNode::newTuple( (yyvsp[(3) - (5)].decl) ); } 6454 6440 break; … … 6457 6443 6458 6444 /* Line 1806 of yacc.c */ 6459 #line 11 70"parser.yy"6445 #line 1168 "parser.yy" 6460 6446 { (yyval.decl) = DeclarationNode::newTuple( (yyvsp[(3) - (9)].decl)->appendList( (yyvsp[(7) - (9)].decl) ) ); } 6461 6447 break; … … 6464 6450 6465 6451 /* Line 1806 of yacc.c */ 6466 #line 117 5"parser.yy"6452 #line 1173 "parser.yy" 6467 6453 { 6468 6454 typedefTable.addToEnclosingScope( TypedefTable::TD ); … … 6474 6460 6475 6461 /* Line 1806 of yacc.c */ 6476 #line 11 80"parser.yy"6462 #line 1178 "parser.yy" 6477 6463 { 6478 6464 typedefTable.addToEnclosingScope( TypedefTable::TD ); … … 6484 6470 6485 6471 /* Line 1806 of yacc.c */ 6486 #line 118 5"parser.yy"6472 #line 1183 "parser.yy" 6487 6473 { 6488 6474 typedefTable.addToEnclosingScope( *(yyvsp[(5) - (5)].tok), TypedefTable::TD ); … … 6494 6480 6495 6481 /* Line 1806 of yacc.c */ 6496 #line 119 6"parser.yy"6482 #line 1194 "parser.yy" 6497 6483 { 6498 6484 typedefTable.addToEnclosingScope( TypedefTable::TD ); … … 6504 6490 6505 6491 /* Line 1806 of yacc.c */ 6506 #line 1 201"parser.yy"6492 #line 1199 "parser.yy" 6507 6493 { 6508 6494 typedefTable.addToEnclosingScope( TypedefTable::TD ); … … 6514 6500 6515 6501 /* Line 1806 of yacc.c */ 6516 #line 120 6"parser.yy"6502 #line 1204 "parser.yy" 6517 6503 { 6518 6504 typedefTable.addToEnclosingScope( TypedefTable::TD ); … … 6524 6510 6525 6511 /* Line 1806 of yacc.c */ 6526 #line 12 11"parser.yy"6512 #line 1209 "parser.yy" 6527 6513 { 6528 6514 typedefTable.addToEnclosingScope( TypedefTable::TD ); … … 6534 6520 6535 6521 /* Line 1806 of yacc.c */ 6536 #line 121 6"parser.yy"6522 #line 1214 "parser.yy" 6537 6523 { 6538 6524 typedefTable.addToEnclosingScope( TypedefTable::TD ); … … 6544 6530 6545 6531 /* Line 1806 of yacc.c */ 6546 #line 122 5"parser.yy"6532 #line 1223 "parser.yy" 6547 6533 { 6548 6534 typedefTable.addToEnclosingScope( *(yyvsp[(2) - (4)].tok), TypedefTable::TD ); … … 6554 6540 6555 6541 /* Line 1806 of yacc.c */ 6556 #line 12 30"parser.yy"6542 #line 1228 "parser.yy" 6557 6543 { 6558 6544 typedefTable.addToEnclosingScope( *(yyvsp[(5) - (7)].tok), TypedefTable::TD ); … … 6564 6550 6565 6551 /* Line 1806 of yacc.c */ 6566 #line 124 7"parser.yy"6552 #line 1245 "parser.yy" 6567 6553 { 6568 6554 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 6574 6560 6575 6561 /* Line 1806 of yacc.c */ 6576 #line 125 2"parser.yy"6562 #line 1250 "parser.yy" 6577 6563 { 6578 6564 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 6584 6570 6585 6571 /* Line 1806 of yacc.c */ 6586 #line 127 4"parser.yy"6572 #line 1272 "parser.yy" 6587 6573 { (yyval.decl) = 0; } 6588 6574 break; … … 6591 6577 6592 6578 /* Line 1806 of yacc.c */ 6593 #line 128 6"parser.yy"6579 #line 1284 "parser.yy" 6594 6580 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 6595 6581 break; … … 6598 6584 6599 6585 /* Line 1806 of yacc.c */ 6586 #line 1295 "parser.yy" 6587 { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Const ); } 6588 break; 6589 6590 case 300: 6591 6592 /* Line 1806 of yacc.c */ 6600 6593 #line 1297 "parser.yy" 6601 { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode:: Const ); }6602 break; 6603 6604 case 30 0:6594 { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Restrict ); } 6595 break; 6596 6597 case 301: 6605 6598 6606 6599 /* Line 1806 of yacc.c */ 6607 6600 #line 1299 "parser.yy" 6608 { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode:: Restrict); }6609 break; 6610 6611 case 30 1:6601 { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Volatile ); } 6602 break; 6603 6604 case 302: 6612 6605 6613 6606 /* Line 1806 of yacc.c */ 6614 6607 #line 1301 "parser.yy" 6615 { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode:: Volatile ); }6616 break; 6617 6618 case 30 2:6608 { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Lvalue ); } 6609 break; 6610 6611 case 303: 6619 6612 6620 6613 /* Line 1806 of yacc.c */ 6621 6614 #line 1303 "parser.yy" 6622 { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode:: Lvalue); }6623 break; 6624 6625 case 30 3:6615 { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Atomic ); } 6616 break; 6617 6618 case 304: 6626 6619 6627 6620 /* Line 1806 of yacc.c */ 6628 6621 #line 1305 "parser.yy" 6629 { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Atomic ); }6630 break;6631 6632 case 304:6633 6634 /* Line 1806 of yacc.c */6635 #line 1307 "parser.yy"6636 6622 { 6637 6623 typedefTable.enterScope(); … … 6642 6628 6643 6629 /* Line 1806 of yacc.c */ 6644 #line 13 11"parser.yy"6630 #line 1309 "parser.yy" 6645 6631 { 6646 6632 typedefTable.leaveScope(); … … 6652 6638 6653 6639 /* Line 1806 of yacc.c */ 6640 #line 1318 "parser.yy" 6641 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 6642 break; 6643 6644 case 308: 6645 6646 /* Line 1806 of yacc.c */ 6654 6647 #line 1320 "parser.yy" 6648 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); } 6649 break; 6650 6651 case 310: 6652 6653 /* Line 1806 of yacc.c */ 6654 #line 1331 "parser.yy" 6655 6655 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 6656 6656 break; 6657 6657 6658 case 308: 6659 6660 /* Line 1806 of yacc.c */ 6661 #line 1322 "parser.yy" 6658 case 311: 6659 6660 /* Line 1806 of yacc.c */ 6661 #line 1336 "parser.yy" 6662 { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Extern ); } 6663 break; 6664 6665 case 312: 6666 6667 /* Line 1806 of yacc.c */ 6668 #line 1338 "parser.yy" 6669 { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Static ); } 6670 break; 6671 6672 case 313: 6673 6674 /* Line 1806 of yacc.c */ 6675 #line 1340 "parser.yy" 6676 { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Auto ); } 6677 break; 6678 6679 case 314: 6680 6681 /* Line 1806 of yacc.c */ 6682 #line 1342 "parser.yy" 6683 { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Register ); } 6684 break; 6685 6686 case 315: 6687 6688 /* Line 1806 of yacc.c */ 6689 #line 1345 "parser.yy" 6690 { (yyval.decl) = new DeclarationNode; (yyval.decl)->isInline = true; } 6691 break; 6692 6693 case 316: 6694 6695 /* Line 1806 of yacc.c */ 6696 #line 1347 "parser.yy" 6697 { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Fortran ); } 6698 break; 6699 6700 case 317: 6701 6702 /* Line 1806 of yacc.c */ 6703 #line 1350 "parser.yy" 6704 { (yyval.decl) = new DeclarationNode; (yyval.decl)->isNoreturn = true; } 6705 break; 6706 6707 case 318: 6708 6709 /* Line 1806 of yacc.c */ 6710 #line 1352 "parser.yy" 6711 { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Threadlocal ); } 6712 break; 6713 6714 case 319: 6715 6716 /* Line 1806 of yacc.c */ 6717 #line 1357 "parser.yy" 6718 { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Char ); } 6719 break; 6720 6721 case 320: 6722 6723 /* Line 1806 of yacc.c */ 6724 #line 1359 "parser.yy" 6725 { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Double ); } 6726 break; 6727 6728 case 321: 6729 6730 /* Line 1806 of yacc.c */ 6731 #line 1361 "parser.yy" 6732 { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Float ); } 6733 break; 6734 6735 case 322: 6736 6737 /* Line 1806 of yacc.c */ 6738 #line 1363 "parser.yy" 6739 { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Int ); } 6740 break; 6741 6742 case 323: 6743 6744 /* Line 1806 of yacc.c */ 6745 #line 1365 "parser.yy" 6746 { (yyval.decl) = DeclarationNode::newLength( DeclarationNode::Long ); } 6747 break; 6748 6749 case 324: 6750 6751 /* Line 1806 of yacc.c */ 6752 #line 1367 "parser.yy" 6753 { (yyval.decl) = DeclarationNode::newLength( DeclarationNode::Short ); } 6754 break; 6755 6756 case 325: 6757 6758 /* Line 1806 of yacc.c */ 6759 #line 1369 "parser.yy" 6760 { (yyval.decl) = DeclarationNode::newSignedNess( DeclarationNode::Signed ); } 6761 break; 6762 6763 case 326: 6764 6765 /* Line 1806 of yacc.c */ 6766 #line 1371 "parser.yy" 6767 { (yyval.decl) = DeclarationNode::newSignedNess( DeclarationNode::Unsigned ); } 6768 break; 6769 6770 case 327: 6771 6772 /* Line 1806 of yacc.c */ 6773 #line 1373 "parser.yy" 6774 { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Void ); } 6775 break; 6776 6777 case 328: 6778 6779 /* Line 1806 of yacc.c */ 6780 #line 1375 "parser.yy" 6781 { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Bool ); } 6782 break; 6783 6784 case 329: 6785 6786 /* Line 1806 of yacc.c */ 6787 #line 1377 "parser.yy" 6788 { (yyval.decl) = DeclarationNode::newComplexType( DeclarationNode::Complex ); } 6789 break; 6790 6791 case 330: 6792 6793 /* Line 1806 of yacc.c */ 6794 #line 1379 "parser.yy" 6795 { (yyval.decl) = DeclarationNode::newComplexType( DeclarationNode::Imaginary ); } 6796 break; 6797 6798 case 331: 6799 6800 /* Line 1806 of yacc.c */ 6801 #line 1381 "parser.yy" 6802 { (yyval.decl) = DeclarationNode::newBuiltinType( DeclarationNode::Valist ); } 6803 break; 6804 6805 case 333: 6806 6807 /* Line 1806 of yacc.c */ 6808 #line 1388 "parser.yy" 6809 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); } 6810 break; 6811 6812 case 334: 6813 6814 /* Line 1806 of yacc.c */ 6815 #line 1390 "parser.yy" 6816 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 6817 break; 6818 6819 case 335: 6820 6821 /* Line 1806 of yacc.c */ 6822 #line 1392 "parser.yy" 6662 6823 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); } 6663 6824 break; 6664 6825 6665 case 310: 6666 6667 /* Line 1806 of yacc.c */ 6668 #line 1333 "parser.yy" 6826 case 336: 6827 6828 /* Line 1806 of yacc.c */ 6829 #line 1394 "parser.yy" 6830 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addType( (yyvsp[(1) - (3)].decl) ); } 6831 break; 6832 6833 case 338: 6834 6835 /* Line 1806 of yacc.c */ 6836 #line 1400 "parser.yy" 6837 { (yyval.decl) = (yyvsp[(2) - (3)].decl)->addQualifiers( (yyvsp[(1) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); } 6838 break; 6839 6840 case 340: 6841 6842 /* Line 1806 of yacc.c */ 6843 #line 1407 "parser.yy" 6844 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); } 6845 break; 6846 6847 case 341: 6848 6849 /* Line 1806 of yacc.c */ 6850 #line 1409 "parser.yy" 6669 6851 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 6670 6852 break; 6671 6853 6672 case 311: 6673 6674 /* Line 1806 of yacc.c */ 6675 #line 1338 "parser.yy" 6676 { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Extern ); } 6677 break; 6678 6679 case 312: 6680 6681 /* Line 1806 of yacc.c */ 6682 #line 1340 "parser.yy" 6683 { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Static ); } 6684 break; 6685 6686 case 313: 6687 6688 /* Line 1806 of yacc.c */ 6689 #line 1342 "parser.yy" 6690 { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Auto ); } 6691 break; 6692 6693 case 314: 6694 6695 /* Line 1806 of yacc.c */ 6696 #line 1344 "parser.yy" 6697 { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Register ); } 6698 break; 6699 6700 case 315: 6701 6702 /* Line 1806 of yacc.c */ 6703 #line 1347 "parser.yy" 6704 { (yyval.decl) = new DeclarationNode; (yyval.decl)->isInline = true; } 6705 break; 6706 6707 case 316: 6708 6709 /* Line 1806 of yacc.c */ 6710 #line 1349 "parser.yy" 6711 { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Fortran ); } 6712 break; 6713 6714 case 317: 6715 6716 /* Line 1806 of yacc.c */ 6717 #line 1352 "parser.yy" 6718 { (yyval.decl) = new DeclarationNode; (yyval.decl)->isNoreturn = true; } 6719 break; 6720 6721 case 318: 6722 6723 /* Line 1806 of yacc.c */ 6724 #line 1354 "parser.yy" 6725 { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Threadlocal ); } 6726 break; 6727 6728 case 319: 6729 6730 /* Line 1806 of yacc.c */ 6731 #line 1359 "parser.yy" 6732 { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Char ); } 6733 break; 6734 6735 case 320: 6736 6737 /* Line 1806 of yacc.c */ 6738 #line 1361 "parser.yy" 6739 { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Double ); } 6740 break; 6741 6742 case 321: 6743 6744 /* Line 1806 of yacc.c */ 6745 #line 1363 "parser.yy" 6746 { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Float ); } 6747 break; 6748 6749 case 322: 6750 6751 /* Line 1806 of yacc.c */ 6752 #line 1365 "parser.yy" 6753 { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Int ); } 6754 break; 6755 6756 case 323: 6757 6758 /* Line 1806 of yacc.c */ 6759 #line 1367 "parser.yy" 6760 { (yyval.decl) = DeclarationNode::newLength( DeclarationNode::Long ); } 6761 break; 6762 6763 case 324: 6764 6765 /* Line 1806 of yacc.c */ 6766 #line 1369 "parser.yy" 6767 { (yyval.decl) = DeclarationNode::newLength( DeclarationNode::Short ); } 6768 break; 6769 6770 case 325: 6771 6772 /* Line 1806 of yacc.c */ 6773 #line 1371 "parser.yy" 6774 { (yyval.decl) = DeclarationNode::newSignedNess( DeclarationNode::Signed ); } 6775 break; 6776 6777 case 326: 6778 6779 /* Line 1806 of yacc.c */ 6780 #line 1373 "parser.yy" 6781 { (yyval.decl) = DeclarationNode::newSignedNess( DeclarationNode::Unsigned ); } 6782 break; 6783 6784 case 327: 6785 6786 /* Line 1806 of yacc.c */ 6787 #line 1375 "parser.yy" 6788 { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Void ); } 6789 break; 6790 6791 case 328: 6792 6793 /* Line 1806 of yacc.c */ 6794 #line 1377 "parser.yy" 6795 { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Bool ); } 6796 break; 6797 6798 case 329: 6799 6800 /* Line 1806 of yacc.c */ 6801 #line 1379 "parser.yy" 6802 { (yyval.decl) = DeclarationNode::newComplexType( DeclarationNode::Complex ); } 6803 break; 6804 6805 case 330: 6806 6807 /* Line 1806 of yacc.c */ 6808 #line 1381 "parser.yy" 6809 { (yyval.decl) = DeclarationNode::newComplexType( DeclarationNode::Imaginary ); } 6810 break; 6811 6812 case 331: 6813 6814 /* Line 1806 of yacc.c */ 6815 #line 1383 "parser.yy" 6816 { (yyval.decl) = DeclarationNode::newBuiltinType( DeclarationNode::Valist ); } 6817 break; 6818 6819 case 333: 6820 6821 /* Line 1806 of yacc.c */ 6822 #line 1390 "parser.yy" 6854 case 342: 6855 6856 /* Line 1806 of yacc.c */ 6857 #line 1411 "parser.yy" 6858 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addType( (yyvsp[(2) - (2)].decl) ); } 6859 break; 6860 6861 case 343: 6862 6863 /* Line 1806 of yacc.c */ 6864 #line 1416 "parser.yy" 6865 { (yyval.decl) = (yyvsp[(3) - (4)].decl); } 6866 break; 6867 6868 case 344: 6869 6870 /* Line 1806 of yacc.c */ 6871 #line 1418 "parser.yy" 6872 { (yyval.decl) = DeclarationNode::newTypeof( (yyvsp[(3) - (4)].en) ); } 6873 break; 6874 6875 case 345: 6876 6877 /* Line 1806 of yacc.c */ 6878 #line 1420 "parser.yy" 6879 { (yyval.decl) = DeclarationNode::newAttr( (yyvsp[(1) - (4)].tok), (yyvsp[(3) - (4)].decl) ); } 6880 break; 6881 6882 case 346: 6883 6884 /* Line 1806 of yacc.c */ 6885 #line 1422 "parser.yy" 6886 { (yyval.decl) = DeclarationNode::newAttr( (yyvsp[(1) - (4)].tok), (yyvsp[(3) - (4)].en) ); } 6887 break; 6888 6889 case 348: 6890 6891 /* Line 1806 of yacc.c */ 6892 #line 1428 "parser.yy" 6823 6893 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); } 6824 6894 break; 6825 6895 6826 case 3 34:6827 6828 /* Line 1806 of yacc.c */ 6829 #line 1 392"parser.yy"6896 case 349: 6897 6898 /* Line 1806 of yacc.c */ 6899 #line 1430 "parser.yy" 6830 6900 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 6831 6901 break; 6832 6902 6833 case 3 35:6834 6835 /* Line 1806 of yacc.c */ 6836 #line 1 394"parser.yy"6903 case 350: 6904 6905 /* Line 1806 of yacc.c */ 6906 #line 1432 "parser.yy" 6837 6907 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); } 6838 6908 break; 6839 6909 6840 case 336: 6841 6842 /* Line 1806 of yacc.c */ 6843 #line 1396 "parser.yy" 6844 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addType( (yyvsp[(1) - (3)].decl) ); } 6845 break; 6846 6847 case 338: 6848 6849 /* Line 1806 of yacc.c */ 6850 #line 1402 "parser.yy" 6851 { (yyval.decl) = (yyvsp[(2) - (3)].decl)->addQualifiers( (yyvsp[(1) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); } 6852 break; 6853 6854 case 340: 6855 6856 /* Line 1806 of yacc.c */ 6857 #line 1409 "parser.yy" 6910 case 352: 6911 6912 /* Line 1806 of yacc.c */ 6913 #line 1438 "parser.yy" 6858 6914 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); } 6859 6915 break; 6860 6916 6861 case 3 41:6862 6863 /* Line 1806 of yacc.c */ 6864 #line 14 11"parser.yy"6917 case 353: 6918 6919 /* Line 1806 of yacc.c */ 6920 #line 1440 "parser.yy" 6865 6921 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 6866 6922 break; 6867 6923 6868 case 342: 6869 6870 /* Line 1806 of yacc.c */ 6871 #line 1413 "parser.yy" 6872 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addType( (yyvsp[(2) - (2)].decl) ); } 6873 break; 6874 6875 case 343: 6876 6877 /* Line 1806 of yacc.c */ 6878 #line 1418 "parser.yy" 6879 { (yyval.decl) = (yyvsp[(3) - (4)].decl); } 6880 break; 6881 6882 case 344: 6883 6884 /* Line 1806 of yacc.c */ 6885 #line 1420 "parser.yy" 6886 { (yyval.decl) = DeclarationNode::newTypeof( (yyvsp[(3) - (4)].en) ); } 6887 break; 6888 6889 case 345: 6890 6891 /* Line 1806 of yacc.c */ 6892 #line 1422 "parser.yy" 6893 { (yyval.decl) = DeclarationNode::newAttr( (yyvsp[(1) - (4)].tok), (yyvsp[(3) - (4)].decl) ); } 6894 break; 6895 6896 case 346: 6897 6898 /* Line 1806 of yacc.c */ 6899 #line 1424 "parser.yy" 6900 { (yyval.decl) = DeclarationNode::newAttr( (yyvsp[(1) - (4)].tok), (yyvsp[(3) - (4)].en) ); } 6901 break; 6902 6903 case 348: 6904 6905 /* Line 1806 of yacc.c */ 6906 #line 1430 "parser.yy" 6924 case 355: 6925 6926 /* Line 1806 of yacc.c */ 6927 #line 1446 "parser.yy" 6907 6928 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); } 6908 6929 break; 6909 6930 6910 case 3 49:6911 6912 /* Line 1806 of yacc.c */ 6913 #line 14 32"parser.yy"6931 case 356: 6932 6933 /* Line 1806 of yacc.c */ 6934 #line 1448 "parser.yy" 6914 6935 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 6915 6936 break; 6916 6937 6917 case 35 0:6918 6919 /* Line 1806 of yacc.c */ 6920 #line 14 34"parser.yy"6938 case 357: 6939 6940 /* Line 1806 of yacc.c */ 6941 #line 1450 "parser.yy" 6921 6942 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); } 6922 6943 break; 6923 6944 6924 case 352: 6925 6926 /* Line 1806 of yacc.c */ 6927 #line 1440 "parser.yy" 6928 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); } 6929 break; 6930 6931 case 353: 6932 6933 /* Line 1806 of yacc.c */ 6934 #line 1442 "parser.yy" 6945 case 358: 6946 6947 /* Line 1806 of yacc.c */ 6948 #line 1455 "parser.yy" 6949 { (yyval.decl) = DeclarationNode::newFromTypedef( (yyvsp[(1) - (1)].tok) ); } 6950 break; 6951 6952 case 359: 6953 6954 /* Line 1806 of yacc.c */ 6955 #line 1457 "parser.yy" 6956 { (yyval.decl) = DeclarationNode::newFromTypedef( (yyvsp[(2) - (2)].tok) )->addQualifiers( (yyvsp[(1) - (2)].decl) ); } 6957 break; 6958 6959 case 360: 6960 6961 /* Line 1806 of yacc.c */ 6962 #line 1459 "parser.yy" 6935 6963 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 6936 6964 break; 6937 6965 6938 case 355:6939 6940 /* Line 1806 of yacc.c */6941 #line 1448 "parser.yy"6942 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }6943 break;6944 6945 case 356:6946 6947 /* Line 1806 of yacc.c */6948 #line 1450 "parser.yy"6949 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }6950 break;6951 6952 case 357:6953 6954 /* Line 1806 of yacc.c */6955 #line 1452 "parser.yy"6956 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); }6957 break;6958 6959 case 358:6960 6961 /* Line 1806 of yacc.c */6962 #line 1457 "parser.yy"6963 { (yyval.decl) = DeclarationNode::newFromTypedef( (yyvsp[(1) - (1)].tok) ); }6964 break;6965 6966 case 359:6967 6968 /* Line 1806 of yacc.c */6969 #line 1459 "parser.yy"6970 { (yyval.decl) = DeclarationNode::newFromTypedef( (yyvsp[(2) - (2)].tok) )->addQualifiers( (yyvsp[(1) - (2)].decl) ); }6971 break;6972 6973 case 360:6974 6975 /* Line 1806 of yacc.c */6976 #line 1461 "parser.yy"6977 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }6978 break;6979 6980 6966 case 363: 6981 6967 6982 6968 /* Line 1806 of yacc.c */ 6969 #line 1469 "parser.yy" 6970 { (yyval.decl) = DeclarationNode::newAggregate( (yyvsp[(1) - (4)].aggKey), 0, 0, (yyvsp[(3) - (4)].decl), true ); } 6971 break; 6972 6973 case 364: 6974 6975 /* Line 1806 of yacc.c */ 6983 6976 #line 1471 "parser.yy" 6984 { (yyval.decl) = DeclarationNode::newAggregate( (yyvsp[(1) - (4)].aggKey), 0, 0, (yyvsp[(3) - (4)].decl), true ); }6985 break;6986 6987 case 364:6988 6989 /* Line 1806 of yacc.c */6990 #line 1473 "parser.yy"6991 6977 { 6992 6978 typedefTable.makeTypedef( *(yyvsp[(2) - (2)].tok) ); … … 6998 6984 6999 6985 /* Line 1806 of yacc.c */ 6986 #line 1476 "parser.yy" 6987 { typedefTable.makeTypedef( *(yyvsp[(2) - (2)].tok) ); } 6988 break; 6989 6990 case 366: 6991 6992 /* Line 1806 of yacc.c */ 7000 6993 #line 1478 "parser.yy" 7001 { typedefTable.makeTypedef( *(yyvsp[(2) - (2)].tok)); }7002 break; 7003 7004 case 36 6:6994 { (yyval.decl) = DeclarationNode::newAggregate( (yyvsp[(1) - (6)].aggKey), (yyvsp[(2) - (6)].tok), 0, (yyvsp[(5) - (6)].decl), true ); } 6995 break; 6996 6997 case 367: 7005 6998 7006 6999 /* Line 1806 of yacc.c */ 7007 7000 #line 1480 "parser.yy" 7008 { (yyval.decl) = DeclarationNode::newAggregate( (yyvsp[(1) - ( 6)].aggKey), (yyvsp[(2) - (6)].tok), 0, (yyvsp[(5) - (6)].decl), true ); }7009 break; 7010 7011 case 36 7:7001 { (yyval.decl) = DeclarationNode::newAggregate( (yyvsp[(1) - (7)].aggKey), 0, (yyvsp[(3) - (7)].en), (yyvsp[(6) - (7)].decl), false ); } 7002 break; 7003 7004 case 368: 7012 7005 7013 7006 /* Line 1806 of yacc.c */ 7014 7007 #line 1482 "parser.yy" 7015 { (yyval.decl) = DeclarationNode::newAggregate( (yyvsp[(1) - (7)].aggKey), 0, (yyvsp[(3) - (7)].en), (yyvsp[(6) - (7)].decl), false ); }7016 break;7017 7018 case 368:7019 7020 /* Line 1806 of yacc.c */7021 #line 1484 "parser.yy"7022 7008 { (yyval.decl) = (yyvsp[(2) - (2)].decl); } 7023 7009 break; … … 7026 7012 7027 7013 /* Line 1806 of yacc.c */ 7014 #line 1487 "parser.yy" 7015 { (yyval.aggKey) = DeclarationNode::Struct; } 7016 break; 7017 7018 case 370: 7019 7020 /* Line 1806 of yacc.c */ 7028 7021 #line 1489 "parser.yy" 7029 { (yyval.aggKey) = DeclarationNode::Struct; }7030 break;7031 7032 case 370:7033 7034 /* Line 1806 of yacc.c */7035 #line 1491 "parser.yy"7036 7022 { (yyval.aggKey) = DeclarationNode::Union; } 7037 7023 break; … … 7040 7026 7041 7027 /* Line 1806 of yacc.c */ 7028 #line 1494 "parser.yy" 7029 { (yyval.decl) = 0; } 7030 break; 7031 7032 case 372: 7033 7034 /* Line 1806 of yacc.c */ 7042 7035 #line 1496 "parser.yy" 7043 { (yyval.decl) = 0; }7044 break;7045 7046 case 372:7047 7048 /* Line 1806 of yacc.c */7049 #line 1498 "parser.yy"7050 7036 { (yyval.decl) = (yyvsp[(1) - (2)].decl) != 0 ? (yyvsp[(1) - (2)].decl)->appendList( (yyvsp[(2) - (2)].decl) ) : (yyvsp[(2) - (2)].decl); } 7051 7037 break; … … 7054 7040 7055 7041 /* Line 1806 of yacc.c */ 7056 #line 150 4"parser.yy"7042 #line 1502 "parser.yy" 7057 7043 { (yyval.decl) = (yyvsp[(2) - (3)].decl)->set_extension( true ); } 7058 7044 break; … … 7061 7047 7062 7048 /* Line 1806 of yacc.c */ 7063 #line 150 7"parser.yy"7049 #line 1505 "parser.yy" 7064 7050 { // mark all fields in list 7065 7051 for ( DeclarationNode *iter = (yyvsp[(2) - (3)].decl); iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) … … 7072 7058 7073 7059 /* Line 1806 of yacc.c */ 7060 #line 1515 "parser.yy" 7061 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addName( (yyvsp[(2) - (2)].tok) ); } 7062 break; 7063 7064 case 379: 7065 7066 /* Line 1806 of yacc.c */ 7074 7067 #line 1517 "parser.yy" 7075 { (yyval.decl) = (yyvsp[(1) - ( 2)].decl)->addName( (yyvsp[(2) - (2)].tok) ); }7076 break; 7077 7078 case 3 79:7068 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(1) - (3)].decl)->cloneType( (yyvsp[(3) - (3)].tok) ) ); } 7069 break; 7070 7071 case 380: 7079 7072 7080 7073 /* Line 1806 of yacc.c */ 7081 7074 #line 1519 "parser.yy" 7082 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(1) - (3)].decl)->cloneType( (yyvsp[(3) - (3)].tok) ) ); }7083 break;7084 7085 case 380:7086 7087 /* Line 1806 of yacc.c */7088 #line 1521 "parser.yy"7089 7075 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->appendList( (yyvsp[(1) - (2)].decl)->cloneType( 0 ) ); } 7090 7076 break; … … 7093 7079 7094 7080 /* Line 1806 of yacc.c */ 7081 #line 1524 "parser.yy" 7082 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addType( (yyvsp[(1) - (2)].decl) ); } 7083 break; 7084 7085 case 382: 7086 7087 /* Line 1806 of yacc.c */ 7095 7088 #line 1526 "parser.yy" 7096 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addType( (yyvsp[(1) - (2)].decl) ); }7097 break;7098 7099 case 382:7100 7101 /* Line 1806 of yacc.c */7102 #line 1528 "parser.yy"7103 7089 { (yyval.decl) = (yyvsp[(1) - (4)].decl)->appendList( (yyvsp[(1) - (4)].decl)->cloneBaseType( (yyvsp[(4) - (4)].decl) ) ); } 7104 7090 break; … … 7107 7093 7108 7094 /* Line 1806 of yacc.c */ 7095 #line 1531 "parser.yy" 7096 { (yyval.decl) = DeclarationNode::newName( 0 ); /* XXX */ } 7097 break; 7098 7099 case 384: 7100 7101 /* Line 1806 of yacc.c */ 7109 7102 #line 1533 "parser.yy" 7110 { (yyval.decl) = DeclarationNode::newName( 0 ); /* XXX */ }7111 break;7112 7113 case 384:7114 7115 /* Line 1806 of yacc.c */7116 #line 1535 "parser.yy"7117 7103 { (yyval.decl) = DeclarationNode::newBitfield( (yyvsp[(1) - (1)].en) ); } 7118 7104 break; … … 7121 7107 7122 7108 /* Line 1806 of yacc.c */ 7123 #line 153 8"parser.yy"7109 #line 1536 "parser.yy" 7124 7110 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addBitfield( (yyvsp[(2) - (2)].en) ); } 7125 7111 break; … … 7128 7114 7129 7115 /* Line 1806 of yacc.c */ 7130 #line 15 41"parser.yy"7116 #line 1539 "parser.yy" 7131 7117 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addBitfield( (yyvsp[(2) - (2)].en) ); } 7132 7118 break; … … 7135 7121 7136 7122 /* Line 1806 of yacc.c */ 7123 #line 1545 "parser.yy" 7124 { (yyval.en) = 0; } 7125 break; 7126 7127 case 389: 7128 7129 /* Line 1806 of yacc.c */ 7137 7130 #line 1547 "parser.yy" 7138 { (yyval.en) = 0; }7139 break;7140 7141 case 389:7142 7143 /* Line 1806 of yacc.c */7144 #line 1549 "parser.yy"7145 7131 { (yyval.en) = (yyvsp[(1) - (1)].en); } 7146 7132 break; … … 7149 7135 7150 7136 /* Line 1806 of yacc.c */ 7151 #line 155 4"parser.yy"7137 #line 1552 "parser.yy" 7152 7138 { (yyval.en) = (yyvsp[(2) - (2)].en); } 7153 7139 break; … … 7156 7142 7157 7143 /* Line 1806 of yacc.c */ 7144 #line 1561 "parser.yy" 7145 { (yyval.decl) = DeclarationNode::newEnum( 0, (yyvsp[(3) - (5)].decl) ); } 7146 break; 7147 7148 case 393: 7149 7150 /* Line 1806 of yacc.c */ 7158 7151 #line 1563 "parser.yy" 7159 { (yyval.decl) = DeclarationNode::newEnum( 0, (yyvsp[(3) - (5)].decl) ); }7160 break;7161 7162 case 393:7163 7164 /* Line 1806 of yacc.c */7165 #line 1565 "parser.yy"7166 7152 { 7167 7153 typedefTable.makeTypedef( *(yyvsp[(2) - (2)].tok) ); … … 7173 7159 7174 7160 /* Line 1806 of yacc.c */ 7161 #line 1568 "parser.yy" 7162 { typedefTable.makeTypedef( *(yyvsp[(2) - (2)].tok) ); } 7163 break; 7164 7165 case 395: 7166 7167 /* Line 1806 of yacc.c */ 7175 7168 #line 1570 "parser.yy" 7176 { typedefTable.makeTypedef( *(yyvsp[(2) - (2)].tok) ); }7177 break;7178 7179 case 395:7180 7181 /* Line 1806 of yacc.c */7182 #line 1572 "parser.yy"7183 7169 { (yyval.decl) = DeclarationNode::newEnum( (yyvsp[(2) - (7)].tok), (yyvsp[(5) - (7)].decl) ); } 7184 7170 break; … … 7187 7173 7188 7174 /* Line 1806 of yacc.c */ 7175 #line 1575 "parser.yy" 7176 { (yyval.decl) = DeclarationNode::newEnumConstant( (yyvsp[(1) - (2)].tok), (yyvsp[(2) - (2)].en) ); } 7177 break; 7178 7179 case 397: 7180 7181 /* Line 1806 of yacc.c */ 7189 7182 #line 1577 "parser.yy" 7190 { (yyval.decl) = DeclarationNode::newEnumConstant( (yyvsp[(1) - (2)].tok), (yyvsp[(2) - (2)].en) ); }7191 break;7192 7193 case 397:7194 7195 /* Line 1806 of yacc.c */7196 #line 1579 "parser.yy"7197 7183 { (yyval.decl) = (yyvsp[(1) - (4)].decl)->appendList( DeclarationNode::newEnumConstant( (yyvsp[(3) - (4)].tok), (yyvsp[(4) - (4)].en) ) ); } 7198 7184 break; … … 7201 7187 7202 7188 /* Line 1806 of yacc.c */ 7189 #line 1582 "parser.yy" 7190 { (yyval.en) = 0; } 7191 break; 7192 7193 case 399: 7194 7195 /* Line 1806 of yacc.c */ 7203 7196 #line 1584 "parser.yy" 7204 { (yyval.en) = 0; }7205 break;7206 7207 case 399:7208 7209 /* Line 1806 of yacc.c */7210 #line 1586 "parser.yy"7211 7197 { (yyval.en) = (yyvsp[(2) - (2)].en); } 7212 7198 break; … … 7215 7201 7216 7202 /* Line 1806 of yacc.c */ 7217 #line 159 3"parser.yy"7203 #line 1591 "parser.yy" 7218 7204 { (yyval.decl) = 0; } 7219 7205 break; … … 7222 7208 7223 7209 /* Line 1806 of yacc.c */ 7210 #line 1599 "parser.yy" 7211 { (yyval.decl) = (yyvsp[(1) - (5)].decl)->appendList( (yyvsp[(5) - (5)].decl) ); } 7212 break; 7213 7214 case 405: 7215 7216 /* Line 1806 of yacc.c */ 7224 7217 #line 1601 "parser.yy" 7225 { (yyval.decl) = (yyvsp[(1) - (5)].decl)->a ppendList( (yyvsp[(5) - (5)].decl)); }7226 break; 7227 7228 case 40 5:7218 { (yyval.decl) = (yyvsp[(1) - (5)].decl)->addVarArgs(); } 7219 break; 7220 7221 case 406: 7229 7222 7230 7223 /* Line 1806 of yacc.c */ … … 7233 7226 break; 7234 7227 7235 case 406:7236 7237 /* Line 1806 of yacc.c */7238 #line 1605 "parser.yy"7239 { (yyval.decl) = (yyvsp[(1) - (5)].decl)->addVarArgs(); }7240 break;7241 7242 7228 case 408: 7229 7230 /* Line 1806 of yacc.c */ 7231 #line 1611 "parser.yy" 7232 { (yyval.decl) = (yyvsp[(1) - (5)].decl)->appendList( (yyvsp[(5) - (5)].decl) ); } 7233 break; 7234 7235 case 409: 7243 7236 7244 7237 /* Line 1806 of yacc.c */ … … 7247 7240 break; 7248 7241 7249 case 4 09:7242 case 410: 7250 7243 7251 7244 /* Line 1806 of yacc.c */ 7252 7245 #line 1615 "parser.yy" 7246 { (yyval.decl) = (yyvsp[(1) - (9)].decl)->appendList( (yyvsp[(5) - (9)].decl) )->appendList( (yyvsp[(9) - (9)].decl) ); } 7247 break; 7248 7249 case 412: 7250 7251 /* Line 1806 of yacc.c */ 7252 #line 1621 "parser.yy" 7253 7253 { (yyval.decl) = (yyvsp[(1) - (5)].decl)->appendList( (yyvsp[(5) - (5)].decl) ); } 7254 7254 break; 7255 7255 7256 case 410: 7257 7258 /* Line 1806 of yacc.c */ 7259 #line 1617 "parser.yy" 7260 { (yyval.decl) = (yyvsp[(1) - (9)].decl)->appendList( (yyvsp[(5) - (9)].decl) )->appendList( (yyvsp[(9) - (9)].decl) ); } 7261 break; 7262 7263 case 412: 7264 7265 /* Line 1806 of yacc.c */ 7266 #line 1623 "parser.yy" 7256 case 413: 7257 7258 /* Line 1806 of yacc.c */ 7259 #line 1626 "parser.yy" 7260 { (yyval.decl) = 0; } 7261 break; 7262 7263 case 416: 7264 7265 /* Line 1806 of yacc.c */ 7266 #line 1633 "parser.yy" 7267 { (yyval.decl) = (yyvsp[(1) - (5)].decl)->addVarArgs(); } 7268 break; 7269 7270 case 419: 7271 7272 /* Line 1806 of yacc.c */ 7273 #line 1640 "parser.yy" 7267 7274 { (yyval.decl) = (yyvsp[(1) - (5)].decl)->appendList( (yyvsp[(5) - (5)].decl) ); } 7268 7275 break; 7269 7276 7270 case 413: 7271 7272 /* Line 1806 of yacc.c */ 7273 #line 1628 "parser.yy" 7274 { (yyval.decl) = 0; } 7275 break; 7276 7277 case 416: 7278 7279 /* Line 1806 of yacc.c */ 7280 #line 1635 "parser.yy" 7281 { (yyval.decl) = (yyvsp[(1) - (5)].decl)->addVarArgs(); } 7282 break; 7283 7284 case 419: 7277 case 420: 7285 7278 7286 7279 /* Line 1806 of yacc.c */ … … 7289 7282 break; 7290 7283 7291 case 420:7292 7293 /* Line 1806 of yacc.c */7294 #line 1644 "parser.yy"7295 { (yyval.decl) = (yyvsp[(1) - (5)].decl)->appendList( (yyvsp[(5) - (5)].decl) ); }7296 break;7297 7298 7284 case 422: 7299 7285 7300 7286 /* Line 1806 of yacc.c */ 7301 #line 165 3"parser.yy"7287 #line 1651 "parser.yy" 7302 7288 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addName( (yyvsp[(2) - (3)].tok) ); } 7303 7289 break; … … 7306 7292 7307 7293 /* Line 1806 of yacc.c */ 7294 #line 1654 "parser.yy" 7295 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addName( (yyvsp[(2) - (3)].tok) ); } 7296 break; 7297 7298 case 424: 7299 7300 /* Line 1806 of yacc.c */ 7308 7301 #line 1656 "parser.yy" 7309 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addName( (yyvsp[(2) - (3)].tok) ); }7310 break;7311 7312 case 424:7313 7314 /* Line 1806 of yacc.c */7315 #line 1658 "parser.yy"7316 7302 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addName( (yyvsp[(3) - (4)].tok) )->addQualifiers( (yyvsp[(1) - (4)].decl) ); } 7317 7303 break; … … 7320 7306 7321 7307 /* Line 1806 of yacc.c */ 7322 #line 166 8"parser.yy"7308 #line 1666 "parser.yy" 7323 7309 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); } 7324 7310 break; … … 7327 7313 7328 7314 /* Line 1806 of yacc.c */ 7329 #line 167 4"parser.yy"7315 #line 1672 "parser.yy" 7330 7316 { 7331 7317 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 7337 7323 7338 7324 /* Line 1806 of yacc.c */ 7339 #line 167 9"parser.yy"7325 #line 1677 "parser.yy" 7340 7326 { 7341 7327 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 7347 7333 7348 7334 /* Line 1806 of yacc.c */ 7349 #line 168 8"parser.yy"7335 #line 1686 "parser.yy" 7350 7336 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addType( (yyvsp[(1) - (2)].decl) ); } 7351 7337 break; … … 7354 7340 7355 7341 /* Line 1806 of yacc.c */ 7342 #line 1695 "parser.yy" 7343 { (yyval.decl) = DeclarationNode::newName( (yyvsp[(1) - (1)].tok) ); } 7344 break; 7345 7346 case 436: 7347 7348 /* Line 1806 of yacc.c */ 7356 7349 #line 1697 "parser.yy" 7357 { (yyval.decl) = DeclarationNode::newName( (yyvsp[(1) - (1)].tok) ); }7358 break;7359 7360 case 436:7361 7362 /* Line 1806 of yacc.c */7363 #line 1699 "parser.yy"7364 7350 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( DeclarationNode::newName( (yyvsp[(3) - (3)].tok) ) ); } 7365 7351 break; … … 7368 7354 7369 7355 /* Line 1806 of yacc.c */ 7370 #line 172 4"parser.yy"7356 #line 1722 "parser.yy" 7371 7357 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addType( (yyvsp[(1) - (2)].decl) ); } 7372 7358 break; … … 7375 7361 7376 7362 /* Line 1806 of yacc.c */ 7377 #line 173 2"parser.yy"7363 #line 1730 "parser.yy" 7378 7364 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addType( (yyvsp[(1) - (2)].decl) ); } 7379 7365 break; … … 7382 7368 7383 7369 /* Line 1806 of yacc.c */ 7370 #line 1735 "parser.yy" 7371 { (yyval.in) = 0; } 7372 break; 7373 7374 case 454: 7375 7376 /* Line 1806 of yacc.c */ 7384 7377 #line 1737 "parser.yy" 7378 { (yyval.in) = (yyvsp[(2) - (2)].in); } 7379 break; 7380 7381 case 455: 7382 7383 /* Line 1806 of yacc.c */ 7384 #line 1739 "parser.yy" 7385 { (yyval.in) = (yyvsp[(2) - (2)].in)->set_maybeConstructed( false ); } 7386 break; 7387 7388 case 456: 7389 7390 /* Line 1806 of yacc.c */ 7391 #line 1743 "parser.yy" 7392 { (yyval.in) = new InitializerNode( (yyvsp[(1) - (1)].en) ); } 7393 break; 7394 7395 case 457: 7396 7397 /* Line 1806 of yacc.c */ 7398 #line 1744 "parser.yy" 7399 { (yyval.in) = new InitializerNode( (yyvsp[(2) - (4)].in), true ); } 7400 break; 7401 7402 case 458: 7403 7404 /* Line 1806 of yacc.c */ 7405 #line 1749 "parser.yy" 7385 7406 { (yyval.in) = 0; } 7386 7407 break; 7387 7408 7388 case 454: 7389 7390 /* Line 1806 of yacc.c */ 7391 #line 1739 "parser.yy" 7392 { (yyval.in) = (yyvsp[(2) - (2)].in); } 7393 break; 7394 7395 case 455: 7396 7397 /* Line 1806 of yacc.c */ 7398 #line 1741 "parser.yy" 7399 { (yyval.in) = (yyvsp[(2) - (2)].in)->set_maybeConstructed( false ); } 7400 break; 7401 7402 case 456: 7403 7404 /* Line 1806 of yacc.c */ 7405 #line 1745 "parser.yy" 7406 { (yyval.in) = new InitializerNode( (yyvsp[(1) - (1)].en) ); } 7407 break; 7408 7409 case 457: 7410 7411 /* Line 1806 of yacc.c */ 7412 #line 1746 "parser.yy" 7413 { (yyval.in) = new InitializerNode( (yyvsp[(2) - (4)].in), true ); } 7414 break; 7415 7416 case 458: 7409 case 460: 7417 7410 7418 7411 /* Line 1806 of yacc.c */ 7419 7412 #line 1751 "parser.yy" 7420 { (yyval.in) = 0; }7421 break;7422 7423 case 460:7424 7425 /* Line 1806 of yacc.c */7426 #line 1753 "parser.yy"7427 7413 { (yyval.in) = (yyvsp[(2) - (2)].in)->set_designators( (yyvsp[(1) - (2)].en) ); } 7428 7414 break; … … 7431 7417 7432 7418 /* Line 1806 of yacc.c */ 7419 #line 1752 "parser.yy" 7420 { (yyval.in) = (InitializerNode *)( (yyvsp[(1) - (3)].in)->set_last( (yyvsp[(3) - (3)].in) ) ); } 7421 break; 7422 7423 case 462: 7424 7425 /* Line 1806 of yacc.c */ 7433 7426 #line 1754 "parser.yy" 7434 { (yyval.in) = (InitializerNode *)( (yyvsp[(1) - (3)].in)->set_last( (yyvsp[(3) - (3)].in) ) ); }7435 break;7436 7437 case 462:7438 7439 /* Line 1806 of yacc.c */7440 #line 1756 "parser.yy"7441 7427 { (yyval.in) = (InitializerNode *)( (yyvsp[(1) - (4)].in)->set_last( (yyvsp[(4) - (4)].in)->set_designators( (yyvsp[(3) - (4)].en) ) ) ); } 7442 7428 break; … … 7445 7431 7446 7432 /* Line 1806 of yacc.c */ 7447 #line 177 2"parser.yy"7433 #line 1770 "parser.yy" 7448 7434 { (yyval.en) = new ExpressionNode( build_varref( (yyvsp[(1) - (2)].tok) ) ); } 7449 7435 break; … … 7452 7438 7453 7439 /* Line 1806 of yacc.c */ 7454 #line 177 8"parser.yy"7440 #line 1776 "parser.yy" 7455 7441 { (yyval.en) = (ExpressionNode *)( (yyvsp[(1) - (2)].en)->set_last( (yyvsp[(2) - (2)].en) ) ); } 7456 7442 break; … … 7459 7445 7460 7446 /* Line 1806 of yacc.c */ 7461 #line 178 4"parser.yy"7447 #line 1782 "parser.yy" 7462 7448 { (yyval.en) = new ExpressionNode( build_varref( (yyvsp[(2) - (2)].tok) ) ); } 7463 7449 break; 7464 7450 7465 7451 case 468: 7452 7453 /* Line 1806 of yacc.c */ 7454 #line 1785 "parser.yy" 7455 { (yyval.en) = (yyvsp[(3) - (5)].en); } 7456 break; 7457 7458 case 469: 7466 7459 7467 7460 /* Line 1806 of yacc.c */ … … 7470 7463 break; 7471 7464 7472 case 4 69:7465 case 470: 7473 7466 7474 7467 /* Line 1806 of yacc.c */ 7475 7468 #line 1789 "parser.yy" 7476 { (yyval.en) = (yyvsp[(3) - (5)].en); }7477 break; 7478 7479 case 47 0:7469 { (yyval.en) = new ExpressionNode( build_range( (yyvsp[(3) - (7)].en), (yyvsp[(5) - (7)].en) ) ); } 7470 break; 7471 7472 case 471: 7480 7473 7481 7474 /* Line 1806 of yacc.c */ 7482 7475 #line 1791 "parser.yy" 7483 { (yyval.en) = new ExpressionNode( build_range( (yyvsp[(3) - (7)].en), (yyvsp[(5) - (7)].en) ) ); }7484 break;7485 7486 case 471:7487 7488 /* Line 1806 of yacc.c */7489 #line 1793 "parser.yy"7490 7476 { (yyval.en) = (yyvsp[(4) - (6)].en); } 7491 7477 break; … … 7494 7480 7495 7481 /* Line 1806 of yacc.c */ 7482 #line 1815 "parser.yy" 7483 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); } 7484 break; 7485 7486 case 474: 7487 7488 /* Line 1806 of yacc.c */ 7496 7489 #line 1817 "parser.yy" 7490 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 7491 break; 7492 7493 case 475: 7494 7495 /* Line 1806 of yacc.c */ 7496 #line 1819 "parser.yy" 7497 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); } 7498 break; 7499 7500 case 477: 7501 7502 /* Line 1806 of yacc.c */ 7503 #line 1825 "parser.yy" 7497 7504 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); } 7498 7505 break; 7499 7506 7500 case 47 4:7501 7502 /* Line 1806 of yacc.c */ 7503 #line 18 19"parser.yy"7507 case 478: 7508 7509 /* Line 1806 of yacc.c */ 7510 #line 1827 "parser.yy" 7504 7511 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 7505 7512 break; 7506 7513 7507 case 475:7508 7509 /* Line 1806 of yacc.c */7510 #line 1821 "parser.yy"7511 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); }7512 break;7513 7514 case 477:7515 7516 /* Line 1806 of yacc.c */7517 #line 1827 "parser.yy"7518 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }7519 break;7520 7521 case 478:7522 7523 /* Line 1806 of yacc.c */7524 #line 1829 "parser.yy"7525 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }7526 break;7527 7528 7514 case 479: 7529 7515 7530 7516 /* Line 1806 of yacc.c */ 7531 #line 183 4"parser.yy"7517 #line 1832 "parser.yy" 7532 7518 { (yyval.decl) = DeclarationNode::newFromTypeGen( (yyvsp[(1) - (4)].tok), (yyvsp[(3) - (4)].en) ); } 7533 7519 break; … … 7536 7522 7537 7523 /* Line 1806 of yacc.c */ 7538 #line 18 40"parser.yy"7524 #line 1838 "parser.yy" 7539 7525 { (yyval.decl) = (yyvsp[(1) - (4)].decl)->appendList( (yyvsp[(3) - (4)].decl) ); } 7540 7526 break; … … 7543 7529 7544 7530 /* Line 1806 of yacc.c */ 7531 #line 1843 "parser.yy" 7532 { typedefTable.addToEnclosingScope( *(yyvsp[(2) - (2)].tok), TypedefTable::TD ); } 7533 break; 7534 7535 case 483: 7536 7537 /* Line 1806 of yacc.c */ 7545 7538 #line 1845 "parser.yy" 7546 { typedefTable.addToEnclosingScope( *(yyvsp[(2) - (2)].tok), TypedefTable::TD ); }7547 break;7548 7549 case 483:7550 7551 /* Line 1806 of yacc.c */7552 #line 1847 "parser.yy"7553 7539 { (yyval.decl) = DeclarationNode::newTypeParam( (yyvsp[(1) - (4)].tclass), (yyvsp[(2) - (4)].tok) )->addAssertions( (yyvsp[(4) - (4)].decl) ); } 7554 7540 break; … … 7557 7543 7558 7544 /* Line 1806 of yacc.c */ 7545 #line 1851 "parser.yy" 7546 { (yyval.tclass) = DeclarationNode::Otype; } 7547 break; 7548 7549 case 486: 7550 7551 /* Line 1806 of yacc.c */ 7559 7552 #line 1853 "parser.yy" 7560 { (yyval.tclass) = DeclarationNode:: Otype; }7561 break; 7562 7563 case 48 6:7553 { (yyval.tclass) = DeclarationNode::Ftype; } 7554 break; 7555 7556 case 487: 7564 7557 7565 7558 /* Line 1806 of yacc.c */ 7566 7559 #line 1855 "parser.yy" 7567 { (yyval.tclass) = DeclarationNode::Ftype; }7568 break;7569 7570 case 487:7571 7572 /* Line 1806 of yacc.c */7573 #line 1857 "parser.yy"7574 7560 { (yyval.tclass) = DeclarationNode::Dtype; } 7575 7561 break; … … 7578 7564 7579 7565 /* Line 1806 of yacc.c */ 7566 #line 1860 "parser.yy" 7567 { (yyval.decl) = 0; } 7568 break; 7569 7570 case 489: 7571 7572 /* Line 1806 of yacc.c */ 7580 7573 #line 1862 "parser.yy" 7581 { (yyval.decl) = 0; }7582 break;7583 7584 case 489:7585 7586 /* Line 1806 of yacc.c */7587 #line 1864 "parser.yy"7588 7574 { (yyval.decl) = (yyvsp[(1) - (2)].decl) != 0 ? (yyvsp[(1) - (2)].decl)->appendList( (yyvsp[(2) - (2)].decl) ) : (yyvsp[(2) - (2)].decl); } 7589 7575 break; … … 7592 7578 7593 7579 /* Line 1806 of yacc.c */ 7594 #line 186 9"parser.yy"7580 #line 1867 "parser.yy" 7595 7581 { 7596 7582 typedefTable.openTrait( *(yyvsp[(2) - (5)].tok) ); … … 7602 7588 7603 7589 /* Line 1806 of yacc.c */ 7590 #line 1872 "parser.yy" 7591 { (yyval.decl) = (yyvsp[(4) - (5)].decl); } 7592 break; 7593 7594 case 492: 7595 7596 /* Line 1806 of yacc.c */ 7604 7597 #line 1874 "parser.yy" 7605 { (yyval.decl) = (yyvsp[(4) - (5)].decl); }7606 break;7607 7608 case 492:7609 7610 /* Line 1806 of yacc.c */7611 #line 1876 "parser.yy"7612 7598 { (yyval.decl) = 0; } 7613 7599 break; … … 7616 7602 7617 7603 /* Line 1806 of yacc.c */ 7618 #line 18 81"parser.yy"7604 #line 1879 "parser.yy" 7619 7605 { (yyval.en) = new ExpressionNode( build_typevalue( (yyvsp[(1) - (1)].decl) ) ); } 7620 7606 break; … … 7623 7609 7624 7610 /* Line 1806 of yacc.c */ 7611 #line 1882 "parser.yy" 7612 { (yyval.en) = (ExpressionNode *)( (yyvsp[(1) - (3)].en)->set_last( new ExpressionNode( build_typevalue( (yyvsp[(3) - (3)].decl) ) ) ) ); } 7613 break; 7614 7615 case 496: 7616 7617 /* Line 1806 of yacc.c */ 7625 7618 #line 1884 "parser.yy" 7626 { (yyval.en) = (ExpressionNode *)( (yyvsp[(1) - (3)].en)->set_last( new ExpressionNode( build_typevalue( (yyvsp[(3) - (3)].decl) ) ) ) ); }7627 break;7628 7629 case 496:7630 7631 /* Line 1806 of yacc.c */7632 #line 1886 "parser.yy"7633 7619 { (yyval.en) = (ExpressionNode *)( (yyvsp[(1) - (3)].en)->set_last( (yyvsp[(3) - (3)].en) )); } 7634 7620 break; … … 7637 7623 7638 7624 /* Line 1806 of yacc.c */ 7625 #line 1889 "parser.yy" 7626 { (yyval.decl) = (yyvsp[(2) - (2)].decl); } 7627 break; 7628 7629 case 498: 7630 7631 /* Line 1806 of yacc.c */ 7639 7632 #line 1891 "parser.yy" 7640 { (yyval.decl) = (yyvsp[( 2) - (2)].decl); }7641 break; 7642 7643 case 49 8:7633 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addQualifiers( (yyvsp[(1) - (3)].decl) ); } 7634 break; 7635 7636 case 499: 7644 7637 7645 7638 /* Line 1806 of yacc.c */ 7646 7639 #line 1893 "parser.yy" 7647 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addQualifiers( (yyvsp[(1) - (3)].decl) ); }7648 break;7649 7650 case 499:7651 7652 /* Line 1806 of yacc.c */7653 #line 1895 "parser.yy"7654 7640 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(3) - (3)].decl)->copyStorageClasses( (yyvsp[(1) - (3)].decl) ) ); } 7655 7641 break; … … 7658 7644 7659 7645 /* Line 1806 of yacc.c */ 7646 #line 1898 "parser.yy" 7647 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addAssertions( (yyvsp[(2) - (2)].decl) ); } 7648 break; 7649 7650 case 501: 7651 7652 /* Line 1806 of yacc.c */ 7660 7653 #line 1900 "parser.yy" 7661 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addAssertions( (yyvsp[(2) - (2)].decl) ); }7662 break;7663 7664 case 501:7665 7666 /* Line 1806 of yacc.c */7667 #line 1902 "parser.yy"7668 7654 { (yyval.decl) = (yyvsp[(1) - (4)].decl)->addAssertions( (yyvsp[(2) - (4)].decl) )->addType( (yyvsp[(4) - (4)].decl) ); } 7669 7655 break; … … 7672 7658 7673 7659 /* Line 1806 of yacc.c */ 7674 #line 190 7"parser.yy"7660 #line 1905 "parser.yy" 7675 7661 { 7676 7662 typedefTable.addToEnclosingScope( *(yyvsp[(1) - (1)].tok), TypedefTable::TD ); … … 7682 7668 7683 7669 /* Line 1806 of yacc.c */ 7684 #line 191 2"parser.yy"7670 #line 1910 "parser.yy" 7685 7671 { 7686 7672 typedefTable.addToEnclosingScope( *(yyvsp[(1) - (6)].tok), TypedefTable::TG ); … … 7692 7678 7693 7679 /* Line 1806 of yacc.c */ 7694 #line 19 20"parser.yy"7680 #line 1918 "parser.yy" 7695 7681 { 7696 7682 typedefTable.addToEnclosingScope( *(yyvsp[(2) - (9)].tok), TypedefTable::ID ); … … 7702 7688 7703 7689 /* Line 1806 of yacc.c */ 7704 #line 192 5"parser.yy"7690 #line 1923 "parser.yy" 7705 7691 { 7706 7692 typedefTable.enterTrait( *(yyvsp[(2) - (8)].tok) ); … … 7712 7698 7713 7699 /* Line 1806 of yacc.c */ 7714 #line 19 30"parser.yy"7700 #line 1928 "parser.yy" 7715 7701 { 7716 7702 typedefTable.leaveTrait(); … … 7723 7709 7724 7710 /* Line 1806 of yacc.c */ 7725 #line 19 40"parser.yy"7711 #line 1938 "parser.yy" 7726 7712 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(3) - (3)].decl) ); } 7727 7713 break; … … 7730 7716 7731 7717 /* Line 1806 of yacc.c */ 7732 #line 19 50"parser.yy"7718 #line 1948 "parser.yy" 7733 7719 { 7734 7720 typedefTable.addToEnclosingScope2( TypedefTable::ID ); … … 7740 7726 7741 7727 /* Line 1806 of yacc.c */ 7742 #line 195 5"parser.yy"7728 #line 1953 "parser.yy" 7743 7729 { 7744 7730 typedefTable.addToEnclosingScope2( TypedefTable::ID ); … … 7750 7736 7751 7737 /* Line 1806 of yacc.c */ 7752 #line 19 60"parser.yy"7738 #line 1958 "parser.yy" 7753 7739 { 7754 7740 typedefTable.addToEnclosingScope2( *(yyvsp[(5) - (5)].tok), TypedefTable::ID ); … … 7760 7746 7761 7747 /* Line 1806 of yacc.c */ 7762 #line 196 8"parser.yy"7748 #line 1966 "parser.yy" 7763 7749 { 7764 7750 typedefTable.addToEnclosingScope2( TypedefTable::ID ); … … 7770 7756 7771 7757 /* Line 1806 of yacc.c */ 7772 #line 197 3"parser.yy"7758 #line 1971 "parser.yy" 7773 7759 { 7774 7760 typedefTable.addToEnclosingScope2( TypedefTable::ID ); … … 7780 7766 7781 7767 /* Line 1806 of yacc.c */ 7768 #line 1981 "parser.yy" 7769 {} 7770 break; 7771 7772 case 517: 7773 7774 /* Line 1806 of yacc.c */ 7782 7775 #line 1983 "parser.yy" 7776 { parseTree = parseTree != nullptr ? parseTree->appendList( (yyvsp[(1) - (1)].decl) ) : (yyvsp[(1) - (1)].decl); } 7777 break; 7778 7779 case 519: 7780 7781 /* Line 1806 of yacc.c */ 7782 #line 1989 "parser.yy" 7783 { (yyval.decl) = (yyvsp[(1) - (3)].decl) != nullptr ? (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(3) - (3)].decl) ) : (yyvsp[(3) - (3)].decl); } 7784 break; 7785 7786 case 520: 7787 7788 /* Line 1806 of yacc.c */ 7789 #line 1994 "parser.yy" 7790 { (yyval.decl) = 0; } 7791 break; 7792 7793 case 524: 7794 7795 /* Line 1806 of yacc.c */ 7796 #line 2002 "parser.yy" 7783 7797 {} 7784 7798 break; 7785 7799 7786 case 517: 7787 7788 /* Line 1806 of yacc.c */ 7789 #line 1985 "parser.yy" 7790 { parseTree = parseTree != nullptr ? parseTree->appendList( (yyvsp[(1) - (1)].decl) ) : (yyvsp[(1) - (1)].decl); } 7791 break; 7792 7793 case 519: 7794 7795 /* Line 1806 of yacc.c */ 7796 #line 1991 "parser.yy" 7797 { (yyval.decl) = (yyvsp[(1) - (3)].decl) != nullptr ? (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(3) - (3)].decl) ) : (yyvsp[(3) - (3)].decl); } 7798 break; 7799 7800 case 520: 7801 7802 /* Line 1806 of yacc.c */ 7803 #line 1996 "parser.yy" 7804 { (yyval.decl) = 0; } 7805 break; 7806 7807 case 524: 7800 case 525: 7808 7801 7809 7802 /* Line 1806 of yacc.c */ 7810 7803 #line 2004 "parser.yy" 7811 {}7812 break;7813 7814 case 525:7815 7816 /* Line 1806 of yacc.c */7817 #line 2006 "parser.yy"7818 7804 { 7819 7805 linkageStack.push( linkage ); // handle nested extern "C"/"Cforall" … … 7825 7811 7826 7812 /* Line 1806 of yacc.c */ 7827 #line 20 11"parser.yy"7813 #line 2009 "parser.yy" 7828 7814 { 7829 7815 linkage = linkageStack.top(); … … 7836 7822 7837 7823 /* Line 1806 of yacc.c */ 7838 #line 201 7"parser.yy"7824 #line 2015 "parser.yy" 7839 7825 { // mark all fields in list 7840 7826 for ( DeclarationNode *iter = (yyvsp[(2) - (2)].decl); iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) … … 7847 7833 7848 7834 /* Line 1806 of yacc.c */ 7849 #line 203 2"parser.yy"7835 #line 2030 "parser.yy" 7850 7836 { 7851 7837 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 7858 7844 7859 7845 /* Line 1806 of yacc.c */ 7860 #line 203 8"parser.yy"7846 #line 2036 "parser.yy" 7861 7847 { 7862 7848 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 7869 7855 7870 7856 /* Line 1806 of yacc.c */ 7871 #line 204 7"parser.yy"7857 #line 2045 "parser.yy" 7872 7858 { 7873 7859 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 7880 7866 7881 7867 /* Line 1806 of yacc.c */ 7882 #line 205 3"parser.yy"7868 #line 2051 "parser.yy" 7883 7869 { 7884 7870 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 7891 7877 7892 7878 /* Line 1806 of yacc.c */ 7893 #line 205 9"parser.yy"7879 #line 2057 "parser.yy" 7894 7880 { 7895 7881 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 7902 7888 7903 7889 /* Line 1806 of yacc.c */ 7904 #line 206 5"parser.yy"7890 #line 2063 "parser.yy" 7905 7891 { 7906 7892 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 7913 7899 7914 7900 /* Line 1806 of yacc.c */ 7915 #line 20 71"parser.yy"7901 #line 2069 "parser.yy" 7916 7902 { 7917 7903 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 7924 7910 7925 7911 /* Line 1806 of yacc.c */ 7926 #line 207 9"parser.yy"7912 #line 2077 "parser.yy" 7927 7913 { 7928 7914 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 7935 7921 7936 7922 /* Line 1806 of yacc.c */ 7937 #line 208 5"parser.yy"7923 #line 2083 "parser.yy" 7938 7924 { 7939 7925 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 7946 7932 7947 7933 /* Line 1806 of yacc.c */ 7948 #line 209 3"parser.yy"7934 #line 2091 "parser.yy" 7949 7935 { 7950 7936 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 7957 7943 7958 7944 /* Line 1806 of yacc.c */ 7959 #line 209 9"parser.yy"7945 #line 2097 "parser.yy" 7960 7946 { 7961 7947 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 7968 7954 7969 7955 /* Line 1806 of yacc.c */ 7970 #line 211 4"parser.yy"7956 #line 2112 "parser.yy" 7971 7957 { (yyval.en) = new ExpressionNode( build_range( (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); } 7972 7958 break; … … 7975 7961 7976 7962 /* Line 1806 of yacc.c */ 7977 #line 211 9"parser.yy"7963 #line 2117 "parser.yy" 7978 7964 { delete (yyvsp[(3) - (5)].str); } 7979 7965 break; … … 7982 7968 7983 7969 /* Line 1806 of yacc.c */ 7984 #line 212 4"parser.yy"7970 #line 2122 "parser.yy" 7985 7971 { (yyval.decl) = 0; } 7986 7972 break; … … 7989 7975 7990 7976 /* Line 1806 of yacc.c */ 7991 #line 21 31"parser.yy"7977 #line 2129 "parser.yy" 7992 7978 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); } 7993 7979 break; … … 7996 7982 7997 7983 /* Line 1806 of yacc.c */ 7998 #line 213 7"parser.yy"7984 #line 2135 "parser.yy" 7999 7985 { (yyval.decl) = 0; } 8000 7986 break; … … 8003 7989 8004 7990 /* Line 1806 of yacc.c */ 8005 #line 214 8"parser.yy"7991 #line 2146 "parser.yy" 8006 7992 { delete (yyvsp[(3) - (4)].en); } 8007 7993 break; … … 8010 7996 8011 7997 /* Line 1806 of yacc.c */ 7998 #line 2150 "parser.yy" 7999 { delete (yyvsp[(1) - (1)].tok); } 8000 break; 8001 8002 case 557: 8003 8004 /* Line 1806 of yacc.c */ 8005 #line 2151 "parser.yy" 8006 { delete (yyvsp[(1) - (1)].decl); } 8007 break; 8008 8009 case 558: 8010 8011 /* Line 1806 of yacc.c */ 8012 8012 #line 2152 "parser.yy" 8013 { delete (yyvsp[(1) - (1)]. tok); }8014 break; 8015 8016 case 55 7:8013 { delete (yyvsp[(1) - (1)].decl); } 8014 break; 8015 8016 case 559: 8017 8017 8018 8018 /* Line 1806 of yacc.c */ … … 8021 8021 break; 8022 8022 8023 case 558:8024 8025 /* Line 1806 of yacc.c */8026 #line 2154 "parser.yy"8027 { delete (yyvsp[(1) - (1)].decl); }8028 break;8029 8030 case 559:8031 8032 /* Line 1806 of yacc.c */8033 #line 2155 "parser.yy"8034 { delete (yyvsp[(1) - (1)].decl); }8035 break;8036 8037 8023 case 560: 8038 8024 8039 8025 /* Line 1806 of yacc.c */ 8040 #line 21 90"parser.yy"8026 #line 2188 "parser.yy" 8041 8027 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8042 8028 break; 8043 8029 8044 8030 case 562: 8031 8032 /* Line 1806 of yacc.c */ 8033 #line 2191 "parser.yy" 8034 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8035 break; 8036 8037 case 563: 8045 8038 8046 8039 /* Line 1806 of yacc.c */ … … 8049 8042 break; 8050 8043 8051 case 563:8052 8053 /* Line 1806 of yacc.c */8054 #line 2195 "parser.yy"8055 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }8056 break;8057 8058 8044 case 564: 8059 8045 8060 8046 /* Line 1806 of yacc.c */ 8061 #line 2 200"parser.yy"8047 #line 2198 "parser.yy" 8062 8048 { 8063 8049 typedefTable.setNextIdentifier( *(yyvsp[(1) - (1)].tok) ); … … 8069 8055 8070 8056 /* Line 1806 of yacc.c */ 8071 #line 220 5"parser.yy"8057 #line 2203 "parser.yy" 8072 8058 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8073 8059 break; … … 8076 8062 8077 8063 /* Line 1806 of yacc.c */ 8064 #line 2208 "parser.yy" 8065 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 8066 break; 8067 8068 case 567: 8069 8070 /* Line 1806 of yacc.c */ 8078 8071 #line 2210 "parser.yy" 8079 { (yyval.decl) = (yyvsp[( 2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0) ); }8080 break; 8081 8082 case 56 7:8072 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); } 8073 break; 8074 8075 case 568: 8083 8076 8084 8077 /* Line 1806 of yacc.c */ 8085 8078 #line 2212 "parser.yy" 8086 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }8087 break;8088 8089 case 568:8090 8091 /* Line 1806 of yacc.c */8092 #line 2214 "parser.yy"8093 8079 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8094 8080 break; … … 8097 8083 8098 8084 /* Line 1806 of yacc.c */ 8085 #line 2217 "parser.yy" 8086 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); } 8087 break; 8088 8089 case 570: 8090 8091 /* Line 1806 of yacc.c */ 8099 8092 #line 2219 "parser.yy" 8100 { (yyval.decl) = (yyvsp[( 1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); }8101 break; 8102 8103 case 57 0:8093 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8094 break; 8095 8096 case 571: 8104 8097 8105 8098 /* Line 1806 of yacc.c */ … … 8108 8101 break; 8109 8102 8110 case 57 1:8103 case 572: 8111 8104 8112 8105 /* Line 1806 of yacc.c */ 8113 8106 #line 2223 "parser.yy" 8107 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8108 break; 8109 8110 case 573: 8111 8112 /* Line 1806 of yacc.c */ 8113 #line 2228 "parser.yy" 8114 { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); } 8115 break; 8116 8117 case 574: 8118 8119 /* Line 1806 of yacc.c */ 8120 #line 2230 "parser.yy" 8121 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8122 break; 8123 8124 case 575: 8125 8126 /* Line 1806 of yacc.c */ 8127 #line 2239 "parser.yy" 8128 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8129 break; 8130 8131 case 577: 8132 8133 /* Line 1806 of yacc.c */ 8134 #line 2242 "parser.yy" 8135 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8136 break; 8137 8138 case 578: 8139 8140 /* Line 1806 of yacc.c */ 8141 #line 2247 "parser.yy" 8142 { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addParamList( (yyvsp[(4) - (6)].decl) ); } 8143 break; 8144 8145 case 579: 8146 8147 /* Line 1806 of yacc.c */ 8148 #line 2249 "parser.yy" 8149 { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); } 8150 break; 8151 8152 case 580: 8153 8154 /* Line 1806 of yacc.c */ 8155 #line 2251 "parser.yy" 8156 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8157 break; 8158 8159 case 581: 8160 8161 /* Line 1806 of yacc.c */ 8162 #line 2256 "parser.yy" 8163 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 8164 break; 8165 8166 case 582: 8167 8168 /* Line 1806 of yacc.c */ 8169 #line 2258 "parser.yy" 8170 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); } 8171 break; 8172 8173 case 583: 8174 8175 /* Line 1806 of yacc.c */ 8176 #line 2260 "parser.yy" 8177 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8178 break; 8179 8180 case 584: 8181 8182 /* Line 1806 of yacc.c */ 8183 #line 2265 "parser.yy" 8114 8184 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8115 8185 break; 8116 8186 8117 case 572: 8118 8119 /* Line 1806 of yacc.c */ 8120 #line 2225 "parser.yy" 8121 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8122 break; 8123 8124 case 573: 8125 8126 /* Line 1806 of yacc.c */ 8127 #line 2230 "parser.yy" 8128 { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); } 8129 break; 8130 8131 case 574: 8132 8133 /* Line 1806 of yacc.c */ 8134 #line 2232 "parser.yy" 8135 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8136 break; 8137 8138 case 575: 8139 8140 /* Line 1806 of yacc.c */ 8141 #line 2241 "parser.yy" 8142 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8143 break; 8144 8145 case 577: 8146 8147 /* Line 1806 of yacc.c */ 8148 #line 2244 "parser.yy" 8149 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8150 break; 8151 8152 case 578: 8153 8154 /* Line 1806 of yacc.c */ 8155 #line 2249 "parser.yy" 8156 { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addParamList( (yyvsp[(4) - (6)].decl) ); } 8157 break; 8158 8159 case 579: 8160 8161 /* Line 1806 of yacc.c */ 8162 #line 2251 "parser.yy" 8163 { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); } 8164 break; 8165 8166 case 580: 8167 8168 /* Line 1806 of yacc.c */ 8169 #line 2253 "parser.yy" 8170 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8171 break; 8172 8173 case 581: 8174 8175 /* Line 1806 of yacc.c */ 8176 #line 2258 "parser.yy" 8177 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 8178 break; 8179 8180 case 582: 8181 8182 /* Line 1806 of yacc.c */ 8183 #line 2260 "parser.yy" 8184 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); } 8185 break; 8186 8187 case 583: 8188 8189 /* Line 1806 of yacc.c */ 8190 #line 2262 "parser.yy" 8191 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8192 break; 8193 8194 case 584: 8187 case 585: 8195 8188 8196 8189 /* Line 1806 of yacc.c */ … … 8199 8192 break; 8200 8193 8201 case 58 5:8194 case 586: 8202 8195 8203 8196 /* Line 1806 of yacc.c */ 8204 8197 #line 2269 "parser.yy" 8198 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8199 break; 8200 8201 case 590: 8202 8203 /* Line 1806 of yacc.c */ 8204 #line 2284 "parser.yy" 8205 { (yyval.decl) = (yyvsp[(1) - (4)].decl)->addIdList( (yyvsp[(3) - (4)].decl) ); } 8206 break; 8207 8208 case 591: 8209 8210 /* Line 1806 of yacc.c */ 8211 #line 2286 "parser.yy" 8212 { (yyval.decl) = (yyvsp[(2) - (6)].decl)->addIdList( (yyvsp[(5) - (6)].decl) ); } 8213 break; 8214 8215 case 592: 8216 8217 /* Line 1806 of yacc.c */ 8218 #line 2288 "parser.yy" 8219 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8220 break; 8221 8222 case 593: 8223 8224 /* Line 1806 of yacc.c */ 8225 #line 2293 "parser.yy" 8226 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 8227 break; 8228 8229 case 594: 8230 8231 /* Line 1806 of yacc.c */ 8232 #line 2295 "parser.yy" 8233 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); } 8234 break; 8235 8236 case 595: 8237 8238 /* Line 1806 of yacc.c */ 8239 #line 2297 "parser.yy" 8240 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8241 break; 8242 8243 case 596: 8244 8245 /* Line 1806 of yacc.c */ 8246 #line 2302 "parser.yy" 8205 8247 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8206 8248 break; 8207 8249 8208 case 586: 8209 8210 /* Line 1806 of yacc.c */ 8211 #line 2271 "parser.yy" 8212 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8213 break; 8214 8215 case 590: 8216 8217 /* Line 1806 of yacc.c */ 8218 #line 2286 "parser.yy" 8219 { (yyval.decl) = (yyvsp[(1) - (4)].decl)->addIdList( (yyvsp[(3) - (4)].decl) ); } 8220 break; 8221 8222 case 591: 8223 8224 /* Line 1806 of yacc.c */ 8225 #line 2288 "parser.yy" 8226 { (yyval.decl) = (yyvsp[(2) - (6)].decl)->addIdList( (yyvsp[(5) - (6)].decl) ); } 8227 break; 8228 8229 case 592: 8230 8231 /* Line 1806 of yacc.c */ 8232 #line 2290 "parser.yy" 8233 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8234 break; 8235 8236 case 593: 8237 8238 /* Line 1806 of yacc.c */ 8239 #line 2295 "parser.yy" 8240 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 8241 break; 8242 8243 case 594: 8244 8245 /* Line 1806 of yacc.c */ 8246 #line 2297 "parser.yy" 8247 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); } 8248 break; 8249 8250 case 595: 8251 8252 /* Line 1806 of yacc.c */ 8253 #line 2299 "parser.yy" 8254 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8255 break; 8256 8257 case 596: 8250 case 597: 8258 8251 8259 8252 /* Line 1806 of yacc.c */ … … 8262 8255 break; 8263 8256 8264 case 59 7:8257 case 598: 8265 8258 8266 8259 /* Line 1806 of yacc.c */ 8267 8260 #line 2306 "parser.yy" 8268 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }8269 break;8270 8271 case 598:8272 8273 /* Line 1806 of yacc.c */8274 #line 2308 "parser.yy"8275 8261 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8276 8262 break; … … 8279 8265 8280 8266 /* Line 1806 of yacc.c */ 8281 #line 232 3"parser.yy"8267 #line 2321 "parser.yy" 8282 8268 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8283 8269 break; 8284 8270 8285 8271 case 601: 8272 8273 /* Line 1806 of yacc.c */ 8274 #line 2324 "parser.yy" 8275 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8276 break; 8277 8278 case 602: 8286 8279 8287 8280 /* Line 1806 of yacc.c */ … … 8290 8283 break; 8291 8284 8292 case 602:8293 8294 /* Line 1806 of yacc.c */8295 #line 2328 "parser.yy"8296 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }8297 break;8298 8299 8285 case 604: 8300 8286 8301 8287 /* Line 1806 of yacc.c */ 8302 #line 233 4"parser.yy"8288 #line 2332 "parser.yy" 8303 8289 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8304 8290 break; … … 8307 8293 8308 8294 /* Line 1806 of yacc.c */ 8295 #line 2337 "parser.yy" 8296 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 8297 break; 8298 8299 case 606: 8300 8301 /* Line 1806 of yacc.c */ 8309 8302 #line 2339 "parser.yy" 8310 { (yyval.decl) = (yyvsp[( 2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0) ); }8311 break; 8312 8313 case 60 6:8303 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); } 8304 break; 8305 8306 case 607: 8314 8307 8315 8308 /* Line 1806 of yacc.c */ 8316 8309 #line 2341 "parser.yy" 8317 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }8318 break;8319 8320 case 607:8321 8322 /* Line 1806 of yacc.c */8323 #line 2343 "parser.yy"8324 8310 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8325 8311 break; … … 8328 8314 8329 8315 /* Line 1806 of yacc.c */ 8316 #line 2346 "parser.yy" 8317 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); } 8318 break; 8319 8320 case 609: 8321 8322 /* Line 1806 of yacc.c */ 8330 8323 #line 2348 "parser.yy" 8331 { (yyval.decl) = (yyvsp[( 1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); }8332 break; 8333 8334 case 6 09:8324 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8325 break; 8326 8327 case 610: 8335 8328 8336 8329 /* Line 1806 of yacc.c */ … … 8339 8332 break; 8340 8333 8341 case 61 0:8334 case 611: 8342 8335 8343 8336 /* Line 1806 of yacc.c */ 8344 8337 #line 2352 "parser.yy" 8345 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }8346 break;8347 8348 case 611:8349 8350 /* Line 1806 of yacc.c */8351 #line 2354 "parser.yy"8352 8338 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8353 8339 break; … … 8356 8342 8357 8343 /* Line 1806 of yacc.c */ 8344 #line 2357 "parser.yy" 8345 { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addParamList( (yyvsp[(4) - (6)].decl) ); } 8346 break; 8347 8348 case 613: 8349 8350 /* Line 1806 of yacc.c */ 8358 8351 #line 2359 "parser.yy" 8359 { (yyval.decl) = (yyvsp[( 1) - (6)].decl)->addParamList( (yyvsp[(4) - (6)].decl) ); }8360 break; 8361 8362 case 61 3:8352 { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); } 8353 break; 8354 8355 case 614: 8363 8356 8364 8357 /* Line 1806 of yacc.c */ 8365 8358 #line 2361 "parser.yy" 8366 { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }8367 break;8368 8369 case 614:8370 8371 /* Line 1806 of yacc.c */8372 #line 2363 "parser.yy"8373 8359 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8374 8360 break; … … 8377 8363 8378 8364 /* Line 1806 of yacc.c */ 8379 #line 237 3"parser.yy"8365 #line 2371 "parser.yy" 8380 8366 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8381 8367 break; 8382 8368 8383 8369 case 617: 8370 8371 /* Line 1806 of yacc.c */ 8372 #line 2374 "parser.yy" 8373 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8374 break; 8375 8376 case 618: 8384 8377 8385 8378 /* Line 1806 of yacc.c */ … … 8388 8381 break; 8389 8382 8390 case 618:8391 8392 /* Line 1806 of yacc.c */8393 #line 2378 "parser.yy"8394 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }8395 break;8396 8397 8383 case 619: 8398 8384 8399 8385 /* Line 1806 of yacc.c */ 8386 #line 2381 "parser.yy" 8387 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 8388 break; 8389 8390 case 620: 8391 8392 /* Line 1806 of yacc.c */ 8400 8393 #line 2383 "parser.yy" 8401 { (yyval.decl) = (yyvsp[( 2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0) ); }8402 break; 8403 8404 case 62 0:8394 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); } 8395 break; 8396 8397 case 621: 8405 8398 8406 8399 /* Line 1806 of yacc.c */ 8407 8400 #line 2385 "parser.yy" 8408 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }8409 break;8410 8411 case 621:8412 8413 /* Line 1806 of yacc.c */8414 #line 2387 "parser.yy"8415 8401 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8416 8402 break; … … 8419 8405 8420 8406 /* Line 1806 of yacc.c */ 8407 #line 2390 "parser.yy" 8408 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); } 8409 break; 8410 8411 case 623: 8412 8413 /* Line 1806 of yacc.c */ 8421 8414 #line 2392 "parser.yy" 8422 { (yyval.decl) = (yyvsp[( 1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); }8423 break; 8424 8425 case 62 3:8415 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8416 break; 8417 8418 case 624: 8426 8419 8427 8420 /* Line 1806 of yacc.c */ … … 8430 8423 break; 8431 8424 8432 case 62 4:8425 case 625: 8433 8426 8434 8427 /* Line 1806 of yacc.c */ 8435 8428 #line 2396 "parser.yy" 8436 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }8437 break;8438 8439 case 625:8440 8441 /* Line 1806 of yacc.c */8442 #line 2398 "parser.yy"8443 8429 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8444 8430 break; … … 8447 8433 8448 8434 /* Line 1806 of yacc.c */ 8435 #line 2401 "parser.yy" 8436 { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addParamList( (yyvsp[(4) - (6)].decl) ); } 8437 break; 8438 8439 case 627: 8440 8441 /* Line 1806 of yacc.c */ 8449 8442 #line 2403 "parser.yy" 8450 { (yyval.decl) = (yyvsp[( 1) - (6)].decl)->addParamList( (yyvsp[(4) - (6)].decl) ); }8451 break; 8452 8453 case 62 7:8443 { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); } 8444 break; 8445 8446 case 628: 8454 8447 8455 8448 /* Line 1806 of yacc.c */ 8456 8449 #line 2405 "parser.yy" 8457 { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }8458 break;8459 8460 case 628:8461 8462 /* Line 1806 of yacc.c */8463 #line 2407 "parser.yy"8464 8450 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8465 8451 break; … … 8468 8454 8469 8455 /* Line 1806 of yacc.c */ 8470 #line 243 8"parser.yy"8456 #line 2436 "parser.yy" 8471 8457 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8472 8458 break; 8473 8459 8474 8460 case 631: 8461 8462 /* Line 1806 of yacc.c */ 8463 #line 2439 "parser.yy" 8464 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8465 break; 8466 8467 case 632: 8475 8468 8476 8469 /* Line 1806 of yacc.c */ … … 8479 8472 break; 8480 8473 8481 case 632:8482 8483 /* Line 1806 of yacc.c */8484 #line 2443 "parser.yy"8485 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }8486 break;8487 8488 8474 case 633: 8489 8475 8490 8476 /* Line 1806 of yacc.c */ 8491 #line 244 8"parser.yy"8477 #line 2446 "parser.yy" 8492 8478 { 8493 8479 typedefTable.setNextIdentifier( *(yyvsp[(1) - (1)].tok) ); … … 8499 8485 8500 8486 /* Line 1806 of yacc.c */ 8501 #line 245 3"parser.yy"8487 #line 2451 "parser.yy" 8502 8488 { 8503 8489 typedefTable.setNextIdentifier( *(yyvsp[(1) - (1)].tok) ); … … 8509 8495 8510 8496 /* Line 1806 of yacc.c */ 8497 #line 2459 "parser.yy" 8498 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 8499 break; 8500 8501 case 636: 8502 8503 /* Line 1806 of yacc.c */ 8511 8504 #line 2461 "parser.yy" 8512 { (yyval.decl) = (yyvsp[( 2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0) ); }8513 break; 8514 8515 case 63 6:8505 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); } 8506 break; 8507 8508 case 637: 8516 8509 8517 8510 /* Line 1806 of yacc.c */ 8518 8511 #line 2463 "parser.yy" 8519 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }8520 break;8521 8522 case 637:8523 8524 /* Line 1806 of yacc.c */8525 #line 2465 "parser.yy"8526 8512 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8527 8513 break; … … 8530 8516 8531 8517 /* Line 1806 of yacc.c */ 8518 #line 2468 "parser.yy" 8519 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); } 8520 break; 8521 8522 case 639: 8523 8524 /* Line 1806 of yacc.c */ 8532 8525 #line 2470 "parser.yy" 8533 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); }8534 break;8535 8536 case 639:8537 8538 /* Line 1806 of yacc.c */8539 #line 2472 "parser.yy"8540 8526 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8541 8527 break; … … 8544 8530 8545 8531 /* Line 1806 of yacc.c */ 8532 #line 2475 "parser.yy" 8533 { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addParamList( (yyvsp[(4) - (6)].decl) ); } 8534 break; 8535 8536 case 641: 8537 8538 /* Line 1806 of yacc.c */ 8546 8539 #line 2477 "parser.yy" 8547 { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addParamList( (yyvsp[(4) - (6)].decl) ); }8548 break;8549 8550 case 641:8551 8552 /* Line 1806 of yacc.c */8553 #line 2479 "parser.yy"8554 8540 { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); } 8555 8541 break; 8556 8542 8557 8543 case 643: 8544 8545 /* Line 1806 of yacc.c */ 8546 #line 2492 "parser.yy" 8547 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8548 break; 8549 8550 case 644: 8558 8551 8559 8552 /* Line 1806 of yacc.c */ … … 8562 8555 break; 8563 8556 8564 case 644:8565 8566 /* Line 1806 of yacc.c */8567 #line 2496 "parser.yy"8568 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }8569 break;8570 8571 8557 case 645: 8572 8558 8573 8559 /* Line 1806 of yacc.c */ 8560 #line 2499 "parser.yy" 8561 { (yyval.decl) = DeclarationNode::newPointer( 0 ); } 8562 break; 8563 8564 case 646: 8565 8566 /* Line 1806 of yacc.c */ 8574 8567 #line 2501 "parser.yy" 8575 { (yyval.decl) = DeclarationNode::newPointer( 0); }8576 break; 8577 8578 case 64 6:8568 { (yyval.decl) = DeclarationNode::newPointer( (yyvsp[(2) - (2)].decl) ); } 8569 break; 8570 8571 case 647: 8579 8572 8580 8573 /* Line 1806 of yacc.c */ 8581 8574 #line 2503 "parser.yy" 8582 { (yyval.decl) = DeclarationNode::newPointer( (yyvsp[(2) - (2)].decl) ); }8583 break; 8584 8585 case 64 7:8575 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 8576 break; 8577 8578 case 648: 8586 8579 8587 8580 /* Line 1806 of yacc.c */ 8588 8581 #line 2505 "parser.yy" 8589 { (yyval.decl) = (yyvsp[( 2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0) ); }8590 break; 8591 8592 case 64 8:8582 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); } 8583 break; 8584 8585 case 649: 8593 8586 8594 8587 /* Line 1806 of yacc.c */ 8595 8588 #line 2507 "parser.yy" 8596 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }8597 break;8598 8599 case 649:8600 8601 /* Line 1806 of yacc.c */8602 #line 2509 "parser.yy"8603 8589 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8604 8590 break; 8605 8591 8606 8592 case 651: 8593 8594 /* Line 1806 of yacc.c */ 8595 #line 2513 "parser.yy" 8596 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8597 break; 8598 8599 case 652: 8607 8600 8608 8601 /* Line 1806 of yacc.c */ … … 8611 8604 break; 8612 8605 8613 case 65 2:8606 case 653: 8614 8607 8615 8608 /* Line 1806 of yacc.c */ 8616 8609 #line 2517 "parser.yy" 8617 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }8618 break;8619 8620 case 653:8621 8622 /* Line 1806 of yacc.c */8623 #line 2519 "parser.yy"8624 8610 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8625 8611 break; … … 8628 8614 8629 8615 /* Line 1806 of yacc.c */ 8616 #line 2522 "parser.yy" 8617 { (yyval.decl) = DeclarationNode::newFunction( 0, 0, (yyvsp[(3) - (5)].decl), 0 ); } 8618 break; 8619 8620 case 655: 8621 8622 /* Line 1806 of yacc.c */ 8630 8623 #line 2524 "parser.yy" 8631 { (yyval.decl) = DeclarationNode::newFunction( 0, 0, (yyvsp[(3) - (5)].decl), 0); }8632 break; 8633 8634 case 65 5:8624 { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); } 8625 break; 8626 8627 case 656: 8635 8628 8636 8629 /* Line 1806 of yacc.c */ 8637 8630 #line 2526 "parser.yy" 8638 { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }8639 break;8640 8641 case 656:8642 8643 /* Line 1806 of yacc.c */8644 #line 2528 "parser.yy"8645 8631 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8646 8632 break; … … 8649 8635 8650 8636 /* Line 1806 of yacc.c */ 8637 #line 2532 "parser.yy" 8638 { (yyval.decl) = DeclarationNode::newArray( 0, 0, false ); } 8639 break; 8640 8641 case 658: 8642 8643 /* Line 1806 of yacc.c */ 8651 8644 #line 2534 "parser.yy" 8652 { (yyval.decl) = DeclarationNode::newArray( 0, 0, false ); }8653 break;8654 8655 case 658:8656 8657 /* Line 1806 of yacc.c */8658 #line 2536 "parser.yy"8659 8645 { (yyval.decl) = DeclarationNode::newArray( 0, 0, false )->addArray( (yyvsp[(3) - (3)].decl) ); } 8660 8646 break; … … 8663 8649 8664 8650 /* Line 1806 of yacc.c */ 8651 #line 2540 "parser.yy" 8652 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(3) - (5)].en), 0, false ); } 8653 break; 8654 8655 case 661: 8656 8657 /* Line 1806 of yacc.c */ 8665 8658 #line 2542 "parser.yy" 8666 { (yyval.decl) = DeclarationNode::new Array( (yyvsp[(3) - (5)].en), 0, false); }8667 break; 8668 8669 case 66 1:8659 { (yyval.decl) = DeclarationNode::newVarArray( 0 ); } 8660 break; 8661 8662 case 662: 8670 8663 8671 8664 /* Line 1806 of yacc.c */ 8672 8665 #line 2544 "parser.yy" 8673 { (yyval.decl) = DeclarationNode::newVarArray( 0); }8674 break; 8675 8676 case 66 2:8666 { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addArray( DeclarationNode::newArray( (yyvsp[(4) - (6)].en), 0, false ) ); } 8667 break; 8668 8669 case 663: 8677 8670 8678 8671 /* Line 1806 of yacc.c */ 8679 8672 #line 2546 "parser.yy" 8680 { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addArray( DeclarationNode::newArray( (yyvsp[(4) - (6)].en), 0, false ) ); }8681 break;8682 8683 case 663:8684 8685 /* Line 1806 of yacc.c */8686 #line 2548 "parser.yy"8687 8673 { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addArray( DeclarationNode::newVarArray( 0 ) ); } 8688 8674 break; 8689 8675 8690 8676 case 665: 8677 8678 /* Line 1806 of yacc.c */ 8679 #line 2561 "parser.yy" 8680 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8681 break; 8682 8683 case 666: 8691 8684 8692 8685 /* Line 1806 of yacc.c */ … … 8695 8688 break; 8696 8689 8697 case 666:8698 8699 /* Line 1806 of yacc.c */8700 #line 2565 "parser.yy"8701 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }8702 break;8703 8704 8690 case 667: 8705 8691 8706 8692 /* Line 1806 of yacc.c */ 8693 #line 2568 "parser.yy" 8694 { (yyval.decl) = DeclarationNode::newPointer( 0 ); } 8695 break; 8696 8697 case 668: 8698 8699 /* Line 1806 of yacc.c */ 8707 8700 #line 2570 "parser.yy" 8708 { (yyval.decl) = DeclarationNode::newPointer( 0); }8709 break; 8710 8711 case 66 8:8701 { (yyval.decl) = DeclarationNode::newPointer( (yyvsp[(2) - (2)].decl) ); } 8702 break; 8703 8704 case 669: 8712 8705 8713 8706 /* Line 1806 of yacc.c */ 8714 8707 #line 2572 "parser.yy" 8715 { (yyval.decl) = DeclarationNode::newPointer( (yyvsp[(2) - (2)].decl) ); }8716 break; 8717 8718 case 6 69:8708 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 8709 break; 8710 8711 case 670: 8719 8712 8720 8713 /* Line 1806 of yacc.c */ 8721 8714 #line 2574 "parser.yy" 8722 { (yyval.decl) = (yyvsp[( 2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0) ); }8723 break; 8724 8725 case 67 0:8715 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); } 8716 break; 8717 8718 case 671: 8726 8719 8727 8720 /* Line 1806 of yacc.c */ 8728 8721 #line 2576 "parser.yy" 8729 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }8730 break;8731 8732 case 671:8733 8734 /* Line 1806 of yacc.c */8735 #line 2578 "parser.yy"8736 8722 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8737 8723 break; 8738 8724 8739 8725 case 673: 8726 8727 /* Line 1806 of yacc.c */ 8728 #line 2582 "parser.yy" 8729 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8730 break; 8731 8732 case 674: 8740 8733 8741 8734 /* Line 1806 of yacc.c */ … … 8744 8737 break; 8745 8738 8746 case 67 4:8739 case 675: 8747 8740 8748 8741 /* Line 1806 of yacc.c */ 8749 8742 #line 2586 "parser.yy" 8750 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }8751 break;8752 8753 case 675:8754 8755 /* Line 1806 of yacc.c */8756 #line 2588 "parser.yy"8757 8743 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8758 8744 break; … … 8761 8747 8762 8748 /* Line 1806 of yacc.c */ 8749 #line 2591 "parser.yy" 8750 { (yyval.decl) = DeclarationNode::newFunction( 0, 0, (yyvsp[(3) - (5)].decl), 0 ); } 8751 break; 8752 8753 case 677: 8754 8755 /* Line 1806 of yacc.c */ 8763 8756 #line 2593 "parser.yy" 8764 { (yyval.decl) = DeclarationNode::newFunction( 0, 0, (yyvsp[(3) - (5)].decl), 0); }8765 break; 8766 8767 case 67 7:8757 { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); } 8758 break; 8759 8760 case 678: 8768 8761 8769 8762 /* Line 1806 of yacc.c */ 8770 8763 #line 2595 "parser.yy" 8771 { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }8772 break;8773 8774 case 678:8775 8776 /* Line 1806 of yacc.c */8777 #line 2597 "parser.yy"8778 8764 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8779 8765 break; … … 8782 8768 8783 8769 /* Line 1806 of yacc.c */ 8784 #line 260 4"parser.yy"8770 #line 2602 "parser.yy" 8785 8771 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); } 8786 8772 break; … … 8789 8775 8790 8776 /* Line 1806 of yacc.c */ 8791 #line 261 5"parser.yy"8777 #line 2613 "parser.yy" 8792 8778 { (yyval.decl) = DeclarationNode::newArray( 0, 0, false ); } 8793 8779 break; … … 8796 8782 8797 8783 /* Line 1806 of yacc.c */ 8784 #line 2616 "parser.yy" 8785 { (yyval.decl) = DeclarationNode::newVarArray( (yyvsp[(3) - (6)].decl) ); } 8786 break; 8787 8788 case 684: 8789 8790 /* Line 1806 of yacc.c */ 8798 8791 #line 2618 "parser.yy" 8799 { (yyval.decl) = DeclarationNode::newVarArray( (yyvsp[(3) - (6)].decl) ); }8800 break;8801 8802 case 684:8803 8804 /* Line 1806 of yacc.c */8805 #line 2620 "parser.yy"8806 8792 { (yyval.decl) = DeclarationNode::newArray( 0, (yyvsp[(3) - (5)].decl), false ); } 8807 8793 break; … … 8810 8796 8811 8797 /* Line 1806 of yacc.c */ 8798 #line 2621 "parser.yy" 8799 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(4) - (6)].en), (yyvsp[(3) - (6)].decl), false ); } 8800 break; 8801 8802 case 686: 8803 8804 /* Line 1806 of yacc.c */ 8812 8805 #line 2623 "parser.yy" 8813 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[( 4) - (6)].en), (yyvsp[(3) - (6)].decl), false ); }8814 break; 8815 8816 case 68 6:8806 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(5) - (7)].en), (yyvsp[(4) - (7)].decl), true ); } 8807 break; 8808 8809 case 687: 8817 8810 8818 8811 /* Line 1806 of yacc.c */ 8819 8812 #line 2625 "parser.yy" 8820 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(5) - (7)].en), (yyvsp[(4) - (7)].decl), true ); }8821 break;8822 8823 case 687:8824 8825 /* Line 1806 of yacc.c */8826 #line 2627 "parser.yy"8827 8813 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(5) - (7)].en), (yyvsp[(3) - (7)].decl), true ); } 8828 8814 break; 8829 8815 8830 8816 case 689: 8817 8818 /* Line 1806 of yacc.c */ 8819 #line 2639 "parser.yy" 8820 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8821 break; 8822 8823 case 690: 8831 8824 8832 8825 /* Line 1806 of yacc.c */ … … 8835 8828 break; 8836 8829 8837 case 690:8838 8839 /* Line 1806 of yacc.c */8840 #line 2643 "parser.yy"8841 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }8842 break;8843 8844 8830 case 691: 8845 8831 8846 8832 /* Line 1806 of yacc.c */ 8833 #line 2646 "parser.yy" 8834 { (yyval.decl) = DeclarationNode::newPointer( 0 ); } 8835 break; 8836 8837 case 692: 8838 8839 /* Line 1806 of yacc.c */ 8847 8840 #line 2648 "parser.yy" 8848 { (yyval.decl) = DeclarationNode::newPointer( 0); }8849 break; 8850 8851 case 69 2:8841 { (yyval.decl) = DeclarationNode::newPointer( (yyvsp[(2) - (2)].decl) ); } 8842 break; 8843 8844 case 693: 8852 8845 8853 8846 /* Line 1806 of yacc.c */ 8854 8847 #line 2650 "parser.yy" 8855 { (yyval.decl) = DeclarationNode::newPointer( (yyvsp[(2) - (2)].decl) ); }8856 break; 8857 8858 case 69 3:8848 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 8849 break; 8850 8851 case 694: 8859 8852 8860 8853 /* Line 1806 of yacc.c */ 8861 8854 #line 2652 "parser.yy" 8862 { (yyval.decl) = (yyvsp[( 2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0) ); }8863 break; 8864 8865 case 69 4:8855 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); } 8856 break; 8857 8858 case 695: 8866 8859 8867 8860 /* Line 1806 of yacc.c */ 8868 8861 #line 2654 "parser.yy" 8869 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }8870 break;8871 8872 case 695:8873 8874 /* Line 1806 of yacc.c */8875 #line 2656 "parser.yy"8876 8862 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8877 8863 break; 8878 8864 8879 8865 case 697: 8866 8867 /* Line 1806 of yacc.c */ 8868 #line 2660 "parser.yy" 8869 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8870 break; 8871 8872 case 698: 8880 8873 8881 8874 /* Line 1806 of yacc.c */ … … 8884 8877 break; 8885 8878 8886 case 69 8:8879 case 699: 8887 8880 8888 8881 /* Line 1806 of yacc.c */ 8889 8882 #line 2664 "parser.yy" 8890 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }8891 break;8892 8893 case 699:8894 8895 /* Line 1806 of yacc.c */8896 #line 2666 "parser.yy"8897 8883 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8898 8884 break; … … 8901 8887 8902 8888 /* Line 1806 of yacc.c */ 8889 #line 2669 "parser.yy" 8890 { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); } 8891 break; 8892 8893 case 701: 8894 8895 /* Line 1806 of yacc.c */ 8903 8896 #line 2671 "parser.yy" 8904 { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }8905 break;8906 8907 case 701:8908 8909 /* Line 1806 of yacc.c */8910 #line 2673 "parser.yy"8911 8897 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8912 8898 break; … … 8915 8901 8916 8902 /* Line 1806 of yacc.c */ 8917 #line 268 3"parser.yy"8903 #line 2681 "parser.yy" 8918 8904 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); } 8919 8905 break; … … 8922 8908 8923 8909 /* Line 1806 of yacc.c */ 8910 #line 2691 "parser.yy" 8911 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); } 8912 break; 8913 8914 case 708: 8915 8916 /* Line 1806 of yacc.c */ 8924 8917 #line 2693 "parser.yy" 8918 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); } 8919 break; 8920 8921 case 709: 8922 8923 /* Line 1806 of yacc.c */ 8924 #line 2695 "parser.yy" 8925 8925 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); } 8926 8926 break; 8927 8927 8928 case 7 08:8929 8930 /* Line 1806 of yacc.c */ 8931 #line 269 5"parser.yy"8928 case 710: 8929 8930 /* Line 1806 of yacc.c */ 8931 #line 2697 "parser.yy" 8932 8932 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); } 8933 8933 break; 8934 8934 8935 case 7 09:8936 8937 /* Line 1806 of yacc.c */ 8938 #line 269 7"parser.yy"8935 case 711: 8936 8937 /* Line 1806 of yacc.c */ 8938 #line 2699 "parser.yy" 8939 8939 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); } 8940 8940 break; 8941 8941 8942 case 71 0:8943 8944 /* Line 1806 of yacc.c */ 8945 #line 2 699"parser.yy"8942 case 712: 8943 8944 /* Line 1806 of yacc.c */ 8945 #line 2701 "parser.yy" 8946 8946 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); } 8947 8947 break; 8948 8948 8949 case 711: 8950 8951 /* Line 1806 of yacc.c */ 8952 #line 2701 "parser.yy" 8949 case 713: 8950 8951 /* Line 1806 of yacc.c */ 8952 #line 2708 "parser.yy" 8953 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); } 8954 break; 8955 8956 case 714: 8957 8958 /* Line 1806 of yacc.c */ 8959 #line 2710 "parser.yy" 8960 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); } 8961 break; 8962 8963 case 715: 8964 8965 /* Line 1806 of yacc.c */ 8966 #line 2712 "parser.yy" 8967 { (yyval.decl) = (yyvsp[(4) - (4)].decl)->addNewArray( (yyvsp[(3) - (4)].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); } 8968 break; 8969 8970 case 716: 8971 8972 /* Line 1806 of yacc.c */ 8973 #line 2714 "parser.yy" 8974 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( (yyvsp[(2) - (3)].decl) )->addNewArray( (yyvsp[(1) - (3)].decl) ); } 8975 break; 8976 8977 case 717: 8978 8979 /* Line 1806 of yacc.c */ 8980 #line 2716 "parser.yy" 8981 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); } 8982 break; 8983 8984 case 718: 8985 8986 /* Line 1806 of yacc.c */ 8987 #line 2718 "parser.yy" 8988 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); } 8989 break; 8990 8991 case 719: 8992 8993 /* Line 1806 of yacc.c */ 8994 #line 2720 "parser.yy" 8995 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); } 8996 break; 8997 8998 case 720: 8999 9000 /* Line 1806 of yacc.c */ 9001 #line 2722 "parser.yy" 9002 { (yyval.decl) = (yyvsp[(4) - (4)].decl)->addNewArray( (yyvsp[(3) - (4)].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); } 9003 break; 9004 9005 case 721: 9006 9007 /* Line 1806 of yacc.c */ 9008 #line 2724 "parser.yy" 9009 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( (yyvsp[(2) - (3)].decl) )->addNewArray( (yyvsp[(1) - (3)].decl) ); } 9010 break; 9011 9012 case 722: 9013 9014 /* Line 1806 of yacc.c */ 9015 #line 2726 "parser.yy" 9016 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); } 9017 break; 9018 9019 case 723: 9020 9021 /* Line 1806 of yacc.c */ 9022 #line 2731 "parser.yy" 9023 { (yyval.decl) = DeclarationNode::newVarArray( (yyvsp[(3) - (6)].decl) ); } 9024 break; 9025 9026 case 724: 9027 9028 /* Line 1806 of yacc.c */ 9029 #line 2733 "parser.yy" 9030 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(4) - (6)].en), (yyvsp[(3) - (6)].decl), false ); } 9031 break; 9032 9033 case 725: 9034 9035 /* Line 1806 of yacc.c */ 9036 #line 2738 "parser.yy" 9037 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(4) - (6)].en), (yyvsp[(3) - (6)].decl), true ); } 9038 break; 9039 9040 case 726: 9041 9042 /* Line 1806 of yacc.c */ 9043 #line 2740 "parser.yy" 9044 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(5) - (7)].en), (yyvsp[(4) - (7)].decl)->addQualifiers( (yyvsp[(3) - (7)].decl) ), true ); } 9045 break; 9046 9047 case 728: 9048 9049 /* Line 1806 of yacc.c */ 9050 #line 2767 "parser.yy" 9051 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); } 9052 break; 9053 9054 case 732: 9055 9056 /* Line 1806 of yacc.c */ 9057 #line 2778 "parser.yy" 8953 9058 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); } 8954 9059 break; 8955 9060 8956 case 7 12:8957 8958 /* Line 1806 of yacc.c */ 8959 #line 27 03"parser.yy"9061 case 733: 9062 9063 /* Line 1806 of yacc.c */ 9064 #line 2780 "parser.yy" 8960 9065 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); } 8961 9066 break; 8962 9067 8963 case 713: 8964 8965 /* Line 1806 of yacc.c */ 8966 #line 2710 "parser.yy" 9068 case 734: 9069 9070 /* Line 1806 of yacc.c */ 9071 #line 2782 "parser.yy" 9072 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); } 9073 break; 9074 9075 case 735: 9076 9077 /* Line 1806 of yacc.c */ 9078 #line 2784 "parser.yy" 9079 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); } 9080 break; 9081 9082 case 736: 9083 9084 /* Line 1806 of yacc.c */ 9085 #line 2786 "parser.yy" 9086 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); } 9087 break; 9088 9089 case 737: 9090 9091 /* Line 1806 of yacc.c */ 9092 #line 2788 "parser.yy" 9093 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); } 9094 break; 9095 9096 case 738: 9097 9098 /* Line 1806 of yacc.c */ 9099 #line 2795 "parser.yy" 8967 9100 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); } 8968 9101 break; 8969 9102 8970 case 714: 8971 8972 /* Line 1806 of yacc.c */ 8973 #line 2712 "parser.yy" 9103 case 739: 9104 9105 /* Line 1806 of yacc.c */ 9106 #line 2797 "parser.yy" 9107 { (yyval.decl) = (yyvsp[(4) - (4)].decl)->addNewArray( (yyvsp[(3) - (4)].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); } 9108 break; 9109 9110 case 740: 9111 9112 /* Line 1806 of yacc.c */ 9113 #line 2799 "parser.yy" 8974 9114 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); } 8975 9115 break; 8976 9116 8977 case 715: 8978 8979 /* Line 1806 of yacc.c */ 8980 #line 2714 "parser.yy" 9117 case 741: 9118 9119 /* Line 1806 of yacc.c */ 9120 #line 2801 "parser.yy" 9121 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); } 9122 break; 9123 9124 case 742: 9125 9126 /* Line 1806 of yacc.c */ 9127 #line 2803 "parser.yy" 8981 9128 { (yyval.decl) = (yyvsp[(4) - (4)].decl)->addNewArray( (yyvsp[(3) - (4)].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); } 8982 9129 break; 8983 9130 8984 case 716: 8985 8986 /* Line 1806 of yacc.c */ 8987 #line 2716 "parser.yy" 8988 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( (yyvsp[(2) - (3)].decl) )->addNewArray( (yyvsp[(1) - (3)].decl) ); } 8989 break; 8990 8991 case 717: 8992 8993 /* Line 1806 of yacc.c */ 8994 #line 2718 "parser.yy" 9131 case 743: 9132 9133 /* Line 1806 of yacc.c */ 9134 #line 2805 "parser.yy" 8995 9135 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); } 8996 9136 break; 8997 9137 8998 case 718:8999 9000 /* Line 1806 of yacc.c */9001 #line 2720 "parser.yy"9002 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }9003 break;9004 9005 case 719:9006 9007 /* Line 1806 of yacc.c */9008 #line 2722 "parser.yy"9009 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); }9010 break;9011 9012 case 720:9013 9014 /* Line 1806 of yacc.c */9015 #line 2724 "parser.yy"9016 { (yyval.decl) = (yyvsp[(4) - (4)].decl)->addNewArray( (yyvsp[(3) - (4)].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }9017 break;9018 9019 case 721:9020 9021 /* Line 1806 of yacc.c */9022 #line 2726 "parser.yy"9023 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( (yyvsp[(2) - (3)].decl) )->addNewArray( (yyvsp[(1) - (3)].decl) ); }9024 break;9025 9026 case 722:9027 9028 /* Line 1806 of yacc.c */9029 #line 2728 "parser.yy"9030 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); }9031 break;9032 9033 case 723:9034 9035 /* Line 1806 of yacc.c */9036 #line 2733 "parser.yy"9037 { (yyval.decl) = DeclarationNode::newVarArray( (yyvsp[(3) - (6)].decl) ); }9038 break;9039 9040 case 724:9041 9042 /* Line 1806 of yacc.c */9043 #line 2735 "parser.yy"9044 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(4) - (6)].en), (yyvsp[(3) - (6)].decl), false ); }9045 break;9046 9047 case 725:9048 9049 /* Line 1806 of yacc.c */9050 #line 2740 "parser.yy"9051 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(4) - (6)].en), (yyvsp[(3) - (6)].decl), true ); }9052 break;9053 9054 case 726:9055 9056 /* Line 1806 of yacc.c */9057 #line 2742 "parser.yy"9058 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(5) - (7)].en), (yyvsp[(4) - (7)].decl)->addQualifiers( (yyvsp[(3) - (7)].decl) ), true ); }9059 break;9060 9061 case 728:9062 9063 /* Line 1806 of yacc.c */9064 #line 2769 "parser.yy"9065 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }9066 break;9067 9068 case 732:9069 9070 /* Line 1806 of yacc.c */9071 #line 2780 "parser.yy"9072 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); }9073 break;9074 9075 case 733:9076 9077 /* Line 1806 of yacc.c */9078 #line 2782 "parser.yy"9079 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); }9080 break;9081 9082 case 734:9083 9084 /* Line 1806 of yacc.c */9085 #line 2784 "parser.yy"9086 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); }9087 break;9088 9089 case 735:9090 9091 /* Line 1806 of yacc.c */9092 #line 2786 "parser.yy"9093 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); }9094 break;9095 9096 case 736:9097 9098 /* Line 1806 of yacc.c */9099 #line 2788 "parser.yy"9100 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); }9101 break;9102 9103 case 737:9104 9105 /* Line 1806 of yacc.c */9106 #line 2790 "parser.yy"9107 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); }9108 break;9109 9110 case 738:9111 9112 /* Line 1806 of yacc.c */9113 #line 2797 "parser.yy"9114 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }9115 break;9116 9117 case 739:9118 9119 /* Line 1806 of yacc.c */9120 #line 2799 "parser.yy"9121 { (yyval.decl) = (yyvsp[(4) - (4)].decl)->addNewArray( (yyvsp[(3) - (4)].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }9122 break;9123 9124 case 740:9125 9126 /* Line 1806 of yacc.c */9127 #line 2801 "parser.yy"9128 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); }9129 break;9130 9131 case 741:9132 9133 /* Line 1806 of yacc.c */9134 #line 2803 "parser.yy"9135 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }9136 break;9137 9138 case 742:9139 9140 /* Line 1806 of yacc.c */9141 #line 2805 "parser.yy"9142 { (yyval.decl) = (yyvsp[(4) - (4)].decl)->addNewArray( (yyvsp[(3) - (4)].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }9143 break;9144 9145 case 743:9146 9147 /* Line 1806 of yacc.c */9148 #line 2807 "parser.yy"9149 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); }9150 break;9151 9152 9138 case 744: 9153 9139 9154 9140 /* Line 1806 of yacc.c */ 9155 #line 281 2"parser.yy"9141 #line 2810 "parser.yy" 9156 9142 { (yyval.decl) = DeclarationNode::newTuple( (yyvsp[(3) - (5)].decl) ); } 9157 9143 break; … … 9160 9146 9161 9147 /* Line 1806 of yacc.c */ 9148 #line 2815 "parser.yy" 9149 { (yyval.decl) = DeclarationNode::newFunction( 0, DeclarationNode::newTuple( 0 ), (yyvsp[(4) - (5)].decl), 0 ); } 9150 break; 9151 9152 case 746: 9153 9154 /* Line 1806 of yacc.c */ 9162 9155 #line 2817 "parser.yy" 9163 { (yyval.decl) = DeclarationNode::newFunction( 0, DeclarationNode::newTuple( 0 ), (yyvsp[(4) - (5)].decl), 0 ); }9164 break; 9165 9166 case 74 6:9156 { (yyval.decl) = DeclarationNode::newFunction( 0, (yyvsp[(1) - (6)].decl), (yyvsp[(4) - (6)].decl), 0 ); } 9157 break; 9158 9159 case 747: 9167 9160 9168 9161 /* Line 1806 of yacc.c */ … … 9171 9164 break; 9172 9165 9173 case 747:9174 9175 /* Line 1806 of yacc.c */9176 #line 2821 "parser.yy"9177 { (yyval.decl) = DeclarationNode::newFunction( 0, (yyvsp[(1) - (6)].decl), (yyvsp[(4) - (6)].decl), 0 ); }9178 break;9179 9180 9166 case 750: 9181 9167 9182 9168 /* Line 1806 of yacc.c */ 9169 #line 2843 "parser.yy" 9170 { (yyval.en) = 0; } 9171 break; 9172 9173 case 751: 9174 9175 /* Line 1806 of yacc.c */ 9183 9176 #line 2845 "parser.yy" 9184 { (yyval.en) = 0; }9185 break;9186 9187 case 751:9188 9189 /* Line 1806 of yacc.c */9190 #line 2847 "parser.yy"9191 9177 { (yyval.en) = (yyvsp[(2) - (2)].en); } 9192 9178 break; … … 9195 9181 9196 9182 /* Line 1806 of yacc.c */ 9197 #line 91 98"Parser/parser.cc"9183 #line 9184 "Parser/parser.cc" 9198 9184 default: break; 9199 9185 } … … 9426 9412 9427 9413 /* Line 2067 of yacc.c */ 9428 #line 28 50"parser.yy"9414 #line 2848 "parser.yy" 9429 9415 9430 9416 // ----end of grammar---- -
src/Parser/parser.yy
r12bc63a rfc4a0fa 377 377 { $$ = new ExpressionNode( build_fieldSel( $1, build_varref( $3 ) ) ); } 378 378 | postfix_expression '.' '[' push field_list pop ']' // CFA, tuple field selector 379 { $$ = new ExpressionNode( build_fieldSel( $1, build_tuple( $5 ) ) ); }380 379 | postfix_expression ARROW no_attr_identifier 381 380 { $$ = new ExpressionNode( build_pfieldSel( $1, build_varref( $3 ) ) ); } 382 381 | postfix_expression ARROW '[' push field_list pop ']' // CFA, tuple field selector 383 { $$ = new ExpressionNode( build_pfieldSel( $1, build_tuple( $5 ) ) ); }384 382 | postfix_expression ICR 385 383 { $$ = new ExpressionNode( build_unary_ptr( OperKinds::IncrPost, $1 ) ); } -
src/ResolvExpr/Alternative.cc
r12bc63a rfc4a0fa 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // Alternative.cc -- 7 // Alternative.cc -- 8 8 // 9 9 // Author : Richard C. Bilson … … 12 12 // Last Modified On : Sat May 16 23:54:23 2015 13 13 // Update Count : 2 14 // 14 // 15 15 16 16 #include "Alternative.h" … … 54 54 expr->print( os, indent ); 55 55 os << "(types:" << std::endl; 56 os << std::string( indent+4, ' ' ); 57 expr->get_result()->print( os, indent + 4 ); 58 os << std::endl << ")" << std::endl; 56 printAll( expr->get_results(), os, indent + 4 ); 57 os << ")" << std::endl; 59 58 } else { 60 59 os << "Null expression!" << std::endl; -
src/ResolvExpr/AlternativeFinder.cc
r12bc63a rfc4a0fa 38 38 #include "SynTree/TypeSubstitution.h" 39 39 #include "SymTab/Validate.h" 40 #include "Tuples/Tuples.h" 40 #include "Tuples/TupleAssignment.h" 41 #include "Tuples/NameMatcher.h" 41 42 #include "Common/utility.h" 42 43 #include "InitTweak/InitTweak.h" … … 63 64 } 64 65 65 Cost sumCost( const AltList &in ) {66 Cost total;67 for ( AltList::const_iterator i = in.begin(); i != in.end(); ++i ) {68 total += i->cost;69 }70 return total;71 }72 73 66 namespace { 74 67 void printAlts( const AltList &list, std::ostream &os, int indent = 0 ) { … … 83 76 out.push_back( i->expr->clone() ); 84 77 } 78 } 79 80 Cost sumCost( const AltList &in ) { 81 Cost total; 82 for ( AltList::const_iterator i = in.begin(); i != in.end(); ++i ) { 83 total += i->cost; 84 } 85 return total; 85 86 } 86 87 … … 100 101 PruneStruct current( candidate ); 101 102 std::string mangleName; 102 {103 Type * newType = candidate->expr->get_result()->clone();103 for ( std::list< Type* >::const_iterator retType = candidate->expr->get_results().begin(); retType != candidate->expr->get_results().end(); ++retType ) { 104 Type *newType = (*retType)->clone(); 104 105 candidate->env.apply( newType ); 105 mangleName = SymTab::Mangler::mangle( newType );106 mangleName += SymTab::Mangler::mangle( newType ); 106 107 delete newType; 107 108 } … … 132 133 if ( ! target->second.isAmbiguous ) { 133 134 Alternative &alt = *target->second.candidate; 134 alt.env.applyFree( alt.expr->get_result() ); 135 for ( std::list< Type* >::iterator result = alt.expr->get_results().begin(); result != alt.expr->get_results().end(); ++result ) { 136 alt.env.applyFree( *result ); 137 } 135 138 *out++ = alt; 136 139 } 137 140 } 141 142 } 143 144 template< typename InputIterator, typename OutputIterator > 145 void findMinCost( InputIterator begin, InputIterator end, OutputIterator out ) { 146 AltList alternatives; 147 148 // select the alternatives that have the minimum parameter cost 149 Cost minCost = Cost::infinity; 150 for ( AltList::iterator i = begin; i != end; ++i ) { 151 if ( i->cost < minCost ) { 152 minCost = i->cost; 153 i->cost = i->cvtCost; 154 alternatives.clear(); 155 alternatives.push_back( *i ); 156 } else if ( i->cost == minCost ) { 157 i->cost = i->cvtCost; 158 alternatives.push_back( *i ); 159 } 160 } 161 std::copy( alternatives.begin(), alternatives.end(), out ); 138 162 } 139 163 … … 146 170 147 171 void renameTypes( Expression *expr ) { 148 expr->get_result()->accept( global_renamer ); 172 for ( std::list< Type* >::iterator i = expr->get_results().begin(); i != expr->get_results().end(); ++i ) { 173 (*i)->accept( global_renamer ); 174 } 149 175 } 150 176 } … … 178 204 for ( AltList::iterator i = alternatives.begin(); i != alternatives.end(); ++i ) { 179 205 if ( adjust ) { 180 adjustExprType ( i->expr->get_result(), i->env, indexer );206 adjustExprTypeList( i->expr->get_results().begin(), i->expr->get_results().end(), i->env, indexer ); 181 207 } 182 208 } … … 215 241 216 242 template< typename StructOrUnionType > 217 void AlternativeFinder::addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const TypeEnvironment & env, Expression * member ) { 218 219 // // member must be either a tuple expression or a name expr 220 // if ( NameExpr * nameExpr = dynamic_cast< NameExpr * >( memberExpr->get_member() ) ) { 221 // addAggMembers( structInst, agg->expr, agg->cost, nameExpr->get_name() ); 222 // } else { 223 // TupleExpr * tupleExpr = safe_dynamic_cast< TupleExpr * >( memberExpr->get_member() ); 224 // // xxx - ... 225 // assert( false ); 226 // } 227 // if ( TupleExpr * tupleExpr = dynamic_cast< TupleExpr * >( memberExpr->get_member() ) ) { 228 229 // } 230 NameExpr * nameExpr = safe_dynamic_cast< NameExpr * >( member ); 231 const std::string & name = nameExpr->get_name(); 243 void AlternativeFinder::addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const TypeEnvironment & env, const std::string &name ) { 232 244 std::list< Declaration* > members; 233 245 aggInst->lookup( name, members ); … … 247 259 248 260 Cost computeConversionCost( Alternative &alt, const SymTab::Indexer &indexer ) { 249 ApplicationExpr *appExpr = safe_dynamic_cast< ApplicationExpr* >( alt.expr ); 250 PointerType *pointer = safe_dynamic_cast< PointerType* >( appExpr->get_function()->get_result() ); 251 FunctionType *function = safe_dynamic_cast< FunctionType* >( pointer->get_base() ); 261 ApplicationExpr *appExpr = dynamic_cast< ApplicationExpr* >( alt.expr ); 262 assert( appExpr ); 263 PointerType *pointer = dynamic_cast< PointerType* >( appExpr->get_function()->get_results().front() ); 264 assert( pointer ); 265 FunctionType *function = dynamic_cast< FunctionType* >( pointer->get_base() ); 266 assert( function ); 252 267 253 268 Cost convCost( 0, 0, 0 ); … … 255 270 std::list< DeclarationWithType* >::iterator formal = formals.begin(); 256 271 std::list< Expression* >& actuals = appExpr->get_args(); 257 258 std::list< Type * > formalTypes;259 std::list< Type * >::iterator formalType = formalTypes.end();260 261 272 for ( std::list< Expression* >::iterator actualExpr = actuals.begin(); actualExpr != actuals.end(); ++actualExpr ) { 262 263 273 PRINT( 264 274 std::cerr << "actual expression:" << std::endl; 265 275 (*actualExpr)->print( std::cerr, 8 ); 266 276 std::cerr << "--- results are" << std::endl; 267 (*actualExpr)->get_result()->print(std::cerr, 8 );277 printAll( (*actualExpr)->get_results(), std::cerr, 8 ); 268 278 ) 269 279 std::list< DeclarationWithType* >::iterator startFormal = formal; 270 280 Cost actualCost; 271 std::list< Type * > flatActualTypes; 272 flatten( (*actualExpr)->get_result(), back_inserter( flatActualTypes ) ); 273 for ( std::list< Type* >::iterator actualType = flatActualTypes.begin(); actualType != flatActualTypes.end(); ++actualType ) { 274 275 276 // tuple handling code 277 if ( formalType == formalTypes.end() ) { 278 // the type of the formal parameter may be a tuple type. To make this easier to work with, 279 // flatten the tuple type and traverse the resulting list of types, incrementing the formal 280 // iterator once its types have been extracted. Once a particular formal parameter's type has 281 // been exhausted load the next formal parameter's type. 282 if ( formal == formals.end() ) { 283 if ( function->get_isVarArgs() ) { 284 convCost += Cost( 1, 0, 0 ); 285 break; 286 } else { 287 return Cost::infinity; 288 } 281 for ( std::list< Type* >::iterator actual = (*actualExpr)->get_results().begin(); actual != (*actualExpr)->get_results().end(); ++actual ) { 282 if ( formal == formals.end() ) { 283 if ( function->get_isVarArgs() ) { 284 convCost += Cost( 1, 0, 0 ); 285 break; 286 } else { 287 return Cost::infinity; 289 288 } 290 formalTypes.clear();291 flatten( (*formal)->get_type(), back_inserter( formalTypes ) );292 formalType = formalTypes.begin();293 ++formal;294 289 } 295 296 290 PRINT( 297 291 std::cerr << std::endl << "converting "; 298 (*actual Type)->print( std::cerr, 8 );292 (*actual)->print( std::cerr, 8 ); 299 293 std::cerr << std::endl << " to "; 300 294 (*formal)->get_type()->print( std::cerr, 8 ); 301 295 ) 302 Cost newCost = conversionCost( *actual Type, *formalType, indexer, alt.env );296 Cost newCost = conversionCost( *actual, (*formal)->get_type(), indexer, alt.env ); 303 297 PRINT( 304 298 std::cerr << std::endl << "cost is" << newCost << std::endl; … … 311 305 actualCost += newCost; 312 306 313 convCost += Cost( 0, polyCost( *formalType, alt.env, indexer ) + polyCost( *actualType, alt.env, indexer ), 0 );314 315 formal Type++;307 convCost += Cost( 0, polyCost( (*formal)->get_type(), alt.env, indexer ) + polyCost( *actual, alt.env, indexer ), 0 ); 308 309 formal++; 316 310 } 317 311 if ( actualCost != Cost( 0, 0, 0 ) ) { … … 379 373 resultEnv.extractOpenVars( openVars ); 380 374 375 /* 376 Tuples::NameMatcher matcher( formals ); 377 try { 378 matcher.match( actuals ); 379 } catch ( Tuples::NoMatch &e ) { 380 std::cerr << "Alternative doesn't match: " << e.message << std::endl; 381 } 382 */ 381 383 std::list< DeclarationWithType* >::iterator formal = formals.begin(); 382 383 std::list< Type * > formalTypes;384 std::list< Type * >::iterator formalType = formalTypes.end();385 386 384 for ( AltList::const_iterator actualExpr = actuals.begin(); actualExpr != actuals.end(); ++actualExpr ) { 387 std::list< Type * > flatActualTypes; 388 flatten( actualExpr->expr->get_result(), back_inserter( flatActualTypes ) ); 389 for ( std::list< Type* >::iterator actualType = flatActualTypes.begin(); actualType != flatActualTypes.end(); ++actualType, ++formalType ) { 390 if ( formalType == formalTypes.end() ) { 391 // the type of the formal parameter may be a tuple type. To make this easier to work with, 392 // flatten the tuple type and traverse the resulting list of types, incrementing the formal 393 // iterator once its types have been extracted. Once a particular formal parameter's type has 394 // been exhausted load the next formal parameter's type. 395 if ( formal == formals.end() ) { 396 return isVarArgs; 397 } 398 formalTypes.clear(); 399 flatten( (*formal)->get_type(), back_inserter( formalTypes ) ); 400 formalType = formalTypes.begin(); 401 ++formal; 385 for ( std::list< Type* >::iterator actual = actualExpr->expr->get_results().begin(); actual != actualExpr->expr->get_results().end(); ++actual ) { 386 if ( formal == formals.end() ) { 387 return isVarArgs; 402 388 } 403 389 PRINT( 404 390 std::cerr << "formal type is "; 405 (*formal Type)->print( std::cerr );391 (*formal)->get_type()->print( std::cerr ); 406 392 std::cerr << std::endl << "actual type is "; 407 (*actual Type)->print( std::cerr );393 (*actual)->print( std::cerr ); 408 394 std::cerr << std::endl; 409 395 ) 410 if ( ! unify( *formalType, *actualType, resultEnv, resultNeed, resultHave, openVars, indexer ) ) {396 if ( ! unify( (*formal)->get_type(), *actual, resultEnv, resultNeed, resultHave, openVars, indexer ) ) { 411 397 return false; 412 398 } 413 } 414 } 415 416 // xxx - a tuple type was not completely matched 417 // partially handle the tuple with default arguments?? 418 if ( formalType != formalTypes.end() ) return false; 419 399 formal++; 400 } 401 } 420 402 // Handling of default values 421 403 while ( formal != formals.end() ) { … … 518 500 //if ( newNeedParents[ curDecl->get_uniqueId() ][ candDecl->get_uniqueId() ]++ > recursionParentLimit ) continue; 519 501 Expression *varExpr = new VariableExpr( candDecl ); 520 delete varExpr->get_result(); 521 varExpr->set_result( adjType->clone() ); 502 deleteAll( varExpr->get_results() ); 503 varExpr->get_results().clear(); 504 varExpr->get_results().push_front( adjType->clone() ); 522 505 PRINT( 523 506 std::cerr << "satisfying assertion " << curDecl->get_uniqueId() << " "; … … 591 574 PointerType pt( Type::Qualifiers(), v.clone() ); 592 575 UntypedExpr *vexpr = untypedExpr->clone(); 593 vexpr-> set_result( pt.clone() );576 vexpr->get_results().push_front( pt.clone() ); 594 577 alternatives.push_back( Alternative( vexpr, env, Cost()) ); 595 578 return; … … 604 587 combos( argAlternatives.begin(), argAlternatives.end(), back_inserter( possibilities ) ); 605 588 606 // take care of possible tuple assignments 607 // if not tuple assignment, assignment is taken care of as a normal function call 608 Tuples::handleTupleAssignment( *this, untypedExpr, possibilities ); 589 Tuples::TupleAssignSpotter tassign( this ); 590 if ( tassign.isTupleAssignment( untypedExpr, possibilities ) ) { 591 // take care of possible tuple assignments, or discard expression 592 return; 593 } // else ... 609 594 610 595 AltList candidates; … … 619 604 // check if the type is pointer to function 620 605 PointerType *pointer; 621 if ( ( pointer = dynamic_cast< PointerType* >( func->expr->get_result() ) ) ) {606 if ( func->expr->get_results().size() == 1 && ( pointer = dynamic_cast< PointerType* >( func->expr->get_results().front() ) ) ) { 622 607 if ( FunctionType *function = dynamic_cast< FunctionType* >( pointer->get_base() ) ) { 623 608 for ( std::list< AltList >::iterator actualAlt = possibilities.begin(); actualAlt != possibilities.end(); ++actualAlt ) { … … 655 640 // check if the type is pointer to function 656 641 PointerType *pointer; 657 if ( ( pointer = dynamic_cast< PointerType* >( funcOp->expr->get_result() ) ) ) { 642 if ( funcOp->expr->get_results().size() == 1 643 && ( pointer = dynamic_cast< PointerType* >( funcOp->expr->get_results().front() ) ) ) { 658 644 if ( FunctionType *function = dynamic_cast< FunctionType* >( pointer->get_base() ) ) { 659 645 for ( std::list< AltList >::iterator actualAlt = possibilities.begin(); actualAlt != possibilities.end(); ++actualAlt ) { … … 679 665 680 666 PRINT( 681 ApplicationExpr *appExpr = safe_dynamic_cast< ApplicationExpr* >( withFunc->expr ); 682 PointerType *pointer = safe_dynamic_cast< PointerType* >( appExpr->get_function()->get_result() ); 683 FunctionType *function = safe_dynamic_cast< FunctionType* >( pointer->get_base() ); 667 ApplicationExpr *appExpr = dynamic_cast< ApplicationExpr* >( withFunc->expr ); 668 assert( appExpr ); 669 PointerType *pointer = dynamic_cast< PointerType* >( appExpr->get_function()->get_results().front() ); 670 assert( pointer ); 671 FunctionType *function = dynamic_cast< FunctionType* >( pointer->get_base() ); 672 assert( function ); 684 673 std::cerr << "Case +++++++++++++" << std::endl; 685 674 std::cerr << "formals are:" << std::endl; … … 703 692 704 693 bool isLvalue( Expression *expr ) { 705 // xxx - recurse into tuples? 706 return expr->has_result() && expr->get_result()->get_isLvalue(); 694 for ( std::list< Type* >::const_iterator i = expr->get_results().begin(); i != expr->get_results().end(); ++i ) { 695 if ( !(*i)->get_isLvalue() ) return false; 696 } // for 697 return true; 707 698 } 708 699 … … 718 709 719 710 void AlternativeFinder::visit( CastExpr *castExpr ) { 720 Type *& toType = castExpr->get_result(); 721 toType = resolveTypeof( toType, indexer ); 722 SymTab::validateType( toType, &indexer ); 723 adjustExprType( toType, env, indexer ); 711 for ( std::list< Type* >::iterator i = castExpr->get_results().begin(); i != castExpr->get_results().end(); ++i ) { 712 *i = resolveTypeof( *i, indexer ); 713 SymTab::validateType( *i, &indexer ); 714 adjustExprType( *i, env, indexer ); 715 } // for 724 716 725 717 AlternativeFinder finder( indexer, env ); … … 735 727 // that are cast directly. The candidate is invalid if it has fewer results than there are types to cast 736 728 // to. 737 int discardedValues = (*i).expr->get_result ()->size() - castExpr->get_result()->size();729 int discardedValues = (*i).expr->get_results().size() - castExpr->get_results().size(); 738 730 if ( discardedValues < 0 ) continue; 739 // xxx - may need to go into tuple types and extract relavent types and use unifyList 731 std::list< Type* >::iterator candidate_end = (*i).expr->get_results().begin(); 732 std::advance( candidate_end, castExpr->get_results().size() ); 740 733 // unification run for side-effects 741 unify( castExpr->get_result(), (*i).expr->get_result(), i->env, needAssertions, haveAssertions, openVars, indexer ); 742 Cost thisCost = castCost( (*i).expr->get_result(), castExpr->get_result(), indexer, i->env ); 734 unifyList( castExpr->get_results().begin(), castExpr->get_results().end(), 735 (*i).expr->get_results().begin(), candidate_end, 736 i->env, needAssertions, haveAssertions, openVars, indexer ); 737 Cost thisCost = castCostList( (*i).expr->get_results().begin(), candidate_end, 738 castExpr->get_results().begin(), castExpr->get_results().end(), 739 indexer, i->env ); 743 740 if ( thisCost != Cost::infinity ) { 744 741 // count one safe conversion for each value that is thrown away … … 763 760 764 761 for ( AltList::const_iterator agg = funcFinder.alternatives.begin(); agg != funcFinder.alternatives.end(); ++agg ) { 765 if ( StructInstType *structInst = dynamic_cast< StructInstType* >( agg->expr->get_result() ) ) { 766 addAggMembers( structInst, agg->expr, agg->cost, agg->env, memberExpr->get_member() ); 767 } else if ( UnionInstType *unionInst = dynamic_cast< UnionInstType* >( agg->expr->get_result() ) ) { 768 addAggMembers( unionInst, agg->expr, agg->cost, agg->env, memberExpr->get_member() ); 762 if ( agg->expr->get_results().size() == 1 ) { 763 if ( StructInstType *structInst = dynamic_cast< StructInstType* >( agg->expr->get_results().front() ) ) { 764 addAggMembers( structInst, agg->expr, agg->cost, agg->env, memberExpr->get_member() ); 765 } else if ( UnionInstType *unionInst = dynamic_cast< UnionInstType* >( agg->expr->get_results().front() ) ) { 766 addAggMembers( unionInst, agg->expr, agg->cost, agg->env, memberExpr->get_member() ); 767 } // if 769 768 } // if 770 769 } // for … … 792 791 renameTypes( alternatives.back().expr ); 793 792 if ( StructInstType *structInst = dynamic_cast< StructInstType* >( (*i)->get_type() ) ) { 794 NameExpr nameExpr( "" ); 795 addAggMembers( structInst, &newExpr, Cost( 0, 0, 1 ), env, &nameExpr ); 793 addAggMembers( structInst, &newExpr, Cost( 0, 0, 1 ), env, "" ); 796 794 } else if ( UnionInstType *unionInst = dynamic_cast< UnionInstType* >( (*i)->get_type() ) ) { 797 NameExpr nameExpr( "" ); 798 addAggMembers( unionInst, &newExpr, Cost( 0, 0, 1 ), env, &nameExpr ); 795 addAggMembers( unionInst, &newExpr, Cost( 0, 0, 1 ), env, "" ); 799 796 } // if 800 797 } // for … … 897 894 alternatives.push_back( Alternative( new AttrExpr( new VariableExpr( funcDecl ), argType->clone() ), env, Cost::zero ) ); 898 895 for ( std::list< DeclarationWithType* >::iterator i = function->get_returnVals().begin(); i != function->get_returnVals().end(); ++i ) { 899 alternatives.back().expr-> set_result( (*i)->get_type()->clone() );896 alternatives.back().expr->get_results().push_back( (*i)->get_type()->clone() ); 900 897 } // for 901 898 } // if … … 920 917 finder.find( attrExpr->get_expr() ); 921 918 for ( AltList::iterator choice = finder.alternatives.begin(); choice != finder.alternatives.end(); ++choice ) { 922 if ( choice->expr->get_result ()->size() == 1 ) {923 resolveAttr(*i, function, choice->expr->get_result (), choice->env );919 if ( choice->expr->get_results().size() == 1 ) { 920 resolveAttr(*i, function, choice->expr->get_results().front(), choice->env ); 924 921 } // fi 925 922 } // for … … 963 960 AssertionSet needAssertions, haveAssertions; 964 961 Alternative newAlt( 0, third->env, first->cost + second->cost + third->cost ); 965 Type* commonType;966 if ( unify ( second->expr->get_result(), third->expr->get_result(), newAlt.env, needAssertions, haveAssertions, openVars, indexer, commonType) ) {962 std::list< Type* > commonTypes; 963 if ( unifyList( second->expr->get_results().begin(), second->expr->get_results().end(), third->expr->get_results().begin(), third->expr->get_results().end(), newAlt.env, needAssertions, haveAssertions, openVars, indexer, commonTypes ) ) { 967 964 ConditionalExpr *newExpr = new ConditionalExpr( first->expr->clone(), second->expr->clone(), third->expr->clone() ); 968 newExpr->set_result( commonType ? commonType : second->expr->get_result()->clone() ); 965 std::list< Type* >::const_iterator original = second->expr->get_results().begin(); 966 std::list< Type* >::const_iterator commonType = commonTypes.begin(); 967 for ( ; original != second->expr->get_results().end() && commonType != commonTypes.end(); ++original, ++commonType ) { 968 if ( *commonType ) { 969 newExpr->get_results().push_back( *commonType ); 970 } else { 971 newExpr->get_results().push_back( (*original)->clone() ); 972 } // if 973 } // for 969 974 newAlt.expr = newExpr; 970 975 inferParameters( needAssertions, haveAssertions, newAlt, openVars, back_inserter( alternatives ) ); … … 994 999 TupleExpr *newExpr = new TupleExpr; 995 1000 makeExprList( *i, newExpr->get_exprs() ); 996 TupleType *tupleType = new TupleType( Type::Qualifiers(true, true, true, true, true, true) ); 997 Type::Qualifiers &qualifiers = tupleType->get_qualifiers(); 998 for ( Expression * resultExpr : newExpr->get_exprs() ) { 999 Type * type = resultExpr->get_result()->clone(); 1000 tupleType->get_types().push_back( type ); 1001 qualifiers &= type->get_qualifiers(); 1001 for ( std::list< Expression* >::const_iterator resultExpr = newExpr->get_exprs().begin(); resultExpr != newExpr->get_exprs().end(); ++resultExpr ) { 1002 for ( std::list< Type* >::const_iterator resultType = (*resultExpr)->get_results().begin(); resultType != (*resultExpr)->get_results().end(); ++resultType ) { 1003 newExpr->get_results().push_back( (*resultType)->clone() ); 1004 } // for 1002 1005 } // for 1003 newExpr->set_result( tupleType );1004 1006 1005 1007 TypeEnvironment compositeEnv; … … 1022 1024 } 1023 1025 } 1024 1025 void AlternativeFinder::visit( TupleIndexExpr *tupleExpr ) {1026 alternatives.push_back( Alternative( tupleExpr->clone(), env, Cost::zero ) );1027 }1028 1029 void AlternativeFinder::visit( TupleAssignExpr *tupleAssignExpr ) {1030 alternatives.push_back( Alternative( tupleAssignExpr->clone(), env, Cost::zero ) );1031 }1032 1026 } // namespace ResolvExpr 1033 1027 -
src/ResolvExpr/AlternativeFinder.h
r12bc63a rfc4a0fa 67 67 virtual void visit( ImplicitCopyCtorExpr * impCpCtorExpr ); 68 68 virtual void visit( ConstructorExpr * ctorExpr ); 69 virtual void visit( TupleIndexExpr *tupleExpr ); 70 virtual void visit( TupleAssignExpr *tupleExpr ); 71 /// Runs a new alternative finder on each element in [begin, end) 72 /// and writes each alternative finder to out. 69 public: // xxx - temporary hack - should make Tuples::TupleAssignment a friend 73 70 template< typename InputIterator, typename OutputIterator > 74 71 void findSubExprs( InputIterator begin, InputIterator end, OutputIterator out ); 75 72 73 private: 76 74 /// Adds alternatives for member expressions, given the aggregate, conversion cost for that aggregate, and name of the member 77 template< typename StructOrUnionType > void addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const TypeEnvironment & env, Expression * member);75 template< typename StructOrUnionType > void addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const TypeEnvironment & env, const std::string &name ); 78 76 /// Adds alternatives for offsetof expressions, given the base type and name of the member 79 77 template< typename StructOrUnionType > void addOffsetof( StructOrUnionType *aggInst, const std::string &name ); … … 91 89 92 90 Expression *resolveInVoidContext( Expression *expr, const SymTab::Indexer &indexer, TypeEnvironment &env ); 93 94 template< typename InputIterator, typename OutputIterator >95 void findMinCost( InputIterator begin, InputIterator end, OutputIterator out ) {96 AltList alternatives;97 98 // select the alternatives that have the minimum parameter cost99 Cost minCost = Cost::infinity;100 for ( InputIterator i = begin; i != end; ++i ) {101 if ( i->cost < minCost ) {102 minCost = i->cost;103 i->cost = i->cvtCost;104 alternatives.clear();105 alternatives.push_back( *i );106 } else if ( i->cost == minCost ) {107 i->cost = i->cvtCost;108 alternatives.push_back( *i );109 }110 }111 std::copy( alternatives.begin(), alternatives.end(), out );112 }113 114 Cost sumCost( const AltList &in );115 91 } // namespace ResolvExpr 116 92 -
src/ResolvExpr/AlternativePrinter.cc
r12bc63a rfc4a0fa 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // AlternativePrinter.cc -- 7 // AlternativePrinter.cc -- 8 8 // 9 9 // Author : Richard C. Bilson … … 33 33 for ( AltList::const_iterator i = finder.get_alternatives().begin(); i != finder.get_alternatives().end(); ++i ) { 34 34 os << "Alternative " << count++ << " ==============" << std::endl; 35 i->expr->get_result()->print(os );35 printAll( i->expr->get_results(), os ); 36 36 // i->print( os ); 37 37 os << std::endl; -
src/ResolvExpr/ConversionCost.cc
r12bc63a rfc4a0fa 236 236 std::list< Type* >::const_iterator srcIt = tupleType->get_types().begin(); 237 237 std::list< Type* >::const_iterator destIt = destAsTuple->get_types().begin(); 238 while ( srcIt != tupleType->get_types().end() && destIt != destAsTuple->get_types().end()) {238 while ( srcIt != tupleType->get_types().end() ) { 239 239 Cost newCost = conversionCost( *srcIt++, *destIt++, indexer, env ); 240 240 if ( newCost == Cost::infinity ) { -
src/ResolvExpr/ResolveTypeof.cc
r12bc63a rfc4a0fa 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // ResolveTypeof.cc -- 7 // ResolveTypeof.cc -- 8 8 // 9 9 // Author : Richard C. Bilson … … 58 58 if ( typeofType->get_expr() ) { 59 59 Expression *newExpr = resolveInVoidContext( typeofType->get_expr(), indexer ); 60 assert( newExpr->has_result() && ! newExpr->get_result()->isVoid() ); 61 Type *newType = newExpr->get_result(); 60 assert( newExpr->get_results().size() > 0 ); 61 Type *newType; 62 if ( newExpr->get_results().size() > 1 ) { 63 TupleType *tupleType = new TupleType( Type::Qualifiers() ); 64 cloneAll( newExpr->get_results(), tupleType->get_types() ); 65 newType = tupleType; 66 } else { 67 newType = newExpr->get_results().front()->clone(); 68 } // if 62 69 delete typeofType; 63 70 return newType; -
src/ResolvExpr/Resolver.cc
r12bc63a rfc4a0fa 19 19 #include "RenameVars.h" 20 20 #include "ResolveTypeof.h" 21 #include "typeops.h"22 21 #include "SynTree/Statement.h" 23 22 #include "SynTree/Type.h" … … 68 67 void resolveSingleAggrInit( Declaration *, InitIterator &, InitIterator & ); 69 68 void fallbackInit( ConstructorInit * ctorInit ); 70 Type *functionReturn;69 std::list< Type * > functionReturn; 71 70 Type *initContext; 72 71 Type *switchType; … … 156 155 const TypeEnvironment *newEnv = 0; 157 156 for ( AltList::const_iterator i = finder.get_alternatives().begin(); i != finder.get_alternatives().end(); ++i ) { 158 if ( i->expr->get_result ()->size() == 1 && isIntegralType( i->expr->get_result() ) ) {157 if ( i->expr->get_results().size() == 1 && isIntegralType( i->expr->get_results().front() ) ) { 159 158 if ( newExpr ) { 160 159 throw SemanticError( "Too many interpretations for case control expression", untyped ); … … 233 232 Type *new_type = resolveTypeof( functionDecl->get_type(), *this ); 234 233 functionDecl->set_type( new_type ); 235 ValueGuard< Type * > oldFunctionReturn( functionReturn ); 236 functionReturn = ResolvExpr::extractResultType( functionDecl->get_functionType() ); 234 std::list< Type * > oldFunctionReturn = functionReturn; 235 functionReturn.clear(); 236 for ( std::list< DeclarationWithType * >::const_iterator i = functionDecl->get_functionType()->get_returnVals().begin(); i != functionDecl->get_functionType()->get_returnVals().end(); ++i ) { 237 functionReturn.push_back( (*i)->get_type() ); 238 } // for 237 239 SymTab::Indexer::visit( functionDecl ); 240 functionReturn = oldFunctionReturn; 238 241 } 239 242 … … 333 336 void Resolver::visit( ReturnStmt *returnStmt ) { 334 337 if ( returnStmt->get_expr() ) { 335 CastExpr *castExpr = new CastExpr( returnStmt->get_expr(), functionReturn->clone() ); 338 CastExpr *castExpr = new CastExpr( returnStmt->get_expr() ); 339 cloneAll( functionReturn, castExpr->get_results() ); 336 340 Expression *newExpr = findSingleExpression( castExpr, *this ); 337 341 delete castExpr; … … 378 382 if ( isCharType( at->get_base() ) ) { 379 383 // check if the resolved type is char * 380 if ( PointerType * pt = dynamic_cast< PointerType *>( newExpr->get_result () ) ) {384 if ( PointerType * pt = dynamic_cast< PointerType *>( newExpr->get_results().front() ) ) { 381 385 if ( isCharType( pt->get_base() ) ) { 382 386 // strip cast if we're initializing a char[] with a char *, e.g. char x[] = "hello"; -
src/ResolvExpr/Unify.cc
r12bc63a rfc4a0fa 588 588 } 589 589 590 // xxx - compute once and store in the FunctionType?591 Type * extractResultType( FunctionType * function ) {592 if ( function->get_returnVals().size() == 0 ) {593 return new VoidType( Type::Qualifiers() );594 } else if ( function->get_returnVals().size() == 1 ) {595 return function->get_returnVals().front()->get_type()->clone();596 } else {597 TupleType * tupleType = new TupleType( Type::Qualifiers() );598 for ( DeclarationWithType * decl : function->get_returnVals() ) {599 tupleType->get_types().push_back( decl->get_type()->clone() );600 } // for601 return tupleType;602 }603 }604 605 590 } // namespace ResolvExpr 606 591 -
src/ResolvExpr/typeops.h
r12bc63a rfc4a0fa 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // typeops.h -- 7 // typeops.h -- 8 8 // 9 9 // Author : Richard C. Bilson … … 30 30 typedef typename InputIterator::value_type SetType; 31 31 typedef typename std::list< typename SetType::value_type > ListType; 32 32 33 33 if ( begin == end ) { 34 34 *out++ = ListType(); 35 35 return; 36 36 } // if 37 37 38 38 InputIterator current = begin; 39 39 begin++; … … 41 41 std::list< ListType > recursiveResult; 42 42 combos( begin, end, back_inserter( recursiveResult ) ); 43 43 44 44 for ( typename std::list< ListType >::const_iterator i = recursiveResult.begin(); i != recursiveResult.end(); ++i ) { 45 45 for ( typename ListType::const_iterator j = current->begin(); j != current->end(); ++j ) { … … 52 52 } // for 53 53 } 54 54 55 55 // in AdjustExprType.cc 56 56 /// Replaces array types with the equivalent pointer, and function types with a pointer-to-function … … 144 144 } 145 145 146 /// creates the type represented by the list of returnVals in a FunctionType. The caller owns the return value.147 Type * extractResultType( FunctionType * functionType );148 149 146 // in CommonType.cc 150 147 Type *commonType( Type *type1, Type *type2, bool widenFirst, bool widenSecond, const SymTab::Indexer &indexer, TypeEnvironment &env, const OpenVarSet &openVars ); … … 155 152 // in Occurs.cc 156 153 bool occurs( Type *type, std::string varName, const TypeEnvironment &env ); 157 158 // flatten tuple type into list of types159 template< typename OutputIterator >160 void flatten( Type * type, OutputIterator out ) {161 if ( TupleType * tupleType = dynamic_cast< TupleType * >( type ) ) {162 for ( Type * t : tupleType->get_types() ) {163 flatten( t, out );164 }165 } else {166 *out++ = type;167 }168 }169 154 } // namespace ResolvExpr 170 155 -
src/SymTab/Autogen.cc
r12bc63a rfc4a0fa 116 116 // This happens before function pointer type conversion, so need to do it manually here 117 117 VariableExpr * assignVarExpr = new VariableExpr( assignDecl ); 118 Type * assignVarExprType = assignVarExpr->get_result();118 Type *& assignVarExprType = assignVarExpr->get_results().front(); 119 119 assignVarExprType = new PointerType( Type::Qualifiers(), assignVarExprType ); 120 assignVarExpr->set_result( assignVarExprType );121 120 ApplicationExpr * assignExpr = new ApplicationExpr( assignVarExpr ); 122 121 assignExpr->get_args().push_back( new VariableExpr( dstParam ) ); -
src/SymTab/Indexer.cc
r12bc63a rfc4a0fa 40 40 41 41 namespace SymTab { 42 template< typename TreeType, typename VisitorType >43 inline void accept NewScope( TreeType *tree, VisitorType &visitor ) {42 template< typename Container, typename VisitorType > 43 inline void acceptAllNewScope( Container &container, VisitorType &visitor ) { 44 44 visitor.enterScope(); 45 maybeAccept( tree, visitor );45 acceptAll( container, visitor ); 46 46 visitor.leaveScope(); 47 47 } … … 337 337 338 338 void Indexer::visit( ApplicationExpr *applicationExpr ) { 339 accept NewScope( applicationExpr->get_result(), *this );339 acceptAllNewScope( applicationExpr->get_results(), *this ); 340 340 maybeAccept( applicationExpr->get_function(), *this ); 341 341 acceptAll( applicationExpr->get_args(), *this ); … … 343 343 344 344 void Indexer::visit( UntypedExpr *untypedExpr ) { 345 accept NewScope( untypedExpr->get_result(), *this );345 acceptAllNewScope( untypedExpr->get_results(), *this ); 346 346 acceptAll( untypedExpr->get_args(), *this ); 347 347 } 348 348 349 349 void Indexer::visit( NameExpr *nameExpr ) { 350 accept NewScope( nameExpr->get_result(), *this );350 acceptAllNewScope( nameExpr->get_results(), *this ); 351 351 } 352 352 353 353 void Indexer::visit( AddressExpr *addressExpr ) { 354 accept NewScope( addressExpr->get_result(), *this );354 acceptAllNewScope( addressExpr->get_results(), *this ); 355 355 maybeAccept( addressExpr->get_arg(), *this ); 356 356 } 357 357 358 358 void Indexer::visit( LabelAddressExpr *labAddressExpr ) { 359 accept NewScope( labAddressExpr->get_result(), *this );359 acceptAllNewScope( labAddressExpr->get_results(), *this ); 360 360 maybeAccept( labAddressExpr->get_arg(), *this ); 361 361 } 362 362 363 363 void Indexer::visit( CastExpr *castExpr ) { 364 accept NewScope( castExpr->get_result(), *this );364 acceptAllNewScope( castExpr->get_results(), *this ); 365 365 maybeAccept( castExpr->get_arg(), *this ); 366 366 } 367 367 368 368 void Indexer::visit( UntypedMemberExpr *memberExpr ) { 369 accept NewScope( memberExpr->get_result(), *this );369 acceptAllNewScope( memberExpr->get_results(), *this ); 370 370 maybeAccept( memberExpr->get_aggregate(), *this ); 371 371 } 372 372 373 373 void Indexer::visit( MemberExpr *memberExpr ) { 374 accept NewScope( memberExpr->get_result(), *this );374 acceptAllNewScope( memberExpr->get_results(), *this ); 375 375 maybeAccept( memberExpr->get_aggregate(), *this ); 376 376 } 377 377 378 378 void Indexer::visit( VariableExpr *variableExpr ) { 379 accept NewScope( variableExpr->get_result(), *this );379 acceptAllNewScope( variableExpr->get_results(), *this ); 380 380 } 381 381 382 382 void Indexer::visit( ConstantExpr *constantExpr ) { 383 accept NewScope( constantExpr->get_result(), *this );383 acceptAllNewScope( constantExpr->get_results(), *this ); 384 384 maybeAccept( constantExpr->get_constant(), *this ); 385 385 } 386 386 387 387 void Indexer::visit( SizeofExpr *sizeofExpr ) { 388 accept NewScope( sizeofExpr->get_result(), *this );388 acceptAllNewScope( sizeofExpr->get_results(), *this ); 389 389 if ( sizeofExpr->get_isType() ) { 390 390 maybeAccept( sizeofExpr->get_type(), *this ); … … 395 395 396 396 void Indexer::visit( AlignofExpr *alignofExpr ) { 397 accept NewScope( alignofExpr->get_result(), *this );397 acceptAllNewScope( alignofExpr->get_results(), *this ); 398 398 if ( alignofExpr->get_isType() ) { 399 399 maybeAccept( alignofExpr->get_type(), *this ); … … 404 404 405 405 void Indexer::visit( UntypedOffsetofExpr *offsetofExpr ) { 406 accept NewScope( offsetofExpr->get_result(), *this );406 acceptAllNewScope( offsetofExpr->get_results(), *this ); 407 407 maybeAccept( offsetofExpr->get_type(), *this ); 408 408 } 409 409 410 410 void Indexer::visit( OffsetofExpr *offsetofExpr ) { 411 accept NewScope( offsetofExpr->get_result(), *this );411 acceptAllNewScope( offsetofExpr->get_results(), *this ); 412 412 maybeAccept( offsetofExpr->get_type(), *this ); 413 413 maybeAccept( offsetofExpr->get_member(), *this ); … … 415 415 416 416 void Indexer::visit( OffsetPackExpr *offsetPackExpr ) { 417 accept NewScope( offsetPackExpr->get_result(), *this );417 acceptAllNewScope( offsetPackExpr->get_results(), *this ); 418 418 maybeAccept( offsetPackExpr->get_type(), *this ); 419 419 } 420 420 421 421 void Indexer::visit( AttrExpr *attrExpr ) { 422 accept NewScope( attrExpr->get_result(), *this );422 acceptAllNewScope( attrExpr->get_results(), *this ); 423 423 if ( attrExpr->get_isType() ) { 424 424 maybeAccept( attrExpr->get_type(), *this ); … … 429 429 430 430 void Indexer::visit( LogicalExpr *logicalExpr ) { 431 accept NewScope( logicalExpr->get_result(), *this );431 acceptAllNewScope( logicalExpr->get_results(), *this ); 432 432 maybeAccept( logicalExpr->get_arg1(), *this ); 433 433 maybeAccept( logicalExpr->get_arg2(), *this ); … … 435 435 436 436 void Indexer::visit( ConditionalExpr *conditionalExpr ) { 437 accept NewScope( conditionalExpr->get_result(), *this );437 acceptAllNewScope( conditionalExpr->get_results(), *this ); 438 438 maybeAccept( conditionalExpr->get_arg1(), *this ); 439 439 maybeAccept( conditionalExpr->get_arg2(), *this ); … … 442 442 443 443 void Indexer::visit( CommaExpr *commaExpr ) { 444 accept NewScope( commaExpr->get_result(), *this );444 acceptAllNewScope( commaExpr->get_results(), *this ); 445 445 maybeAccept( commaExpr->get_arg1(), *this ); 446 446 maybeAccept( commaExpr->get_arg2(), *this ); … … 448 448 449 449 void Indexer::visit( TupleExpr *tupleExpr ) { 450 accept NewScope( tupleExpr->get_result(), *this );450 acceptAllNewScope( tupleExpr->get_results(), *this ); 451 451 acceptAll( tupleExpr->get_exprs(), *this ); 452 452 } 453 453 454 void Indexer::visit( TupleAssignExpr *tupleExpr ) { 455 acceptNewScope( tupleExpr->get_result(), *this ); 456 enterScope(); 457 acceptAll( tupleExpr->get_tempDecls(), *this ); 458 acceptAll( tupleExpr->get_assigns(), *this ); 459 leaveScope(); 454 void Indexer::visit( SolvedTupleExpr *tupleExpr ) { 455 acceptAllNewScope( tupleExpr->get_results(), *this ); 456 acceptAll( tupleExpr->get_exprs(), *this ); 460 457 } 461 458 462 459 void Indexer::visit( TypeExpr *typeExpr ) { 463 accept NewScope( typeExpr->get_result(), *this );460 acceptAllNewScope( typeExpr->get_results(), *this ); 464 461 maybeAccept( typeExpr->get_type(), *this ); 465 462 } … … 472 469 473 470 void Indexer::visit( UntypedValofExpr *valofExpr ) { 474 accept NewScope( valofExpr->get_result(), *this );471 acceptAllNewScope( valofExpr->get_results(), *this ); 475 472 maybeAccept( valofExpr->get_body(), *this ); 476 473 } -
src/SymTab/Indexer.h
r12bc63a rfc4a0fa 64 64 virtual void visit( ConditionalExpr *conditionalExpr ); 65 65 virtual void visit( CommaExpr *commaExpr ); 66 virtual void visit( TupleExpr *tupleExpr ); 67 virtual void visit( SolvedTupleExpr *tupleExpr ); 66 68 virtual void visit( TypeExpr *typeExpr ); 67 69 virtual void visit( AsmExpr *asmExpr ); 68 70 virtual void visit( UntypedValofExpr *valofExpr ); 69 virtual void visit( TupleExpr *tupleExpr );70 virtual void visit( TupleAssignExpr *tupleExpr );71 71 72 72 virtual void visit( TraitInstType *contextInst ); -
src/SynTree/AddressExpr.cc
r12bc63a rfc4a0fa 19 19 20 20 AddressExpr::AddressExpr( Expression *arg, Expression *_aname ) : Expression( _aname ), arg( arg ) { 21 if ( arg->has_result()) {22 set_result( new PointerType( Type::Qualifiers(), arg->get_result()->clone() ) );23 } 21 for ( std::list< Type* >::const_iterator i = arg->get_results().begin(); i != arg->get_results().end(); ++i ) { 22 get_results().push_back( new PointerType( Type::Qualifiers(), (*i)->clone() ) ); 23 } // for 24 24 } 25 25 … … 35 35 if ( arg ) { 36 36 os << std::string( indent+2, ' ' ); 37 arg->print( os, indent+2 );37 arg->print( os, indent+2 ); 38 38 } // if 39 39 } -
src/SynTree/ApplicationExpr.cc
r12bc63a rfc4a0fa 21 21 #include "TypeSubstitution.h" 22 22 #include "Common/utility.h" 23 #include "ResolvExpr/typeops.h" 23 24 24 25 25 ParamEntry::ParamEntry( const ParamEntry &other ) : … … 43 43 44 44 ApplicationExpr::ApplicationExpr( Expression *funcExpr ) : function( funcExpr ) { 45 PointerType *pointer = safe_dynamic_cast< PointerType* >( funcExpr->get_result() ); 46 FunctionType *function = safe_dynamic_cast< FunctionType* >( pointer->get_base() ); 45 PointerType *pointer = dynamic_cast< PointerType* >( funcExpr->get_results().front() ); 46 assert( pointer ); 47 FunctionType *function = dynamic_cast< FunctionType* >( pointer->get_base() ); 48 assert( function ); 47 49 48 set_result( ResolvExpr::extractResultType( function ) );49 50 assert( has_result() );50 for ( std::list< DeclarationWithType* >::const_iterator i = function->get_returnVals().begin(); i != function->get_returnVals().end(); ++i ) { 51 get_results().push_back( (*i)->get_type()->clone() ); 52 } // for 51 53 } 52 54 -
src/SynTree/CommaExpr.cc
r12bc63a rfc4a0fa 23 23 // to false on all result types. Actually doing this causes some strange things 24 24 // to happen in later passes (particularly, Specialize, Lvalue, and Box). This needs to be looked into. 25 set_result( maybeClone( arg2->get_result() ) ); 26 // get_type->set_isLvalue( false ); 25 cloneAll( arg2->get_results(), get_results() ); 26 // for ( Type *& type : get_results() ) { 27 // type->set_isLvalue( false ); 28 // } 27 29 } 28 30 -
src/SynTree/Expression.cc
r12bc63a rfc4a0fa 31 31 32 32 33 Expression::Expression( Expression *_aname ) : result( 0 ), env( 0 ), argName( _aname ) {} 34 35 Expression::Expression( const Expression &other ) : result( maybeClone( other.result ) ), env( maybeClone( other.env ) ), argName( maybeClone( other.get_argName() ) ), extension( other.extension ) { 33 Expression::Expression( Expression *_aname ) : env( 0 ), argName( _aname ) {} 34 35 Expression::Expression( const Expression &other ) : env( maybeClone( other.env ) ), argName( maybeClone( other.get_argName() ) ), extension( other.extension ) { 36 cloneAll( other.results, results ); 36 37 } 37 38 … … 39 40 delete env; 40 41 delete argName; // xxx -- there's a problem in cloning ConstantExpr I still don't know how to fix 41 delete result; 42 deleteAll( results ); 43 } 44 45 void Expression::add_result( Type *t ) { 46 if ( TupleType *tuple = dynamic_cast< TupleType* >( t ) ) { 47 std::copy( tuple->get_types().begin(), tuple->get_types().end(), back_inserter( results ) ); 48 } else { 49 results.push_back(t); 50 } // if 42 51 } 43 52 … … 59 68 60 69 ConstantExpr::ConstantExpr( Constant _c, Expression *_aname ) : Expression( _aname ), constant( _c ) { 61 set_result( constant.get_type()->clone() );70 add_result( constant.get_type()->clone() ); 62 71 } 63 72 … … 76 85 assert( var ); 77 86 assert( var->get_type() ); 78 Type * type = var->get_type()->clone(); 79 type->set_isLvalue( true ); 80 set_result( type ); 87 add_result( var->get_type()->clone() ); 88 for ( std::list< Type* >::iterator i = get_results().begin(); i != get_results().end(); ++i ) { 89 (*i)->set_isLvalue( true ); 90 } // for 81 91 } 82 92 … … 100 110 SizeofExpr::SizeofExpr( Expression *expr_, Expression *_aname ) : 101 111 Expression( _aname ), expr(expr_), type(0), isType(false) { 102 set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );112 add_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) ); 103 113 } 104 114 105 115 SizeofExpr::SizeofExpr( Type *type_, Expression *_aname ) : 106 116 Expression( _aname ), expr(0), type(type_), isType(true) { 107 set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );117 add_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) ); 108 118 } 109 119 … … 131 141 AlignofExpr::AlignofExpr( Expression *expr_, Expression *_aname ) : 132 142 Expression( _aname ), expr(expr_), type(0), isType(false) { 133 set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );143 add_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) ); 134 144 } 135 145 136 146 AlignofExpr::AlignofExpr( Type *type_, Expression *_aname ) : 137 147 Expression( _aname ), expr(0), type(type_), isType(true) { 138 set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );148 add_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) ); 139 149 } 140 150 … … 162 172 UntypedOffsetofExpr::UntypedOffsetofExpr( Type *type_, const std::string &member_, Expression *_aname ) : 163 173 Expression( _aname ), type(type_), member(member_) { 164 set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );174 add_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) ); 165 175 } 166 176 … … 187 197 OffsetofExpr::OffsetofExpr( Type *type_, DeclarationWithType *member_, Expression *_aname ) : 188 198 Expression( _aname ), type(type_), member(member_) { 189 set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );199 add_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) ); 190 200 } 191 201 … … 219 229 220 230 OffsetPackExpr::OffsetPackExpr( StructInstType *type_, Expression *aname_ ) : Expression( aname_ ), type( type_ ) { 221 set_result( new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), 0, false, false ) );231 add_result( new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), 0, false, false ) ); 222 232 } 223 233 … … 274 284 275 285 CastExpr::CastExpr( Expression *arg_, Type *toType, Expression *_aname ) : Expression( _aname ), arg(arg_) { 276 set_result(toType);286 add_result(toType); 277 287 } 278 288 279 289 CastExpr::CastExpr( Expression *arg_, Expression *_aname ) : Expression( _aname ), arg(arg_) { 280 set_result( new VoidType( Type::Qualifiers() ) );281 290 } 282 291 … … 294 303 arg->print(os, indent+2); 295 304 os << std::endl << std::string( indent, ' ' ) << "to:" << std::endl; 296 os << std::string( indent+2, ' ' ); 297 if ( result->isVoid() ) { 298 os << "nothing"; 305 if ( results.empty() ) { 306 os << std::string( indent+2, ' ' ) << "nothing" << std::endl; 299 307 } else { 300 result->print( os, indent+2);308 printAll(results, os, indent+2); 301 309 } // if 302 os << std::endl; 303 Expression::print( os, indent ); 304 } 305 306 UntypedMemberExpr::UntypedMemberExpr( Expression * _member, Expression *_aggregate, Expression *_aname ) : 310 Expression::print( os, indent ); 311 } 312 313 UntypedMemberExpr::UntypedMemberExpr( std::string _member, Expression *_aggregate, Expression *_aname ) : 307 314 Expression( _aname ), member(_member), aggregate(_aggregate) {} 308 315 309 316 UntypedMemberExpr::UntypedMemberExpr( const UntypedMemberExpr &other ) : 310 Expression( other ), member( maybeClone( other.member )), aggregate( maybeClone( other.aggregate ) ) {317 Expression( other ), member( other.member ), aggregate( maybeClone( other.aggregate ) ) { 311 318 } 312 319 313 320 UntypedMemberExpr::~UntypedMemberExpr() { 314 321 delete aggregate; 315 delete member;316 322 } 317 323 318 324 void UntypedMemberExpr::print( std::ostream &os, int indent ) const { 319 os << "Untyped Member Expression, with field: " << std::endl; 320 get_member()->print(os, indent+4); 321 os << std::string( indent+2, ' ' ); 325 os << "Untyped Member Expression, with field: " << get_member(); 322 326 323 327 Expression *agg = get_aggregate(); 324 os << " from aggregate: " << std::endl;328 os << ", from aggregate: "; 325 329 if (agg != 0) { 326 os << std::string( indent + 4, ' ' );327 agg->print(os, indent + 4);330 os << std::string( indent + 2, ' ' ); 331 agg->print(os, indent + 2); 328 332 } 329 333 os << std::string( indent+2, ' ' ); … … 334 338 MemberExpr::MemberExpr( DeclarationWithType *_member, Expression *_aggregate, Expression *_aname ) : 335 339 Expression( _aname ), member(_member), aggregate(_aggregate) { 336 set_result( member->get_type()->clone() ); 337 get_result()->set_isLvalue( true ); 340 add_result( member->get_type()->clone() ); 341 for ( std::list< Type* >::iterator i = get_results().begin(); i != get_results().end(); ++i ) { 342 (*i)->set_isLvalue( true ); 343 } // for 338 344 } 339 345 … … 366 372 } 367 373 368 UntypedExpr::UntypedExpr( Expression *_function, const std::list<Expression *> &_args, Expression *_aname ) : 369 Expression( _aname ), function(_function), args(_args) {}374 375 UntypedExpr::UntypedExpr( Expression *_function, Expression *_aname ) : Expression( _aname ), function( _function ) {} 370 376 371 377 UntypedExpr::UntypedExpr( const UntypedExpr &other ) : … … 373 379 cloneAll( other.args, args ); 374 380 } 381 382 UntypedExpr::UntypedExpr( Expression *_function, std::list<Expression *> &_args, Expression *_aname ) : 383 Expression( _aname ), function(_function), args(_args) {} 375 384 376 385 UntypedExpr::~UntypedExpr() { … … 410 419 LogicalExpr::LogicalExpr( Expression *arg1_, Expression *arg2_, bool andp, Expression *_aname ) : 411 420 Expression( _aname ), arg1(arg1_), arg2(arg2_), isAnd(andp) { 412 set_result( new BasicType( Type::Qualifiers(), BasicType::SignedInt ) );421 add_result( new BasicType( Type::Qualifiers(), BasicType::SignedInt ) ); 413 422 } 414 423 … … 468 477 ImplicitCopyCtorExpr::ImplicitCopyCtorExpr( ApplicationExpr * callExpr ) : callExpr( callExpr ) { 469 478 assert( callExpr ); 470 assert( callExpr->has_result() ); 471 set_result( callExpr->get_result()->clone() ); 479 cloneAll( callExpr->get_results(), results ); 472 480 } 473 481 … … 502 510 Expression * arg = InitTweak::getCallArg( callExpr, 0 ); 503 511 assert( arg ); 504 set_result( maybeClone( arg->get_result() ));512 cloneAll( arg->get_results(), results ); 505 513 } 506 514 … … 522 530 523 531 CompoundLiteralExpr::CompoundLiteralExpr( Type * type, Initializer * initializer ) : type( type ), initializer( initializer ) { 524 set_result( type->clone() );532 add_result( type->clone() ); 525 533 } 526 534 … … 557 565 } 558 566 559 StmtExpr::StmtExpr( CompoundStmt *statements ) : statements( statements ) {560 assert( statements );561 std::list< Statement * > & body = statements->get_kids();562 if ( ! body.empty() ) {563 if ( ExprStmt * exprStmt = dynamic_cast< ExprStmt * >( body.back() ) ) {564 set_result( maybeClone( exprStmt->get_expr()->get_result() ) );565 }566 }567 }568 StmtExpr::StmtExpr( const StmtExpr &other ) : statements( other.statements->clone() ) {}569 StmtExpr::~StmtExpr() {570 delete statements;571 }572 void StmtExpr::print( std::ostream &os, int indent ) const {573 os << std::string( indent, ' ' ) << "Statement Expression: " << std::endl;574 statements->print( os, indent+2 );575 }576 577 567 std::ostream & operator<<( std::ostream & out, const Expression * expr ) { 578 568 expr->print( out ); -
src/SynTree/Expression.h
r12bc63a rfc4a0fa 32 32 virtual ~Expression(); 33 33 34 Type *& get_result() { return result; } 35 void set_result( Type *newValue ) { result = newValue; } 36 bool has_result() const { return result != nullptr; } 34 std::list<Type *>& get_results() { return results; } 35 void add_result( Type *t ); 37 36 38 37 TypeSubstitution *get_env() const { return env; } … … 48 47 virtual void print( std::ostream &os, int indent = 0 ) const; 49 48 protected: 50 Type * result;49 std::list<Type *> results; 51 50 TypeSubstitution *env; 52 51 Expression* argName; // if expression is used as an argument, it can be "designated" by this name … … 99 98 class UntypedExpr : public Expression { 100 99 public: 101 UntypedExpr( Expression *function, const std::list<Expression *> &args = std::list< Expression * >(),Expression *_aname = nullptr );100 UntypedExpr( Expression *function, Expression *_aname = nullptr ); 102 101 UntypedExpr( const UntypedExpr &other ); 102 UntypedExpr( Expression *function, std::list<Expression *> &args, Expression *_aname = nullptr ); 103 103 virtual ~UntypedExpr(); 104 104 … … 200 200 class UntypedMemberExpr : public Expression { 201 201 public: 202 UntypedMemberExpr( Expression *member, Expression *aggregate, Expression *_aname = nullptr );202 UntypedMemberExpr( std::string member, Expression *aggregate, Expression *_aname = nullptr ); 203 203 UntypedMemberExpr( const UntypedMemberExpr &other ); 204 204 virtual ~UntypedMemberExpr(); 205 205 206 Expression *get_member() const { return member; }207 void set_member( Expression *newValue ) { member = newValue; }206 std::string get_member() const { return member; } 207 void set_member( const std::string &newValue ) { member = newValue; } 208 208 Expression *get_aggregate() const { return aggregate; } 209 209 void set_aggregate( Expression *newValue ) { aggregate = newValue; } … … 214 214 virtual void print( std::ostream &os, int indent = 0 ) const; 215 215 private: 216 Expression *member;216 std::string member; 217 217 Expression *aggregate; 218 218 }; … … 483 483 }; 484 484 485 /// TupleExpr represents a tuple expression ( [a, b, c] ) 486 class TupleExpr : public Expression { 487 public: 488 TupleExpr( Expression *_aname = nullptr ); 489 TupleExpr( const TupleExpr &other ); 490 virtual ~TupleExpr(); 491 492 void set_exprs( std::list<Expression*> newValue ) { exprs = newValue; } 493 std::list<Expression*>& get_exprs() { return exprs; } 494 495 virtual TupleExpr *clone() const { return new TupleExpr( *this ); } 496 virtual void accept( Visitor &v ) { v.visit( this ); } 497 virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); } 498 virtual void print( std::ostream &os, int indent = 0 ) const; 499 private: 500 std::list<Expression*> exprs; 501 }; 502 503 /// SolvedTupleExpr represents a TupleExpr whose components have been type-resolved. It is effectively a shell for the code generator to work on 504 class SolvedTupleExpr : public Expression { 505 public: 506 SolvedTupleExpr( Expression *_aname = nullptr ) : Expression( _aname ) {} 507 SolvedTupleExpr( std::list<Expression *> &, Expression *_aname = nullptr ); 508 SolvedTupleExpr( const SolvedTupleExpr &other ); 509 virtual ~SolvedTupleExpr() {} 510 511 std::list<Expression*> &get_exprs() { return exprs; } 512 513 virtual SolvedTupleExpr *clone() const { return new SolvedTupleExpr( *this ); } 514 virtual void accept( Visitor &v ) { v.visit( this ); } 515 virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); } 516 virtual void print( std::ostream &os, int indent = 0 ) const; 517 private: 518 std::list<Expression*> exprs; 519 }; 520 485 521 /// TypeExpr represents a type used in an expression (e.g. as a type generator parameter) 486 522 class TypeExpr : public Expression { … … 582 618 CompoundLiteralExpr( Type * type, Initializer * initializer ); 583 619 CompoundLiteralExpr( const CompoundLiteralExpr &other ); 584 virtual~CompoundLiteralExpr();620 ~CompoundLiteralExpr(); 585 621 586 622 Type * get_type() const { return type; } … … 634 670 private: 635 671 Expression *low, *high; 636 };637 638 /// TupleExpr represents a tuple expression ( [a, b, c] )639 class TupleExpr : public Expression {640 public:641 TupleExpr( Expression *_aname = nullptr );642 TupleExpr( const TupleExpr &other );643 virtual ~TupleExpr();644 645 void set_exprs( std::list<Expression*> newValue ) { exprs = newValue; }646 std::list<Expression*>& get_exprs() { return exprs; }647 648 virtual TupleExpr *clone() const { return new TupleExpr( *this ); }649 virtual void accept( Visitor &v ) { v.visit( this ); }650 virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }651 virtual void print( std::ostream &os, int indent = 0 ) const;652 private:653 std::list<Expression*> exprs;654 };655 656 /// TupleIndexExpr represents an element selection operation on a tuple value, e.g. t.3 after processing by the expression analyzer657 class TupleIndexExpr : public Expression {658 public:659 TupleIndexExpr( Expression * tuple, unsigned int index );660 TupleIndexExpr( const TupleIndexExpr &other );661 virtual ~TupleIndexExpr();662 663 Expression * get_tuple() const { return tuple; }664 int get_index() const { return index; }665 TupleIndexExpr * set_tuple( Expression *newValue ) { tuple = newValue; return this; }666 TupleIndexExpr * set_index( unsigned int newValue ) { index = newValue; return this; }667 668 virtual TupleIndexExpr *clone() const { return new TupleIndexExpr( *this ); }669 virtual void accept( Visitor &v ) { v.visit( this ); }670 virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }671 virtual void print( std::ostream &os, int indent = 0 ) const;672 private:673 Expression * tuple;674 unsigned int index;675 };676 677 /// MemberTupleExpr represents a tuple member selection operation on a struct type, e.g. s.[a, b, c] after processing by the expression analyzer678 class MemberTupleExpr : public Expression {679 public:680 MemberTupleExpr( Expression * member, Expression * aggregate, Expression * _aname = nullptr );681 MemberTupleExpr( const MemberTupleExpr &other );682 virtual ~MemberTupleExpr();683 684 Expression * get_member() const { return member; }685 Expression * get_aggregate() const { return aggregate; }686 MemberTupleExpr * set_member( Expression *newValue ) { member = newValue; return this; }687 MemberTupleExpr * set_aggregate( Expression *newValue ) { aggregate = newValue; return this; }688 689 virtual MemberTupleExpr *clone() const { return new MemberTupleExpr( *this ); }690 virtual void accept( Visitor &v ) { v.visit( this ); }691 virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }692 virtual void print( std::ostream &os, int indent = 0 ) const;693 private:694 Expression * member;695 Expression * aggregate;696 };697 698 /// TupleAssignExpr represents a multiple assignment operation, where both sides of the assignment have tuple type, e.g. [a, b, c] = [d, e, f];, or a mass assignment operation, where the left hand side has tuple type and the right hand side does not, e.g. [a, b, c] = 5.0;699 class TupleAssignExpr : public Expression {700 public:701 TupleAssignExpr( const std::list< Expression * > & assigns, const std::list< ObjectDecl * > & tempDecls, Expression * _aname = nullptr );702 TupleAssignExpr( const TupleAssignExpr &other );703 virtual ~TupleAssignExpr();704 705 std::list< Expression * > & get_assigns() { return assigns; }706 std::list< ObjectDecl * > & get_tempDecls() { return tempDecls; }707 708 virtual TupleAssignExpr *clone() const { return new TupleAssignExpr( *this ); }709 virtual void accept( Visitor &v ) { v.visit( this ); }710 virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }711 virtual void print( std::ostream &os, int indent = 0 ) const;712 private:713 std::list< Expression * > assigns; // assignment expressions that use tempDecls714 std::list< ObjectDecl * > tempDecls; // temporaries for address of lhs exprs715 };716 717 /// StmtExpr represents a GCC 'statement expression', e.g. ({ int x = 5; x; })718 class StmtExpr : public Expression {719 public:720 StmtExpr( CompoundStmt *statements );721 StmtExpr( const StmtExpr & other );722 virtual ~StmtExpr();723 724 CompoundStmt * get_statements() const { return statements; }725 StmtExpr * set_statements( CompoundStmt * newValue ) { statements = newValue; return this; }726 727 virtual StmtExpr *clone() const { return new StmtExpr( *this ); }728 virtual void accept( Visitor &v ) { v.visit( this ); }729 virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }730 virtual void print( std::ostream &os, int indent = 0 ) const;731 private:732 CompoundStmt * statements;733 672 }; 734 673 -
src/SynTree/Mutator.cc
r12bc63a rfc4a0fa 178 178 179 179 Expression *Mutator::mutate( ApplicationExpr *applicationExpr ) { 180 applicationExpr->set_result( maybeMutate( applicationExpr->get_result(), *this ));180 mutateAll( applicationExpr->get_results(), *this ); 181 181 applicationExpr->set_function( maybeMutate( applicationExpr->get_function(), *this ) ); 182 182 mutateAll( applicationExpr->get_args(), *this ); … … 185 185 186 186 Expression *Mutator::mutate( UntypedExpr *untypedExpr ) { 187 untypedExpr->set_result( maybeMutate( untypedExpr->get_result(), *this ));187 mutateAll( untypedExpr->get_results(), *this ); 188 188 mutateAll( untypedExpr->get_args(), *this ); 189 189 return untypedExpr; … … 191 191 192 192 Expression *Mutator::mutate( NameExpr *nameExpr ) { 193 nameExpr->set_result( maybeMutate( nameExpr->get_result(), *this ));193 mutateAll( nameExpr->get_results(), *this ); 194 194 return nameExpr; 195 195 } 196 196 197 197 Expression *Mutator::mutate( AddressExpr *addressExpr ) { 198 addressExpr->set_result( maybeMutate( addressExpr->get_result(), *this ));198 mutateAll( addressExpr->get_results(), *this ); 199 199 addressExpr->set_arg( maybeMutate( addressExpr->get_arg(), *this ) ); 200 200 return addressExpr; … … 202 202 203 203 Expression *Mutator::mutate( LabelAddressExpr *labelAddressExpr ) { 204 labelAddressExpr->set_result( maybeMutate( labelAddressExpr->get_result(), *this ));204 mutateAll( labelAddressExpr->get_results(), *this ); 205 205 labelAddressExpr->set_arg( maybeMutate( labelAddressExpr->get_arg(), *this ) ); 206 206 return labelAddressExpr; … … 208 208 209 209 Expression *Mutator::mutate( CastExpr *castExpr ) { 210 castExpr->set_result( maybeMutate( castExpr->get_result(), *this ));210 mutateAll( castExpr->get_results(), *this ); 211 211 castExpr->set_arg( maybeMutate( castExpr->get_arg(), *this ) ); 212 212 return castExpr; … … 214 214 215 215 Expression *Mutator::mutate( UntypedMemberExpr *memberExpr ) { 216 memberExpr->set_result( maybeMutate( memberExpr->get_result(), *this ) ); 217 memberExpr->set_aggregate( maybeMutate( memberExpr->get_aggregate(), *this ) ); 218 memberExpr->set_member( maybeMutate( memberExpr->get_member(), *this ) ); 219 return memberExpr; 220 } 221 222 Expression *Mutator::mutate( MemberExpr *memberExpr ) { 223 memberExpr->set_result( maybeMutate( memberExpr->get_result(), *this ) ); 216 mutateAll( memberExpr->get_results(), *this ); 224 217 memberExpr->set_aggregate( maybeMutate( memberExpr->get_aggregate(), *this ) ); 225 218 return memberExpr; 226 219 } 227 220 221 Expression *Mutator::mutate( MemberExpr *memberExpr ) { 222 mutateAll( memberExpr->get_results(), *this ); 223 memberExpr->set_aggregate( maybeMutate( memberExpr->get_aggregate(), *this ) ); 224 return memberExpr; 225 } 226 228 227 Expression *Mutator::mutate( VariableExpr *variableExpr ) { 229 variableExpr->set_result( maybeMutate( variableExpr->get_result(), *this ));228 mutateAll( variableExpr->get_results(), *this ); 230 229 return variableExpr; 231 230 } 232 231 233 232 Expression *Mutator::mutate( ConstantExpr *constantExpr ) { 234 constantExpr->set_result( maybeMutate( constantExpr->get_result(), *this ));233 mutateAll( constantExpr->get_results(), *this ); 235 234 // maybeMutate( constantExpr->get_constant(), *this ) 236 235 return constantExpr; … … 238 237 239 238 Expression *Mutator::mutate( SizeofExpr *sizeofExpr ) { 240 sizeofExpr->set_result( maybeMutate( sizeofExpr->get_result(), *this ));239 mutateAll( sizeofExpr->get_results(), *this ); 241 240 if ( sizeofExpr->get_isType() ) { 242 241 sizeofExpr->set_type( maybeMutate( sizeofExpr->get_type(), *this ) ); … … 248 247 249 248 Expression *Mutator::mutate( AlignofExpr *alignofExpr ) { 250 alignofExpr->set_result( maybeMutate( alignofExpr->get_result(), *this ));249 mutateAll( alignofExpr->get_results(), *this ); 251 250 if ( alignofExpr->get_isType() ) { 252 251 alignofExpr->set_type( maybeMutate( alignofExpr->get_type(), *this ) ); … … 258 257 259 258 Expression *Mutator::mutate( UntypedOffsetofExpr *offsetofExpr ) { 260 offsetofExpr->set_result( maybeMutate( offsetofExpr->get_result(), *this ));259 mutateAll( offsetofExpr->get_results(), *this ); 261 260 offsetofExpr->set_type( maybeMutate( offsetofExpr->get_type(), *this ) ); 262 261 return offsetofExpr; … … 264 263 265 264 Expression *Mutator::mutate( OffsetofExpr *offsetofExpr ) { 266 offsetofExpr->set_result( maybeMutate( offsetofExpr->get_result(), *this ));265 mutateAll( offsetofExpr->get_results(), *this ); 267 266 offsetofExpr->set_type( maybeMutate( offsetofExpr->get_type(), *this ) ); 268 267 offsetofExpr->set_member( maybeMutate( offsetofExpr->get_member(), *this ) ); … … 271 270 272 271 Expression *Mutator::mutate( OffsetPackExpr *offsetPackExpr ) { 273 offsetPackExpr->set_result( maybeMutate( offsetPackExpr->get_result(), *this ));272 mutateAll( offsetPackExpr->get_results(), *this ); 274 273 offsetPackExpr->set_type( maybeMutate( offsetPackExpr->get_type(), *this ) ); 275 274 return offsetPackExpr; … … 277 276 278 277 Expression *Mutator::mutate( AttrExpr *attrExpr ) { 279 attrExpr->set_result( maybeMutate( attrExpr->get_result(), *this ));278 mutateAll( attrExpr->get_results(), *this ); 280 279 if ( attrExpr->get_isType() ) { 281 280 attrExpr->set_type( maybeMutate( attrExpr->get_type(), *this ) ); … … 287 286 288 287 Expression *Mutator::mutate( LogicalExpr *logicalExpr ) { 289 logicalExpr->set_result( maybeMutate( logicalExpr->get_result(), *this ));288 mutateAll( logicalExpr->get_results(), *this ); 290 289 logicalExpr->set_arg1( maybeMutate( logicalExpr->get_arg1(), *this ) ); 291 290 logicalExpr->set_arg2( maybeMutate( logicalExpr->get_arg2(), *this ) ); … … 294 293 295 294 Expression *Mutator::mutate( ConditionalExpr *conditionalExpr ) { 296 conditionalExpr->set_result( maybeMutate( conditionalExpr->get_result(), *this ));295 mutateAll( conditionalExpr->get_results(), *this ); 297 296 conditionalExpr->set_arg1( maybeMutate( conditionalExpr->get_arg1(), *this ) ); 298 297 conditionalExpr->set_arg2( maybeMutate( conditionalExpr->get_arg2(), *this ) ); … … 302 301 303 302 Expression *Mutator::mutate( CommaExpr *commaExpr ) { 304 commaExpr->set_result( maybeMutate( commaExpr->get_result(), *this ));303 mutateAll( commaExpr->get_results(), *this ); 305 304 commaExpr->set_arg1( maybeMutate( commaExpr->get_arg1(), *this ) ); 306 305 commaExpr->set_arg2( maybeMutate( commaExpr->get_arg2(), *this ) ); … … 308 307 } 309 308 309 Expression *Mutator::mutate( TupleExpr *tupleExpr ) { 310 mutateAll( tupleExpr->get_results(), *this ); 311 mutateAll( tupleExpr->get_exprs(), *this ); 312 return tupleExpr; 313 } 314 315 Expression *Mutator::mutate( SolvedTupleExpr *tupleExpr ) { 316 mutateAll( tupleExpr->get_results(), *this ); 317 mutateAll( tupleExpr->get_exprs(), *this ); 318 return tupleExpr; 319 } 320 310 321 Expression *Mutator::mutate( TypeExpr *typeExpr ) { 311 typeExpr->set_result( maybeMutate( typeExpr->get_result(), *this ));322 mutateAll( typeExpr->get_results(), *this ); 312 323 typeExpr->set_type( maybeMutate( typeExpr->get_type(), *this ) ); 313 324 return typeExpr; … … 329 340 330 341 Expression* Mutator::mutate( ConstructorExpr *ctorExpr ) { 331 ctorExpr->set_result( maybeMutate( ctorExpr->get_result(), *this ));342 mutateAll( ctorExpr->get_results(), *this ); 332 343 ctorExpr->set_callExpr( maybeMutate( ctorExpr->get_callExpr(), *this ) ); 333 344 return ctorExpr; … … 335 346 336 347 Expression *Mutator::mutate( CompoundLiteralExpr *compLitExpr ) { 337 compLitExpr->set_result( maybeMutate( compLitExpr->get_result(), *this ));348 mutateAll( compLitExpr->get_results(), *this ); 338 349 compLitExpr->set_type( maybeMutate( compLitExpr->get_type(), *this ) ); 339 350 compLitExpr->set_initializer( maybeMutate( compLitExpr->get_initializer(), *this ) ); … … 342 353 343 354 Expression *Mutator::mutate( UntypedValofExpr *valofExpr ) { 344 valofExpr->set_result( maybeMutate( valofExpr->get_result(), *this ));355 mutateAll( valofExpr->get_results(), *this ); 345 356 return valofExpr; 346 357 } … … 350 361 rangeExpr->set_high( maybeMutate( rangeExpr->get_high(), *this ) ); 351 362 return rangeExpr; 352 }353 354 Expression *Mutator::mutate( TupleExpr *tupleExpr ) {355 tupleExpr->set_result( maybeMutate( tupleExpr->get_result(), *this ) );356 mutateAll( tupleExpr->get_exprs(), *this );357 return tupleExpr;358 }359 360 Expression *Mutator::mutate( TupleIndexExpr *tupleExpr ) {361 tupleExpr->set_result( maybeMutate( tupleExpr->get_result(), *this ) );362 tupleExpr->set_tuple( maybeMutate( tupleExpr->get_tuple(), *this ) );363 return tupleExpr;364 }365 366 Expression *Mutator::mutate( MemberTupleExpr *tupleExpr ) {367 tupleExpr->set_result( maybeMutate( tupleExpr->get_result(), *this ) );368 tupleExpr->set_member( maybeMutate( tupleExpr->get_member(), *this ) );369 tupleExpr->set_aggregate( maybeMutate( tupleExpr->get_aggregate(), *this ) );370 return tupleExpr;371 }372 373 Expression *Mutator::mutate( TupleAssignExpr *assignExpr ) {374 assignExpr->set_result( maybeMutate( assignExpr->get_result(), *this ) );375 mutateAll( assignExpr->get_tempDecls(), *this );376 mutateAll( assignExpr->get_assigns(), *this );377 return assignExpr;378 }379 380 Expression *Mutator::mutate( StmtExpr *stmtExpr ) {381 stmtExpr->set_result( maybeMutate( stmtExpr->get_result(), *this ) );382 stmtExpr->set_statements( maybeMutate( stmtExpr->get_statements(), *this ) );383 return stmtExpr;384 363 } 385 364 -
src/SynTree/Mutator.h
r12bc63a rfc4a0fa 71 71 virtual Expression* mutate( ConditionalExpr *conditionalExpr ); 72 72 virtual Expression* mutate( CommaExpr *commaExpr ); 73 virtual Expression* mutate( TupleExpr *tupleExpr ); 74 virtual Expression* mutate( SolvedTupleExpr *tupleExpr ); 73 75 virtual Expression* mutate( TypeExpr *typeExpr ); 74 76 virtual Expression* mutate( AsmExpr *asmExpr ); … … 78 80 virtual Expression* mutate( UntypedValofExpr *valofExpr ); 79 81 virtual Expression* mutate( RangeExpr *rangeExpr ); 80 virtual Expression* mutate( TupleExpr *tupleExpr );81 virtual Expression* mutate( TupleIndexExpr *tupleExpr );82 virtual Expression* mutate( MemberTupleExpr *tupleExpr );83 virtual Expression* mutate( TupleAssignExpr *assignExpr );84 virtual Expression* mutate( StmtExpr * stmtExpr );85 82 86 83 virtual Type* mutate( VoidType *basicType ); -
src/SynTree/ReferenceToType.cc
r12bc63a rfc4a0fa 56 56 } 57 57 } // namespace 58 59 StructInstType::StructInstType( const Type::Qualifiers & tq, StructDecl * baseStruct ) : Parent( tq, baseStruct->get_name() ), baseStruct( baseStruct ) {}60 58 61 59 std::string StructInstType::typeString() const { return "struct"; } -
src/SynTree/SynTree.h
r12bc63a rfc4a0fa 76 76 class ConditionalExpr; 77 77 class CommaExpr; 78 class TupleExpr; 79 class SolvedTupleExpr; 78 80 class TypeExpr; 79 81 class AsmExpr; … … 83 85 class UntypedValofExpr; 84 86 class RangeExpr; 85 class TupleExpr;86 class TupleIndexExpr;87 class MemberTupleExpr;88 class TupleAssignExpr;89 class StmtExpr;90 87 91 88 class Type; -
src/SynTree/TupleExpr.cc
r12bc63a rfc4a0fa 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // TupleExpr.cc -- 7 // TupleExpr.cc -- 8 8 // 9 9 // Author : Richard C. Bilson … … 16 16 #include "Expression.h" 17 17 #include "Common/utility.h" 18 #include "Type.h"19 #include "Declaration.h"20 18 21 19 TupleExpr::TupleExpr( Expression *_aname ) : Expression( _aname ) { … … 31 29 32 30 void TupleExpr::print( std::ostream &os, int indent ) const { 33 os << "Tuple:" << std::endl;31 os << std::string( indent, ' ' ) << "Tuple:" << std::endl; 34 32 printAll( exprs, os, indent+2 ); 35 33 Expression::print( os, indent ); 36 34 } 37 35 38 TupleIndexExpr::TupleIndexExpr( Expression * tuple, unsigned int index ) { 39 TupleType * type = safe_dynamic_cast< TupleType * >( tuple->get_result() ); 40 assert( type->size() >= index ); 41 set_result( *std::next( type->get_types().begin(), index ) ); 36 SolvedTupleExpr::SolvedTupleExpr( std::list<Expression *> &_exprs, Expression *_aname ) : Expression( _aname ) { 37 std::copy(_exprs.begin(), _exprs.end(), back_inserter(exprs)); 42 38 } 43 39 44 TupleIndexExpr::TupleIndexExpr( const TupleIndexExpr &other ) : Expression( other ), tuple( other.tuple->clone() ), index( other.index ) { 40 SolvedTupleExpr::SolvedTupleExpr( const SolvedTupleExpr &other ) : Expression( other ) { 41 cloneAll( other.exprs, exprs ); 45 42 } 46 43 47 TupleIndexExpr::~TupleIndexExpr() { 48 delete tuple; 49 } 50 51 void TupleIndexExpr::print( std::ostream &os, int indent ) const { 52 os << "Tuple Index Expression, with tuple:" << std::endl; 53 tuple->print( os, indent+2 ); 54 os << std::string( indent+2, ' ' ) << "with index: " << index << std::endl; 44 void SolvedTupleExpr::print( std::ostream &os, int indent ) const { 45 os << std::string( indent, ' ' ) << "Solved Tuple:" << std::endl; 46 printAll( exprs, os, indent+2 ); 55 47 Expression::print( os, indent ); 56 48 } 57 58 MemberTupleExpr::MemberTupleExpr( Expression * member, Expression * aggregate, Expression * _aname ) : Expression( _aname ) {59 set_result( maybeClone( member->get_result() ) ); // xxx - ???60 }61 62 MemberTupleExpr::MemberTupleExpr( const MemberTupleExpr &other ) : Expression( other ), member( other.member->clone() ), aggregate( other.aggregate->clone() ) {63 }64 65 MemberTupleExpr::~MemberTupleExpr() {66 delete member;67 delete aggregate;68 }69 70 void MemberTupleExpr::print( std::ostream &os, int indent ) const {71 os << "Member Tuple Expression, with aggregate:" << std::endl;72 aggregate->print( os, indent+2 );73 os << std::string( indent+2, ' ' ) << "with member: " << std::endl;74 member->print( os, indent+2 );75 Expression::print( os, indent );76 }77 78 79 TupleAssignExpr::TupleAssignExpr( const std::list< Expression * > & assigns, const std::list< ObjectDecl * > & tempDecls, Expression * _aname ) : Expression( _aname ), assigns( assigns ), tempDecls( tempDecls ) {80 TupleType * type = new TupleType( Type::Qualifiers() );81 for ( Expression * expr : assigns ) {82 assert( expr->has_result() );83 type->get_types().push_back( expr->get_result()->clone() );84 }85 set_result( type );86 }87 88 TupleAssignExpr::TupleAssignExpr( const TupleAssignExpr &other ) : Expression( other ), tempDecls( other.tempDecls ) /* temporary */ {89 cloneAll( other.assigns, assigns );90 // xxx - clone needs to go into assigns and replace tempDecls91 }92 93 TupleAssignExpr::~TupleAssignExpr() {94 deleteAll( assigns );95 // deleteAll( tempDecls );96 }97 98 void TupleAssignExpr::print( std::ostream &os, int indent ) const {99 os << std::string( indent, ' ' ) << "Tuple Assignment Expression, with temporaries:" << std::endl;100 printAll( tempDecls, os, indent+4 );101 os << std::string( indent+2, ' ' ) << "with assignments: " << std::endl;102 printAll( assigns, os, indent+4 );103 Expression::print( os, indent );104 }105 106 107 49 108 50 // Local Variables: // -
src/SynTree/TupleType.cc
r12bc63a rfc4a0fa 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // TupleType.cc -- 7 // TupleType.cc -- 8 8 // 9 9 // Author : Richard C. Bilson … … 17 17 #include "Common/utility.h" 18 18 19 TupleType::TupleType( const Type::Qualifiers &tq , const std::list< Type * > & types ) : Type( tq ), types( types) {19 TupleType::TupleType( const Type::Qualifiers &tq ) : Type( tq ) { 20 20 } 21 21 -
src/SynTree/Type.h
r12bc63a rfc4a0fa 27 27 Qualifiers( bool isConst, bool isVolatile, bool isRestrict, bool isLvalue, bool isAtomic, bool isAttribute ): isConst( isConst ), isVolatile( isVolatile ), isRestrict( isRestrict ), isLvalue( isLvalue ), isAtomic( isAtomic ), isAttribute( isAttribute ) {} 28 28 29 Qualifiers &operator&=( const Qualifiers &other );30 29 Qualifiers &operator+=( const Qualifiers &other ); 31 30 Qualifiers &operator-=( const Qualifiers &other ); … … 66 65 std::list<TypeDecl*>& get_forall() { return forall; } 67 66 68 /// How many elemental types are represented by this type69 virtual unsigned size() const { return 1; };70 virtual bool isVoid() const { return size() == 0; }71 72 67 virtual Type *clone() const = 0; 73 68 virtual void accept( Visitor &v ) = 0; … … 82 77 public: 83 78 VoidType( const Type::Qualifiers &tq ); 84 85 virtual unsigned size() const { return 0; };86 79 87 80 virtual VoidType *clone() const { return new VoidType( *this ); } … … 241 234 public: 242 235 StructInstType( const Type::Qualifiers &tq, const std::string &name ) : Parent( tq, name ), baseStruct( 0 ) {} 243 StructInstType( const Type::Qualifiers &tq, StructDecl * baseStruct );244 236 StructInstType( const StructInstType &other ) : Parent( other ), baseStruct( other.baseStruct ) {} 245 237 … … 356 348 class TupleType : public Type { 357 349 public: 358 TupleType( const Type::Qualifiers &tq , const std::list< Type * > & types = std::list< Type * >());350 TupleType( const Type::Qualifiers &tq ); 359 351 TupleType( const TupleType& ); 360 352 virtual ~TupleType(); 361 353 362 typedef std::list<Type*> value_type;363 typedef value_type::iterator iterator;364 365 354 std::list<Type*>& get_types() { return types; } 366 virtual unsigned size() const { return types.size(); };367 368 iterator begin() { return types.begin(); }369 iterator end() { return types.end(); }370 355 371 356 virtual TupleType *clone() const { return new TupleType( *this ); } … … 433 418 }; 434 419 435 inline Type::Qualifiers &Type::Qualifiers::operator&=( const Type::Qualifiers &other ) {436 isConst &= other.isConst;437 isVolatile &= other.isVolatile;438 isRestrict &= other.isRestrict;439 isLvalue &= other.isLvalue;440 isAtomic &= other.isAtomic;441 return *this;442 }443 444 420 inline Type::Qualifiers &Type::Qualifiers::operator+=( const Type::Qualifiers &other ) { 445 421 isConst |= other.isConst; -
src/SynTree/Visitor.cc
r12bc63a rfc4a0fa 150 150 151 151 void Visitor::visit( ApplicationExpr *applicationExpr ) { 152 maybeAccept( applicationExpr->get_result(), *this );152 acceptAll( applicationExpr->get_results(), *this ); 153 153 maybeAccept( applicationExpr->get_function(), *this ); 154 154 acceptAll( applicationExpr->get_args(), *this ); … … 156 156 157 157 void Visitor::visit( UntypedExpr *untypedExpr ) { 158 maybeAccept( untypedExpr->get_result(), *this );158 acceptAll( untypedExpr->get_results(), *this ); 159 159 acceptAll( untypedExpr->get_args(), *this ); 160 160 } 161 161 162 162 void Visitor::visit( NameExpr *nameExpr ) { 163 maybeAccept( nameExpr->get_result(), *this );163 acceptAll( nameExpr->get_results(), *this ); 164 164 } 165 165 166 166 void Visitor::visit( AddressExpr *addressExpr ) { 167 maybeAccept( addressExpr->get_result(), *this );167 acceptAll( addressExpr->get_results(), *this ); 168 168 maybeAccept( addressExpr->get_arg(), *this ); 169 169 } 170 170 171 171 void Visitor::visit( LabelAddressExpr *labAddressExpr ) { 172 maybeAccept( labAddressExpr->get_result(), *this );172 acceptAll( labAddressExpr->get_results(), *this ); 173 173 maybeAccept( labAddressExpr->get_arg(), *this ); 174 174 } 175 175 176 176 void Visitor::visit( CastExpr *castExpr ) { 177 maybeAccept( castExpr->get_result(), *this );177 acceptAll( castExpr->get_results(), *this ); 178 178 maybeAccept( castExpr->get_arg(), *this ); 179 179 } 180 180 181 181 void Visitor::visit( UntypedMemberExpr *memberExpr ) { 182 maybeAccept( memberExpr->get_result(), *this );182 acceptAll( memberExpr->get_results(), *this ); 183 183 maybeAccept( memberExpr->get_aggregate(), *this ); 184 maybeAccept( memberExpr->get_member(), *this );185 184 } 186 185 187 186 void Visitor::visit( MemberExpr *memberExpr ) { 188 maybeAccept( memberExpr->get_result(), *this );187 acceptAll( memberExpr->get_results(), *this ); 189 188 maybeAccept( memberExpr->get_aggregate(), *this ); 190 189 } 191 190 192 191 void Visitor::visit( VariableExpr *variableExpr ) { 193 maybeAccept( variableExpr->get_result(), *this );192 acceptAll( variableExpr->get_results(), *this ); 194 193 } 195 194 196 195 void Visitor::visit( ConstantExpr *constantExpr ) { 197 maybeAccept( constantExpr->get_result(), *this );196 acceptAll( constantExpr->get_results(), *this ); 198 197 maybeAccept( constantExpr->get_constant(), *this ); 199 198 } 200 199 201 200 void Visitor::visit( SizeofExpr *sizeofExpr ) { 202 maybeAccept( sizeofExpr->get_result(), *this );201 acceptAll( sizeofExpr->get_results(), *this ); 203 202 if ( sizeofExpr->get_isType() ) { 204 203 maybeAccept( sizeofExpr->get_type(), *this ); … … 209 208 210 209 void Visitor::visit( AlignofExpr *alignofExpr ) { 211 maybeAccept( alignofExpr->get_result(), *this );210 acceptAll( alignofExpr->get_results(), *this ); 212 211 if ( alignofExpr->get_isType() ) { 213 212 maybeAccept( alignofExpr->get_type(), *this ); … … 218 217 219 218 void Visitor::visit( UntypedOffsetofExpr *offsetofExpr ) { 220 maybeAccept( offsetofExpr->get_result(), *this );219 acceptAll( offsetofExpr->get_results(), *this ); 221 220 maybeAccept( offsetofExpr->get_type(), *this ); 222 221 } 223 222 224 223 void Visitor::visit( OffsetofExpr *offsetofExpr ) { 225 maybeAccept( offsetofExpr->get_result(), *this );224 acceptAll( offsetofExpr->get_results(), *this ); 226 225 maybeAccept( offsetofExpr->get_type(), *this ); 227 226 maybeAccept( offsetofExpr->get_member(), *this ); … … 229 228 230 229 void Visitor::visit( OffsetPackExpr *offsetPackExpr ) { 231 maybeAccept( offsetPackExpr->get_result(), *this );230 acceptAll( offsetPackExpr->get_results(), *this ); 232 231 maybeAccept( offsetPackExpr->get_type(), *this ); 233 232 } 234 233 235 234 void Visitor::visit( AttrExpr *attrExpr ) { 236 maybeAccept( attrExpr->get_result(), *this );235 acceptAll( attrExpr->get_results(), *this ); 237 236 if ( attrExpr->get_isType() ) { 238 237 maybeAccept( attrExpr->get_type(), *this ); … … 243 242 244 243 void Visitor::visit( LogicalExpr *logicalExpr ) { 245 maybeAccept( logicalExpr->get_result(), *this );244 acceptAll( logicalExpr->get_results(), *this ); 246 245 maybeAccept( logicalExpr->get_arg1(), *this ); 247 246 maybeAccept( logicalExpr->get_arg2(), *this ); … … 249 248 250 249 void Visitor::visit( ConditionalExpr *conditionalExpr ) { 251 maybeAccept( conditionalExpr->get_result(), *this );250 acceptAll( conditionalExpr->get_results(), *this ); 252 251 maybeAccept( conditionalExpr->get_arg1(), *this ); 253 252 maybeAccept( conditionalExpr->get_arg2(), *this ); … … 256 255 257 256 void Visitor::visit( CommaExpr *commaExpr ) { 258 maybeAccept( commaExpr->get_result(), *this );257 acceptAll( commaExpr->get_results(), *this ); 259 258 maybeAccept( commaExpr->get_arg1(), *this ); 260 259 maybeAccept( commaExpr->get_arg2(), *this ); 261 260 } 262 261 262 void Visitor::visit( TupleExpr *tupleExpr ) { 263 acceptAll( tupleExpr->get_results(), *this ); 264 acceptAll( tupleExpr->get_exprs(), *this ); 265 } 266 267 void Visitor::visit( SolvedTupleExpr *tupleExpr ) { 268 acceptAll( tupleExpr->get_results(), *this ); 269 acceptAll( tupleExpr->get_exprs(), *this ); 270 } 271 263 272 void Visitor::visit( TypeExpr *typeExpr ) { 264 maybeAccept( typeExpr->get_result(), *this );273 acceptAll( typeExpr->get_results(), *this ); 265 274 maybeAccept( typeExpr->get_type(), *this ); 266 275 } … … 279 288 280 289 void Visitor::visit( ConstructorExpr * ctorExpr ) { 281 maybeAccept( ctorExpr->get_result(), *this );290 acceptAll( ctorExpr->get_results(), *this ); 282 291 maybeAccept( ctorExpr->get_callExpr(), *this ); 283 292 } 284 293 285 294 void Visitor::visit( CompoundLiteralExpr *compLitExpr ) { 286 maybeAccept( compLitExpr->get_result(), *this );295 acceptAll( compLitExpr->get_results(), *this ); 287 296 maybeAccept( compLitExpr->get_type(), *this ); 288 297 maybeAccept( compLitExpr->get_initializer(), *this ); … … 290 299 291 300 void Visitor::visit( UntypedValofExpr *valofExpr ) { 292 maybeAccept( valofExpr->get_result(), *this );301 acceptAll( valofExpr->get_results(), *this ); 293 302 maybeAccept( valofExpr->get_body(), *this ); 294 303 } … … 297 306 maybeAccept( rangeExpr->get_low(), *this ); 298 307 maybeAccept( rangeExpr->get_high(), *this ); 299 }300 301 void Visitor::visit( TupleExpr *tupleExpr ) {302 maybeAccept( tupleExpr->get_result(), *this );303 acceptAll( tupleExpr->get_exprs(), *this );304 }305 306 void Visitor::visit( TupleIndexExpr *tupleExpr ) {307 maybeAccept( tupleExpr->get_result(), *this );308 maybeAccept( tupleExpr->get_tuple(), *this );309 }310 311 void Visitor::visit( MemberTupleExpr *tupleExpr ) {312 maybeAccept( tupleExpr->get_result(), *this );313 maybeAccept( tupleExpr->get_member(), *this );314 maybeAccept( tupleExpr->get_aggregate(), *this );315 }316 317 void Visitor::visit( TupleAssignExpr *assignExpr ) {318 maybeAccept( assignExpr->get_result(), *this );319 acceptAll( assignExpr->get_tempDecls(), *this );320 acceptAll( assignExpr->get_assigns(), *this );321 }322 323 void Visitor::visit( StmtExpr *stmtExpr ) {324 maybeAccept( stmtExpr->get_result(), *this );325 maybeAccept( stmtExpr->get_statements(), *this );326 308 } 327 309 -
src/SynTree/Visitor.h
r12bc63a rfc4a0fa 71 71 virtual void visit( ConditionalExpr *conditionalExpr ); 72 72 virtual void visit( CommaExpr *commaExpr ); 73 virtual void visit( TupleExpr *tupleExpr ); 74 virtual void visit( SolvedTupleExpr *tupleExpr ); 73 75 virtual void visit( TypeExpr *typeExpr ); 74 76 virtual void visit( AsmExpr *asmExpr ); … … 78 80 virtual void visit( UntypedValofExpr *valofExpr ); 79 81 virtual void visit( RangeExpr *rangeExpr ); 80 virtual void visit( TupleExpr *tupleExpr );81 virtual void visit( TupleIndexExpr *tupleExpr );82 virtual void visit( MemberTupleExpr *tupleExpr );83 virtual void visit( TupleAssignExpr *assignExpr );84 virtual void visit( StmtExpr * stmtExpr );85 82 86 83 virtual void visit( VoidType *basicType ); -
src/Tuples/TupleAssignment.cc
r12bc63a rfc4a0fa 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // TupleAssignment.cc -- 7 // TupleAssignment.cc -- 8 8 // 9 9 // Author : Rodolfo G. Esteves … … 18 18 #include "ResolvExpr/typeops.h" 19 19 #include "SynTree/Expression.h" 20 #include "SynTree/Initializer.h" 21 #include "Tuples.h" 20 #include "TupleAssignment.h" 22 21 #include "Common/SemanticError.h" 23 22 … … 28 27 #include <cassert> 29 28 #include <set> 30 #include <unordered_set>31 29 32 30 namespace Tuples { 33 class TupleAssignSpotter { 34 public: 35 // dispatcher for Tuple (multiple and mass) assignment operations 36 TupleAssignSpotter( ResolvExpr::AlternativeFinder & ); 37 void spot( UntypedExpr * expr, std::list<ResolvExpr::AltList> &possibilities ); 38 39 private: 40 void match(); 41 // records for assignment generation 42 struct Options { 43 void print( std::ostream & ); 44 int size() const { return options.size(); } 45 bool empty() const { return options.empty(); } 46 typedef std::list< ResolvExpr::AltList >::iterator iterator; 47 iterator begin() { return options.begin(); } 48 iterator end() { return options.end(); } 49 50 std::list< ResolvExpr::AltList > options; 51 }; 52 53 struct Matcher { 54 public: 55 Matcher( TupleAssignSpotter &spotter, Expression *_lhs, Expression *_rhs ); 56 virtual ~Matcher() {} 57 virtual void match( std::list< Expression * > &out ) = 0; 58 std::list< Expression * > lhs, rhs; 59 TupleAssignSpotter &spotter; 60 std::list< ObjectDecl * > tmpDecls; 61 }; 62 63 struct MassAssignMatcher : public Matcher { 64 public: 65 MassAssignMatcher( TupleAssignSpotter &spotter, Expression *lhs, Expression *rhs ) : Matcher( spotter, lhs, rhs ) { 66 this->rhs.push_back( rhs ); 31 TupleAssignSpotter::TupleAssignSpotter( ResolvExpr::AlternativeFinder *f = 0 ) 32 : currentFinder(f), matcher(0), hasMatched( false ) {} 33 34 bool TupleAssignSpotter::pointsToTuple( Expression *expr ) { 35 // also check for function returning tuple of reference types 36 if (AddressExpr *addr = dynamic_cast<AddressExpr *>(expr) ) 37 if ( isTuple(addr->get_arg() ) ) 38 return true; 39 return false; 40 } 41 42 bool TupleAssignSpotter::isTupleVar( DeclarationWithType *decl ) { 43 if ( dynamic_cast<TupleType *>(decl->get_type()) ) 44 return true; 45 return false; 46 } 47 48 bool TupleAssignSpotter::isTuple( Expression *expr, bool isRight ) { 49 // true if `expr' is an expression returning a tuple: tuple, tuple variable or MRV function 50 if ( ! expr ) return false; 51 52 if ( dynamic_cast<TupleExpr *>(expr) ) 53 return true; 54 else if ( VariableExpr *var = dynamic_cast<VariableExpr *>(expr) ) { 55 if ( isTupleVar(var->get_var()) ) 56 return true; 57 } 58 59 return false; 60 } 61 62 bool TupleAssignSpotter::match() { 63 assert ( matcher != 0 ); 64 65 std::list< Expression * > new_assigns; 66 if ( ! matcher->match(new_assigns) ) 67 return false; 68 69 if ( new_assigns.empty() ) return false; 70 /*return */matcher->solve( new_assigns ); 71 if ( dynamic_cast<TupleAssignSpotter::MultipleAssignMatcher *>( matcher ) ) { 72 // now resolve new assignments 73 std::list< Expression * > solved_assigns; 74 ResolvExpr::AltList solved_alts; 75 assert( currentFinder != 0 ); 76 77 ResolvExpr::AltList current; 78 for ( std::list< Expression * >::iterator i = new_assigns.begin(); i != new_assigns.end(); ++i ) { 79 //try { 80 ResolvExpr::AlternativeFinder finder( currentFinder->get_indexer(), currentFinder->get_environ() ); 81 finder.findWithAdjustment(*i); 82 // prune expressions that don't coincide with 83 ResolvExpr::AltList alts = finder.get_alternatives(); 84 assert( alts.size() == 1 ); 85 assert(alts.front().expr != 0 ); 86 current.push_back( finder.get_alternatives().front() ); 87 solved_assigns.push_back( alts.front().expr->clone() ); 88 //solved_assigns.back()->print(std::cerr); 89 /*} catch( ... ) { 90 continue; // no reasonable alternative found 91 }*/ 67 92 } 68 virtual void match( std::list< Expression * > &out ); 69 }; 70 71 struct MultipleAssignMatcher : public Matcher { 72 public: 73 MultipleAssignMatcher( TupleAssignSpotter &spot, Expression *lhs, Expression *rhs ); 74 virtual void match( std::list< Expression * > &out ); 75 }; 76 77 ResolvExpr::AlternativeFinder ¤tFinder; 78 // Expression *rhs, *lhs; 79 Matcher *matcher = nullptr; 80 Options options; 81 }; 82 83 bool isTupleVar( DeclarationWithType *decl ) { 84 return dynamic_cast< TupleType * >( decl->get_type() ); 85 } 86 87 /// true if expr is an expression of tuple type, i.e. a tuple expression, tuple variable, or MRV (multiple-return-value) function 88 bool isTuple( Expression *expr ) { 89 if ( ! expr ) return false; 90 assert( expr->has_result() ); 91 // xxx - used to include cast to varExpr and call to isTupleVar, but this doesn't seem like it should be necessary 92 return dynamic_cast<TupleExpr *>(expr) || expr->get_result()->size() > 1; 93 } 94 95 bool pointsToTuple( Expression *expr ) { 96 // also check for function returning tuple of reference types 97 if ( AddressExpr *addr = dynamic_cast< AddressExpr * >( expr) ) { 98 return isTuple( addr->get_arg() ); 99 } 100 return false; 101 } 102 103 bool isTupleExpr( Expression *expr ) { 104 assert( expr->has_result() ); 105 return expr->get_result()->size() > 1; 106 } 107 108 void handleTupleAssignment( ResolvExpr::AlternativeFinder & currentFinder, UntypedExpr * expr, std::list<ResolvExpr::AltList> &possibilities ) { 109 TupleAssignSpotter spotter( currentFinder ); 110 spotter.spot( expr, possibilities ); 111 } 112 113 TupleAssignSpotter::TupleAssignSpotter( ResolvExpr::AlternativeFinder &f ) 114 : currentFinder(f) {} 115 116 void TupleAssignSpotter::spot( UntypedExpr * expr, std::list<ResolvExpr::AltList> &possibilities ) { 93 options.add_option( current ); 94 95 return true; 96 } else { // mass assignment 97 //if ( new_assigns.empty() ) return false; 98 std::list< Expression * > solved_assigns; 99 ResolvExpr::AltList solved_alts; 100 assert( currentFinder != 0 ); 101 102 ResolvExpr::AltList current; 103 if ( optMass.empty() ) { 104 for ( std::list< Expression * >::size_type i = 0; i != new_assigns.size(); ++i ) 105 optMass.push_back( ResolvExpr::AltList() ); 106 } 107 int cnt = 0; 108 for ( std::list< Expression * >::iterator i = new_assigns.begin(); i != new_assigns.end(); ++i, cnt++ ) { 109 110 ResolvExpr::AlternativeFinder finder( currentFinder->get_indexer(), currentFinder->get_environ() ); 111 finder.findWithAdjustment(*i); 112 ResolvExpr::AltList alts = finder.get_alternatives(); 113 assert( alts.size() == 1 ); 114 assert(alts.front().expr != 0 ); 115 current.push_back( finder.get_alternatives().front() ); 116 optMass[cnt].push_back( finder.get_alternatives().front() ); 117 solved_assigns.push_back( alts.front().expr->clone() ); 118 } 119 120 return true; 121 } 122 123 return false; 124 } 125 126 bool TupleAssignSpotter::isMVR( Expression *expr ) { 127 if ( expr->get_results().size() > 1 ) { 128 // MVR processing 129 return true; 130 } 131 return false; 132 } 133 134 bool TupleAssignSpotter::isTupleAssignment( UntypedExpr * expr, std::list<ResolvExpr::AltList> &possibilities ) { 117 135 if ( NameExpr *assgnop = dynamic_cast< NameExpr * >(expr->get_function()) ) { 136 118 137 if ( assgnop->get_name() == std::string("?=?") ) { 138 119 139 for ( std::list<ResolvExpr::AltList>::iterator ali = possibilities.begin(); ali != possibilities.end(); ++ali ) { 120 140 assert( ali->size() == 2 ); 121 ResolvExpr::Alternative op1 = ali->front(), op2 = ali->back(); 122 123 MultipleAssignMatcher multiMatcher( *this, op1.expr, op2.expr ); 124 MassAssignMatcher massMatcher( *this, op1.expr, op2.expr ); 141 ResolvExpr::AltList::iterator opit = ali->begin(); 142 ResolvExpr::Alternative op1 = *opit, op2 = *(++opit); 143 125 144 if ( pointsToTuple(op1.expr) ) { // also handles tuple vars 126 if ( isTuple( op2.expr ) ) { 127 matcher = &multiMatcher; 128 } else { 145 if ( isTuple( op2.expr, true ) ) 146 matcher = new MultipleAssignMatcher(op1.expr, op2.expr); 147 else if ( isMVR( op2.expr ) ) { 148 // handle MVR differently 149 } else 129 150 // mass assignment 130 matcher = &massMatcher; 151 matcher = new MassAssignMatcher(op1.expr, op2.expr); 152 153 std::list< ResolvExpr::AltList > options; 154 if ( match() ) 155 /* 156 if ( hasMatched ) { 157 // throw SemanticError("Ambiguous tuple assignment"); 158 } else {*/ 159 // Matched for the first time 160 hasMatched = true; 161 /*} */ 162 } /* else if ( isTuple( op2 ) ) 163 throw SemanticError("Inapplicable tuple assignment."); 164 */ 165 } 166 167 if ( hasMatched ) { 168 if ( dynamic_cast<TupleAssignSpotter::MultipleAssignMatcher *>( matcher ) ) { 169 //options.print( std::cerr ); 170 std::list< ResolvExpr::AltList >best = options.get_best(); 171 if ( best.size() == 1 ) { 172 std::list<Expression *> solved_assigns; 173 for ( ResolvExpr::AltList::iterator i = best.front().begin(); i != best.front().end(); ++i ) { 174 solved_assigns.push_back( i->expr ); 175 } 176 /* assigning cost zero? */ 177 currentFinder->get_alternatives().push_front( ResolvExpr::Alternative(new SolvedTupleExpr(solved_assigns/*, SolvedTupleExpr::MULTIPLE*/), currentFinder->get_environ(), ResolvExpr::Cost() ) ); 131 178 } 132 match(); 133 } else if ( isTuple( op2.expr ) ) { 134 throw SemanticError("Cannot assign a tuple value into a non-tuple lvalue.", expr); 179 } else { 180 assert( ! optMass.empty() ); 181 ResolvExpr::AltList winners; 182 for ( std::vector< ResolvExpr::AltList >::iterator i = optMass.begin(); i != optMass.end(); ++i ) 183 findMinCostAlt( i->begin(), i->end(), back_inserter(winners) ); 184 185 std::list< Expression *> solved_assigns; 186 for ( ResolvExpr::AltList::iterator i = winners.begin(); i != winners.end(); ++i ) 187 solved_assigns.push_back( i->expr ); 188 currentFinder->get_alternatives().push_front( ResolvExpr::Alternative(new SolvedTupleExpr(solved_assigns/*, SolvedTupleExpr::MASS*/), currentFinder->get_environ(), ResolvExpr::Cost() ) ); 135 189 } 136 190 } 137 191 } 138 192 } 139 } 140 141 void TupleAssignSpotter::match() { 142 assert ( matcher != 0 ); 143 144 std::list< Expression * > new_assigns; 145 matcher->match( new_assigns ); 146 147 if ( new_assigns.empty() ) return; 148 ResolvExpr::AltList current; 149 // now resolve new assignments 150 for ( std::list< Expression * >::iterator i = new_assigns.begin(); i != new_assigns.end(); ++i ) { 151 ResolvExpr::AlternativeFinder finder( currentFinder.get_indexer(), currentFinder.get_environ() ); 152 finder.findWithAdjustment(*i); 153 // prune expressions that don't coincide with 154 ResolvExpr::AltList alts = finder.get_alternatives(); 155 assert( alts.size() == 1 ); 156 assert( alts.front().expr != 0 ); 157 current.push_back( alts.front() ); 158 } 159 160 // extract expressions from the assignment alternatives to produce a list of assignments that 161 // together form a single alternative 162 std::list< Expression *> solved_assigns; 163 for ( ResolvExpr::Alternative & alt : current ) { 164 solved_assigns.push_back( alt.expr->clone() ); 165 } 166 // xxx - need to do this?? 167 // TypeEnvironment compositeEnv; 168 // simpleCombineEnvironments( i->begin(), i->end(), compositeEnv ); 169 currentFinder.get_alternatives().push_front( ResolvExpr::Alternative(new TupleAssignExpr(solved_assigns, matcher->tmpDecls), currentFinder.get_environ(), ResolvExpr::sumCost( current ) ) ); 170 } 171 172 TupleAssignSpotter::Matcher::Matcher( TupleAssignSpotter &spotter, Expression *lhs, Expression *rhs ) : spotter(spotter) { 173 // xxx - shouldn't need to be &<tuple-expr>, just &<lvalue-tuple-type> 174 if (AddressExpr *addr = dynamic_cast<AddressExpr *>(lhs) ) 193 return hasMatched; 194 } 195 196 void TupleAssignSpotter::Matcher::init( Expression *_lhs, Expression *_rhs ) { 197 lhs.clear(); 198 if (AddressExpr *addr = dynamic_cast<AddressExpr *>(_lhs) ) 175 199 if ( TupleExpr *tuple = dynamic_cast<TupleExpr *>(addr->get_arg()) ) 176 std::copy( tuple->get_exprs().begin(), tuple->get_exprs().end(), back_inserter(this->lhs) ); 177 } 178 179 TupleAssignSpotter::MultipleAssignMatcher::MultipleAssignMatcher( TupleAssignSpotter &spotter, Expression *lhs, Expression *rhs ) : Matcher( spotter, lhs, rhs ) { 180 181 if ( TupleExpr *tuple = dynamic_cast<TupleExpr *>(rhs) ) 182 std::copy( tuple->get_exprs().begin(), tuple->get_exprs().end(), back_inserter(this->rhs) ); 183 } 184 185 UntypedExpr * createAssgn( ObjectDecl *left, ObjectDecl *right ) { 186 assert( left && right ); 187 std::list< Expression * > args; 188 args.push_back( new AddressExpr( new UntypedExpr( new NameExpr("*?"), std::list< Expression * >{ new VariableExpr( left ) } ) ) ); 189 args.push_back( new VariableExpr( right ) ); 190 return new UntypedExpr( new NameExpr( "?=?" ), args ); 191 } 192 193 ObjectDecl * newObject( UniqueName & namer, Expression * expr ) { 194 assert( expr->has_result() && ! expr->get_result()->isVoid() ); 195 return new ObjectDecl( namer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, expr->get_result()->clone(), new SingleInit( expr->clone() ) ); 196 } 197 198 void TupleAssignSpotter::MassAssignMatcher::match( std::list< Expression * > &out ) { 199 static UniqueName lhsNamer( "__massassign_L" ); 200 static UniqueName rhsNamer( "__massassign_R" ); 201 assert ( ! lhs.empty() && rhs.size() == 1); 202 203 ObjectDecl * rtmp = newObject( rhsNamer, rhs.front() ); 204 for ( Expression * l : lhs ) { 205 ObjectDecl * ltmp = newObject( lhsNamer, new AddressExpr( l ) ); 206 out.push_back( createAssgn( ltmp, rtmp ) ); 207 tmpDecls.push_back( ltmp ); 208 } 209 tmpDecls.push_back( rtmp ); 210 } 211 212 void TupleAssignSpotter::MultipleAssignMatcher::match( std::list< Expression * > &out ) { 213 static UniqueName lhsNamer( "__multassign_L" ); 214 static UniqueName rhsNamer( "__multassign_R" ); 215 // xxx - need more complicated matching? 200 std::copy( tuple->get_exprs().begin(), tuple->get_exprs().end(), back_inserter(lhs) ); 201 202 rhs.clear(); 203 } 204 205 TupleAssignSpotter::Matcher::Matcher( /*TupleAssignSpotter &spot,*/ Expression *_lhs, Expression *_rhs ) /*: own_spotter(spot) */{ 206 init(_lhs,_rhs); 207 } 208 209 TupleAssignSpotter::MultipleAssignMatcher::MultipleAssignMatcher( Expression *_lhs, Expression *_rhs )/* : own_spotter(spot) */{ 210 init(_lhs,_rhs); 211 212 if ( TupleExpr *tuple = dynamic_cast<TupleExpr *>(_rhs) ) 213 std::copy( tuple->get_exprs().begin(), tuple->get_exprs().end(), back_inserter(rhs) ); 214 } 215 216 UntypedExpr *TupleAssignSpotter::Matcher::createAssgn( Expression *left, Expression *right ) { 217 if ( left && right ) { 218 std::list< Expression * > args; 219 args.push_back(new AddressExpr(left->clone())); args.push_back(right->clone()); 220 return new UntypedExpr(new NameExpr("?=?"), args); 221 } else 222 throw 0; // xxx - diagnose the problem 223 } 224 225 bool TupleAssignSpotter::MassAssignMatcher::match( std::list< Expression * > &out ) { 226 if ( lhs.empty() || (rhs.size() != 1) ) return false; 227 228 for ( std::list< Expression * >::iterator l = lhs.begin(); l != lhs.end(); l++ ) { 229 std::list< Expression * > args; 230 args.push_back( new AddressExpr(*l) ); 231 args.push_back( rhs.front() ); 232 out.push_back( new UntypedExpr(new NameExpr("?=?"), args) ); 233 } 234 235 return true; 236 } 237 238 bool TupleAssignSpotter::MassAssignMatcher::solve( std::list< Expression * > &assigns ) { 239 /* 240 std::list< Expression * > solved_assigns; 241 ResolvExpr::AltList solved_alts; 242 assert( currentFinder != 0 ); 243 244 ResolvExpr::AltList current; 245 if ( optMass.empty() ) { 246 for ( std::list< Expression * >::size_type i = 0; i != new_assigns.size(); ++i ) 247 optMass.push_back( ResolvExpr::AltList() ); 248 } 249 int cnt = 0; 250 for ( std::list< Expression * >::iterator i = new_assigns.begin(); i != new_assigns.end(); ++i, cnt++ ) { 251 252 ResolvExpr::AlternativeFinder finder( currentFinder->get_indexer(), currentFinder->get_environ() ); 253 finder.findWithAdjustment(*i); 254 ResolvExpr::AltList alts = finder.get_alternatives(); 255 assert( alts.size() == 1 ); 256 assert(alts.front().expr != 0 ); 257 current.push_back( finder.get_alternatives().front() ); 258 optMass[cnt].push_back( finder.get_alternatives().front() ); 259 solved_assigns.push_back( alts.front().expr->clone() ); 260 } 261 */ 262 return true; 263 } 264 265 bool TupleAssignSpotter::MultipleAssignMatcher::match( std::list< Expression * > &out ) { 266 // need more complicated matching 216 267 if ( lhs.size() == rhs.size() ) { 217 std::list< ObjectDecl * > ltmp; 218 std::list< ObjectDecl * > rtmp; 219 std::transform( lhs.begin(), lhs.end(), back_inserter( ltmp ), []( Expression * expr ){ 220 return newObject( lhsNamer, new AddressExpr( expr ) ); 221 }); 222 std::transform( rhs.begin(), rhs.end(), back_inserter( rtmp ), []( Expression * expr ){ 223 return newObject( rhsNamer, expr ); 224 }); 225 zipWith( ltmp.begin(), ltmp.end(), rtmp.begin(), rtmp.end(), back_inserter(out), createAssgn ); 226 tmpDecls.splice( tmpDecls.end(), ltmp ); 227 tmpDecls.splice( tmpDecls.end(), rtmp ); 228 } 268 zipWith( lhs.begin(), lhs.end(), rhs.begin(), rhs.end(), back_inserter(out), TupleAssignSpotter::Matcher::createAssgn ); 269 return true; 270 } //else 271 //std::cerr << "The length of (left, right) is: (" << lhs.size() << "," << rhs.size() << ")" << std::endl;*/ 272 return false; 273 } 274 275 bool TupleAssignSpotter::MultipleAssignMatcher::solve( std::list< Expression * > &assigns ) { 276 /* 277 std::list< Expression * > solved_assigns; 278 ResolvExpr::AltList solved_alts; 279 assert( currentFinder != 0 ); 280 281 ResolvExpr::AltList current; 282 for ( std::list< Expression * >::iterator i = new_assigns.begin(); i != new_assigns.end(); ++i ) { 283 //try { 284 ResolvExpr::AlternativeFinder finder( currentFinder->get_indexer(), currentFinder->get_environ() ); 285 finder.findWithAdjustment(*i); 286 // prune expressions that don't coincide with 287 ResolvExpr::AltList alts = finder.get_alternatives(); 288 assert( alts.size() == 1 ); 289 assert(alts.front().expr != 0 ); 290 current.push_back( finder.get_alternatives().front() ); 291 solved_assigns.push_back( alts.front().expr->clone() ); 292 //solved_assigns.back()->print(std::cerr); 293 //} catch( ... ) { 294 //continue; // no reasonable alternative found 295 //} 296 } 297 options.add_option( current ); 298 */ 299 300 return true; 301 } 302 303 void TupleAssignSpotter::Options::add_option( ResolvExpr::AltList &opt ) { 304 using namespace std; 305 306 options.push_back( opt ); 307 /* 308 vector< Cost > costs; 309 costs.reserve( opt.size() ); 310 transform( opt.begin(), opt.end(), back_inserter(costs), ptr_fun(extract_cost) ); 311 */ 312 // transpose matrix 313 if ( costMatrix.empty() ) 314 for ( unsigned int i = 0; i< opt.size(); ++i) 315 costMatrix.push_back( vector<ResolvExpr::Cost>() ); 316 317 int cnt = 0; 318 for ( ResolvExpr::AltList::iterator i = opt.begin(); i != opt.end(); ++i, cnt++ ) 319 costMatrix[cnt].push_back( i->cost ); 320 321 return; 322 } 323 324 std::list< ResolvExpr::AltList > TupleAssignSpotter::Options::get_best() { 325 using namespace std; 326 using namespace ResolvExpr; 327 list< ResolvExpr::AltList > ret; 328 list< multiset<int> > solns; 329 for ( vector< vector<Cost> >::iterator i = costMatrix.begin(); i != costMatrix.end(); ++i ) { 330 list<int> current; 331 findMinCost( i->begin(), i->end(), back_inserter(current) ); 332 solns.push_back( multiset<int>(current.begin(), current.end()) ); 333 } 334 // need to combine 335 multiset<int> result; 336 lift_intersection( solns.begin(), solns.end(), inserter( result, result.begin() ) ); 337 if ( result.size() != 1 ) 338 throw SemanticError("Ambiguous tuple expression"); 339 ret.push_back(get_option( *(result.begin() ))); 340 return ret; 229 341 } 230 342 231 343 void TupleAssignSpotter::Options::print( std::ostream &ostr ) { 232 for ( ResolvExpr::AltList & l : options ) {233 for ( ResolvExpr::Alternative & alt : l ) { 234 alt.print( ostr );235 ostr << " ";236 }344 using namespace std; 345 346 for ( vector< vector < ResolvExpr::Cost > >::iterator i = costMatrix.begin(); i != costMatrix.end(); ++i ) { 347 for ( vector < ResolvExpr::Cost >::iterator j = i->begin(); j != i->end(); ++j ) 348 ostr << *j << " " ; 237 349 ostr << std::endl; 238 350 } // for 351 return; 352 } 353 354 ResolvExpr::Cost extract_cost( ResolvExpr::Alternative &alt ) { 355 return alt.cost; 356 } 357 358 template< typename InputIterator, typename OutputIterator > 359 void TupleAssignSpotter::Options::findMinCost( InputIterator begin, InputIterator end, OutputIterator out ) { 360 using namespace ResolvExpr; 361 std::list<int> alternatives; 362 363 // select the alternatives that have the minimum parameter cost 364 Cost minCost = Cost::infinity; 365 unsigned int index = 0; 366 for ( InputIterator i = begin; i != end; ++i, index++ ) { 367 if ( *i < minCost ) { 368 minCost = *i; 369 alternatives.clear(); 370 alternatives.push_back( index ); 371 } else if ( *i == minCost ) { 372 alternatives.push_back( index ); 373 } 374 } 375 std::copy( alternatives.begin(), alternatives.end(), out ); 376 } 377 378 template< class InputIterator, class OutputIterator > 379 void TupleAssignSpotter::Options::lift_intersection( InputIterator begin, InputIterator end, OutputIterator out ) { 380 if ( begin == end ) return; 381 InputIterator test = begin; 382 383 if (++test == end) 384 { copy(begin->begin(), begin->end(), out); return; } 385 386 387 std::multiset<int> cur; // InputIterator::value_type::value_type 388 copy( begin->begin(), begin->end(), inserter( cur, cur.begin() ) ); 389 390 while ( test != end ) { 391 std::multiset<int> temp; 392 set_intersection( cur.begin(), cur.end(), test->begin(), test->end(), inserter(temp,temp.begin()) ); 393 cur.clear(); 394 copy( temp.begin(), temp.end(), inserter(cur,cur.begin())); 395 ++test; 396 } 397 398 copy( cur.begin(), cur.end(), out ); 399 return; 400 } 401 402 ResolvExpr::AltList TupleAssignSpotter::Options::get_option( std::list< ResolvExpr::AltList >::size_type index ) { 403 if ( index >= options.size() ) 404 throw 0; // XXX 405 std::list< ResolvExpr::AltList >::iterator it = options.begin(); 406 for ( std::list< ResolvExpr::AltList >::size_type i = 0; i < index; ++i, ++it ); 407 return *it; 239 408 } 240 409 } // namespace Tuples -
src/Tuples/module.mk
r12bc63a rfc4a0fa 6 6 ## file "LICENCE" distributed with Cforall. 7 7 ## 8 ## module.mk -- 8 ## module.mk -- 9 9 ## 10 10 ## Author : Richard C. Bilson … … 16 16 17 17 SRC += Tuples/TupleAssignment.cc \ 18 Tuples/ TupleExpansion.cc18 Tuples/NameMatcher.cc -
src/main.cc
r12bc63a rfc4a0fa 42 42 #include "Common/UnimplementedError.h" 43 43 #include "../config.h" 44 #include "Tuples/Tuples.h"45 44 46 45 using namespace std; … … 266 265 OPTPRINT( "convertLvalue" ) 267 266 GenPoly::convertLvalue( translationUnit ); 268 OPTPRINT( "expandTuples" ); // xxx - is this the right place for this?269 Tuples::expandTuples( translationUnit );270 267 271 268 if ( bboxp ) {
Note:
See TracChangeset
for help on using the changeset viewer.