- Timestamp:
- Sep 13, 2017, 2:34:55 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 982832e
- Parents:
- 9f5ecf5
- Location:
- src
- Files:
-
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Concurrency/Waitfor.cc
r9f5ecf5 re3e16bc 228 228 decl_acceptable = decl; 229 229 for( Declaration * field : decl_acceptable->members ) { 230 if( field->name == "func" ) decl_m_func = s afe_dynamic_cast< DeclarationWithType * >( field );231 else if( field->name == "count" ) decl_m_count = s afe_dynamic_cast< DeclarationWithType * >( field );232 else if( field->name == "monitor" ) decl_m_monitors = s afe_dynamic_cast< DeclarationWithType * >( field );233 else if( field->name == "is_dtor" ) decl_m_isdtor = s afe_dynamic_cast< DeclarationWithType * >( field );230 if( field->name == "func" ) decl_m_func = strict_dynamic_cast< DeclarationWithType * >( field ); 231 else if( field->name == "count" ) decl_m_count = strict_dynamic_cast< DeclarationWithType * >( field ); 232 else if( field->name == "monitor" ) decl_m_monitors = strict_dynamic_cast< DeclarationWithType * >( field ); 233 else if( field->name == "is_dtor" ) decl_m_isdtor = strict_dynamic_cast< DeclarationWithType * >( field ); 234 234 } 235 235 -
src/GenPoly/Box.cc
r9f5ecf5 re3e16bc 15 15 16 16 #include <algorithm> // for mismatch 17 #include <cassert> // for assert, s afe_dynamic_cast17 #include <cassert> // for assert, strict_dynamic_cast 18 18 #include <iostream> // for operator<<, stringstream 19 19 #include <list> // for list, list<>::iterator, _Lis... … … 1299 1299 1300 1300 DeclarationWithType * Pass2::mutate( FunctionDecl *functionDecl ) { 1301 functionDecl = s afe_dynamic_cast< FunctionDecl * > ( handleDecl( functionDecl ) );1301 functionDecl = strict_dynamic_cast< FunctionDecl * > ( handleDecl( functionDecl ) ); 1302 1302 FunctionType * ftype = functionDecl->get_functionType(); 1303 1303 if ( ! ftype->get_returnVals().empty() && functionDecl->get_statements() ) { … … 1378 1378 // move polymorphic return type to parameter list 1379 1379 if ( isDynRet( funcType ) ) { 1380 ObjectDecl *ret = s afe_dynamic_cast< ObjectDecl* >( funcType->get_returnVals().front() );1380 ObjectDecl *ret = strict_dynamic_cast< ObjectDecl* >( funcType->get_returnVals().front() ); 1381 1381 ret->set_type( new PointerType( Type::Qualifiers(), ret->get_type() ) ); 1382 1382 funcType->get_parameters().push_front( ret ); -
src/GenPoly/InstantiateGeneric.cc
r9f5ecf5 re3e16bc 459 459 Declaration * member = *std::next( aggr->members.begin(), memberIndex ); 460 460 assertf( member->name == memberExpr->member->name, "Instantiation has different member order than the generic type. %s / %s", toString( member ).c_str(), toString( memberExpr->member ).c_str() ); 461 DeclarationWithType * field = s afe_dynamic_cast< DeclarationWithType * >( member );461 DeclarationWithType * field = strict_dynamic_cast< DeclarationWithType * >( member ); 462 462 MemberExpr * ret = new MemberExpr( field, memberExpr->aggregate->clone() ); 463 463 std::swap( ret->env, memberExpr->env ); -
src/GenPoly/Lvalue.cc
r9f5ecf5 re3e16bc 14 14 // 15 15 16 #include <cassert> // for s afe_dynamic_cast16 #include <cassert> // for strict_dynamic_cast 17 17 #include <string> // for string 18 18 -
src/InitTweak/FixInit.cc
r9f5ecf5 re3e16bc 17 17 #include <stddef.h> // for NULL 18 18 #include <algorithm> // for set_difference, copy_if 19 #include <cassert> // for assert, s afe_dynamic_cast19 #include <cassert> // for assert, strict_dynamic_cast 20 20 #include <iostream> // for operator<<, ostream, basic_ost... 21 21 #include <iterator> // for insert_iterator, back_inserter … … 424 424 // arrays are not copy constructed, so this should always be an ExprStmt 425 425 ImplicitCtorDtorStmt * stmt = genCtorDtor( fname, var, cpArg ); 426 ExprStmt * exprStmt = s afe_dynamic_cast< ExprStmt * >( stmt->get_callStmt() );426 ExprStmt * exprStmt = strict_dynamic_cast< ExprStmt * >( stmt->get_callStmt() ); 427 427 Expression * untyped = exprStmt->get_expr(); 428 428 … … 532 532 assert( ! body->get_kids().empty() ); 533 533 // must be an ExprStmt, otherwise it wouldn't have a result 534 ExprStmt * last = s afe_dynamic_cast< ExprStmt * >( body->get_kids().back() );534 ExprStmt * last = strict_dynamic_cast< ExprStmt * >( body->get_kids().back() ); 535 535 last->set_expr( makeCtorDtor( "?{}", ret, last->get_expr() ) ); 536 536 … … 566 566 CP_CTOR_PRINT( std::cerr << "FixCopyCtors: " << impCpCtorExpr << std::endl; ) 567 567 568 impCpCtorExpr = s afe_dynamic_cast< ImplicitCopyCtorExpr * >( Parent::mutate( impCpCtorExpr ) );568 impCpCtorExpr = strict_dynamic_cast< ImplicitCopyCtorExpr * >( Parent::mutate( impCpCtorExpr ) ); 569 569 std::list< ObjectDecl * > & tempDecls = impCpCtorExpr->get_tempDecls(); 570 570 std::list< ObjectDecl * > & returnDecls = impCpCtorExpr->get_returnDecls(); … … 627 627 stmt = stmt->acceptMutator( *this ); 628 628 } // for 629 // stmtExpr = s afe_dynamic_cast< StmtExpr * >( Parent::mutate( stmtExpr ) );629 // stmtExpr = strict_dynamic_cast< StmtExpr * >( Parent::mutate( stmtExpr ) ); 630 630 assert( stmtExpr->get_result() ); 631 631 Type * result = stmtExpr->get_result(); … … 791 791 } 792 792 } else { 793 ImplicitCtorDtorStmt * implicit = s afe_dynamic_cast< ImplicitCtorDtorStmt * > ( ctor );793 ImplicitCtorDtorStmt * implicit = strict_dynamic_cast< ImplicitCtorDtorStmt * > ( ctor ); 794 794 ExprStmt * ctorStmt = dynamic_cast< ExprStmt * >( implicit->get_callStmt() ); 795 795 ApplicationExpr * ctorCall = nullptr; … … 996 996 FunctionType * type = function->get_functionType(); 997 997 assert( ! type->get_parameters().empty() ); 998 thisParam = s afe_dynamic_cast< ObjectDecl * >( type->get_parameters().front() );998 thisParam = strict_dynamic_cast< ObjectDecl * >( type->get_parameters().front() ); 999 999 Type * thisType = getPointerBase( thisParam->get_type() ); 1000 1000 StructInstType * structType = dynamic_cast< StructInstType * >( thisType ); … … 1166 1166 1167 1167 Expression* MutatingResolver::mutate( UntypedExpr *untypedExpr ) { 1168 return s afe_dynamic_cast< ApplicationExpr * >( ResolvExpr::findVoidExpression( untypedExpr, indexer ) );1168 return strict_dynamic_cast< ApplicationExpr * >( ResolvExpr::findVoidExpression( untypedExpr, indexer ) ); 1169 1169 } 1170 1170 … … 1179 1179 1180 1180 // xxx - this can be TupleAssignExpr now. Need to properly handle this case. 1181 ApplicationExpr * callExpr = s afe_dynamic_cast< ApplicationExpr * > ( ctorExpr->get_callExpr() );1181 ApplicationExpr * callExpr = strict_dynamic_cast< ApplicationExpr * > ( ctorExpr->get_callExpr() ); 1182 1182 TypeSubstitution * env = ctorExpr->get_env(); 1183 1183 ctorExpr->set_callExpr( nullptr ); -
src/InitTweak/GenInit.cc
r9f5ecf5 re3e16bc 17 17 #include <stddef.h> // for NULL 18 18 #include <algorithm> // for any_of 19 #include <cassert> // for assert, s afe_dynamic_cast, assertf19 #include <cassert> // for assert, strict_dynamic_cast, assertf 20 20 #include <iterator> // for back_inserter, inserter, back_inse... 21 21 #include <list> // for _List_iterator, list … … 255 255 SymTab::genImplicitCall( srcParam, new VariableExpr( objDecl ), fname, back_inserter( stmts ), objDecl ); 256 256 assert( stmts.size() <= 1 ); 257 return stmts.size() == 1 ? s afe_dynamic_cast< ImplicitCtorDtorStmt * >( stmts.front() ) : nullptr;257 return stmts.size() == 1 ? strict_dynamic_cast< ImplicitCtorDtorStmt * >( stmts.front() ) : nullptr; 258 258 } 259 259 -
src/InitTweak/InitTweak.cc
r9f5ecf5 re3e16bc 1 1 #include <stddef.h> // for NULL 2 2 #include <algorithm> // for find, all_of 3 #include <cassert> // for assertf, assert, s afe_dynamic_cast3 #include <cassert> // for assertf, assert, strict_dynamic_cast 4 4 #include <iostream> // for ostream, cerr, endl 5 5 #include <iterator> // for back_insert_iterator, back_inserter … … 414 414 std::list< Statement * > & stmts = tupleExpr->get_stmtExpr()->get_statements()->get_kids(); 415 415 assertf( ! stmts.empty(), "TupleAssignExpr somehow has no statements." ); 416 ExprStmt * stmt = s afe_dynamic_cast< ExprStmt * >( stmts.back() );417 TupleExpr * tuple = s afe_dynamic_cast< TupleExpr * >( stmt->get_expr() );416 ExprStmt * stmt = strict_dynamic_cast< ExprStmt * >( stmts.back() ); 417 TupleExpr * tuple = strict_dynamic_cast< TupleExpr * >( stmt->get_expr() ); 418 418 assertf( ! tuple->get_exprs().empty(), "TupleAssignExpr somehow has empty tuple expr." ); 419 419 return getCallArg( tuple->get_exprs().front(), pos ); -
src/Parser/DeclarationNode.cc
r9f5ecf5 re3e16bc 14 14 // 15 15 16 #include <cassert> // for assert, assertf, s afe_dynamic_cast16 #include <cassert> // for assert, assertf, strict_dynamic_cast 17 17 #include <iterator> // for back_insert_iterator 18 18 #include <list> // for list … … 1027 1027 1028 1028 if ( asmStmt ) { 1029 return new AsmDecl( s afe_dynamic_cast<AsmStmt *>( asmStmt->build() ) );1029 return new AsmDecl( strict_dynamic_cast<AsmStmt *>( asmStmt->build() ) ); 1030 1030 } // if 1031 1031 -
src/Parser/StatementNode.cc
r9f5ecf5 re3e16bc 14 14 // 15 15 16 #include <cassert> // for assert, s afe_dynamic_cast, assertf16 #include <cassert> // for assert, strict_dynamic_cast, assertf 17 17 #include <list> // for list 18 18 #include <memory> // for unique_ptr … … 57 57 // find end of list and maintain previous pointer 58 58 for ( StatementNode * curr = prev; curr != nullptr; curr = (StatementNode *)curr->get_next() ) { 59 StatementNode *node = s afe_dynamic_cast< StatementNode * >(curr);59 StatementNode *node = strict_dynamic_cast< StatementNode * >(curr); 60 60 assert( dynamic_cast< CaseStmt * >(node->stmt.get()) ); 61 61 prev = curr; … … 106 106 for ( Statement * stmt : init ) { 107 107 // build the && of all of the declared variables compared against 0 108 DeclStmt * declStmt = s afe_dynamic_cast< DeclStmt * >( stmt );109 DeclarationWithType * dwt = s afe_dynamic_cast< DeclarationWithType * >( declStmt->decl );108 DeclStmt * declStmt = strict_dynamic_cast< DeclStmt * >( stmt ); 109 DeclarationWithType * dwt = strict_dynamic_cast< DeclarationWithType * >( declStmt->decl ); 110 110 Expression * nze = notZeroExpr( new VariableExpr( dwt ) ); 111 111 cond = cond ? new LogicalExpr( cond, nze, true ) : nze; … … 202 202 std::list< CatchStmt * > branches; 203 203 buildMoveList< CatchStmt, StatementNode >( catch_stmt, branches ); 204 CompoundStmt *tryBlock = s afe_dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >(try_stmt));204 CompoundStmt *tryBlock = strict_dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >(try_stmt)); 205 205 FinallyStmt *finallyBlock = dynamic_cast< FinallyStmt * >(maybeMoveBuild< Statement >(finally_stmt) ); 206 206 return new TryStmt( noLabels, tryBlock, branches, finallyBlock ); -
src/ResolvExpr/AlternativeFinder.cc
r9f5ecf5 re3e16bc 15 15 16 16 #include <algorithm> // for copy 17 #include <cassert> // for s afe_dynamic_cast, assert, assertf17 #include <cassert> // for strict_dynamic_cast, assert, assertf 18 18 #include <iostream> // for operator<<, cerr, ostream, endl 19 19 #include <iterator> // for back_insert_iterator, back_inserter … … 336 336 337 337 Cost computeApplicationConversionCost( Alternative &alt, const SymTab::Indexer &indexer ) { 338 ApplicationExpr *appExpr = s afe_dynamic_cast< ApplicationExpr* >( alt.expr );339 PointerType *pointer = s afe_dynamic_cast< PointerType* >( appExpr->get_function()->get_result() );340 FunctionType *function = s afe_dynamic_cast< FunctionType* >( pointer->get_base() );338 ApplicationExpr *appExpr = strict_dynamic_cast< ApplicationExpr* >( alt.expr ); 339 PointerType *pointer = strict_dynamic_cast< PointerType* >( appExpr->get_function()->get_result() ); 340 FunctionType *function = strict_dynamic_cast< FunctionType* >( pointer->get_base() ); 341 341 342 342 Cost convCost = Cost::zero; … … 494 494 Cost cost = Cost::zero; 495 495 std::list< Expression * > newExprs; 496 ObjectDecl * obj = s afe_dynamic_cast< ObjectDecl * >( formal );496 ObjectDecl * obj = strict_dynamic_cast< ObjectDecl * >( formal ); 497 497 if ( ! instantiateArgument( obj->get_type(), obj->get_init(), actualExpr, actualEnd, openVars, resultEnv, resultNeed, resultHave, indexer, cost, back_inserter( newExprs ) ) ) { 498 498 deleteAll( newExprs ); … … 787 787 788 788 PRINT( 789 ApplicationExpr *appExpr = s afe_dynamic_cast< ApplicationExpr* >( withFunc->expr );790 PointerType *pointer = s afe_dynamic_cast< PointerType* >( appExpr->get_function()->get_result() );791 FunctionType *function = s afe_dynamic_cast< FunctionType* >( pointer->get_base() );789 ApplicationExpr *appExpr = strict_dynamic_cast< ApplicationExpr* >( withFunc->expr ); 790 PointerType *pointer = strict_dynamic_cast< PointerType* >( appExpr->get_function()->get_result() ); 791 FunctionType *function = strict_dynamic_cast< FunctionType* >( pointer->get_base() ); 792 792 std::cerr << "Case +++++++++++++ " << appExpr->get_function() << std::endl; 793 793 std::cerr << "formals are:" << std::endl; -
src/ResolvExpr/CommonType.cc
r9f5ecf5 re3e16bc 14 14 // 15 15 16 #include <cassert> // for s afe_dynamic_cast16 #include <cassert> // for strict_dynamic_cast 17 17 #include <map> // for _Rb_tree_const_iterator 18 18 #include <utility> // for pair … … 100 100 // special case where one type has a reference depth of 1 larger than the other 101 101 if ( diff > 0 ) { 102 return handleReference( s afe_dynamic_cast<ReferenceType *>( type1 ), type2, widenFirst, widenSecond, indexer, env, openVars );102 return handleReference( strict_dynamic_cast<ReferenceType *>( type1 ), type2, widenFirst, widenSecond, indexer, env, openVars ); 103 103 } else if ( diff < 0 ) { 104 return handleReference( s afe_dynamic_cast<ReferenceType *>( type2 ), type1, widenSecond, widenFirst, indexer, env, openVars );104 return handleReference( strict_dynamic_cast<ReferenceType *>( type2 ), type1, widenSecond, widenFirst, indexer, env, openVars ); 105 105 } 106 106 // otherwise, both are reference types of the same depth and this is handled by the CommonType visitor. … … 114 114 if ( TypeInstType *inst = dynamic_cast< TypeInstType* >( type2 ) ) { 115 115 if ( NamedTypeDecl *nt = indexer.lookupType( inst->get_name() ) ) { 116 TypeDecl *type = s afe_dynamic_cast< TypeDecl* >( nt );116 TypeDecl *type = strict_dynamic_cast< TypeDecl* >( nt ); 117 117 if ( type->get_base() ) { 118 118 Type::Qualifiers tq1 = type1->get_qualifiers(), tq2 = type2->get_qualifiers(); … … 301 301 NamedTypeDecl *nt = indexer.lookupType( inst->get_name() ); 302 302 if ( nt ) { 303 TypeDecl *type = s afe_dynamic_cast< TypeDecl* >( nt );303 TypeDecl *type = strict_dynamic_cast< TypeDecl* >( nt ); 304 304 if ( type->get_base() ) { 305 305 Type::Qualifiers tq1 = inst->get_qualifiers(), tq2 = type2->get_qualifiers(); -
src/ResolvExpr/ConversionCost.cc
r9f5ecf5 re3e16bc 95 95 if ( diff > 0 ) { 96 96 // TODO: document this 97 Cost cost = convertToReferenceCost( s afe_dynamic_cast< ReferenceType * >( src )->get_base(), dest, diff-1, indexer, env, func );97 Cost cost = convertToReferenceCost( strict_dynamic_cast< ReferenceType * >( src )->get_base(), dest, diff-1, indexer, env, func ); 98 98 cost.incReference(); 99 99 return cost; 100 100 } else if ( diff < -1 ) { 101 101 // TODO: document this 102 Cost cost = convertToReferenceCost( src, s afe_dynamic_cast< ReferenceType * >( dest )->get_base(), diff+1, indexer, env, func );102 Cost cost = convertToReferenceCost( src, strict_dynamic_cast< ReferenceType * >( dest )->get_base(), diff+1, indexer, env, func ); 103 103 cost.incReference(); 104 104 return cost; -
src/ResolvExpr/CurrentObject.cc
r9f5ecf5 re3e16bc 286 286 for ( InitAlternative & alt : ret ) { 287 287 PRINT( std::cerr << "iterating and adding designators" << std::endl; ) 288 alt.designation->get_designators().push_front( new VariableExpr( s afe_dynamic_cast< ObjectDecl * >( *curMember ) ) );288 alt.designation->get_designators().push_front( new VariableExpr( strict_dynamic_cast< ObjectDecl * >( *curMember ) ) ); 289 289 // need to substitute for generic types, so that casts are to concrete types 290 290 PRINT( std::cerr << " type is: " << alt.type; ) … … 346 346 for ( InitAlternative & alt : ret ) { 347 347 PRINT( std::cerr << "iterating and adding designators" << std::endl; ) 348 alt.designation->get_designators().push_front( new VariableExpr( s afe_dynamic_cast< ObjectDecl * >( *curMember ) ) );348 alt.designation->get_designators().push_front( new VariableExpr( strict_dynamic_cast< ObjectDecl * >( *curMember ) ) ); 349 349 } 350 350 } -
src/ResolvExpr/Resolver.cc
r9f5ecf5 re3e16bc 15 15 16 16 #include <stddef.h> // for NULL 17 #include <cassert> // for s afe_dynamic_cast, assert17 #include <cassert> // for strict_dynamic_cast, assert 18 18 #include <memory> // for allocator, allocator_traits<... 19 19 #include <tuple> // for get … … 342 342 CastExpr * castExpr = new CastExpr( caseStmt->get_condition(), initAlts.front().type->clone() ); 343 343 Expression * newExpr = findSingleExpression( castExpr, *this ); 344 castExpr = s afe_dynamic_cast< CastExpr * >( newExpr );344 castExpr = strict_dynamic_cast< CastExpr * >( newExpr ); 345 345 caseStmt->set_condition( castExpr->get_arg() ); 346 346 castExpr->set_arg( nullptr ); … … 398 398 Parent::enterScope(); 399 399 Visitor::visit( catchStmt ); 400 400 401 401 if ( catchStmt->get_cond() ) { 402 402 Expression * wrapped = new CastExpr( … … 423 423 UntypedInitExpr * untyped = new UntypedInitExpr( singleInit->get_value(), currentObject.getOptions() ); 424 424 Expression * newExpr = findSingleExpression( untyped, *this ); 425 InitExpr * initExpr = s afe_dynamic_cast< InitExpr * >( newExpr );425 InitExpr * initExpr = strict_dynamic_cast< InitExpr * >( newExpr ); 426 426 427 427 // move cursor to the object that is actually initialized … … 445 445 if ( isCharType( pt->get_base() ) ) { 446 446 // strip cast if we're initializing a char[] with a char *, e.g. char x[] = "hello"; 447 CastExpr *ce = s afe_dynamic_cast< CastExpr * >( newExpr );447 CastExpr *ce = strict_dynamic_cast< CastExpr * >( newExpr ); 448 448 newExpr = ce->get_arg(); 449 449 ce->set_arg( nullptr ); -
src/SymTab/Autogen.cc
r9f5ecf5 re3e16bc 18 18 #include <cstddef> // for NULL 19 19 #include <algorithm> // for count_if 20 #include <cassert> // for s afe_dynamic_cast, assert, assertf20 #include <cassert> // for strict_dynamic_cast, assert, assertf 21 21 #include <iterator> // for back_insert_iterator, back_inserter 22 22 #include <list> // for list, _List_iterator, list<>::iter... … … 250 250 // parameters) are using in the variable exprs 251 251 assert( ftype->get_parameters().size() == 2 ); 252 ObjectDecl * dstParam = s afe_dynamic_cast< ObjectDecl * >( ftype->get_parameters().front() );253 ObjectDecl * srcParam = s afe_dynamic_cast< ObjectDecl * >( ftype->get_parameters().back() );252 ObjectDecl * dstParam = strict_dynamic_cast< ObjectDecl * >( ftype->get_parameters().front() ); 253 ObjectDecl * srcParam = strict_dynamic_cast< ObjectDecl * >( ftype->get_parameters().back() ); 254 254 255 255 VariableExpr * assignVarExpr = new VariableExpr( assignDecl ); … … 307 307 308 308 // assign to destination 309 Expression *dstselect = new MemberExpr( field, new CastExpr( new VariableExpr( dstParam ), s afe_dynamic_cast< ReferenceType* >( dstParam->get_type() )->get_base()->clone() ) );309 Expression *dstselect = new MemberExpr( field, new CastExpr( new VariableExpr( dstParam ), strict_dynamic_cast< ReferenceType* >( dstParam->get_type() )->get_base()->clone() ) ); 310 310 genImplicitCall( srcParam, dstselect, func->get_name(), back_inserter( func->get_statements()->get_kids() ), field, forward ); 311 311 } … … 436 436 FunctionType * assignType = dcl->get_functionType(); 437 437 assert( assignType->get_parameters().size() == 2 ); 438 ObjectDecl * srcParam = s afe_dynamic_cast< ObjectDecl * >( assignType->get_parameters().back() );438 ObjectDecl * srcParam = strict_dynamic_cast< ObjectDecl * >( assignType->get_parameters().back() ); 439 439 dcl->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, new VariableExpr( srcParam ) ) ); 440 440 } … … 487 487 FunctionType * ftype = funcDecl->get_functionType(); 488 488 assert( ftype->get_parameters().size() == 2 ); 489 ObjectDecl * dstParam = s afe_dynamic_cast< ObjectDecl * >( ftype->get_parameters().front() );490 ObjectDecl * srcParam = s afe_dynamic_cast< ObjectDecl * >( ftype->get_parameters().back() );489 ObjectDecl * dstParam = strict_dynamic_cast< ObjectDecl * >( ftype->get_parameters().front() ); 490 ObjectDecl * srcParam = strict_dynamic_cast< ObjectDecl * >( ftype->get_parameters().back() ); 491 491 492 492 makeUnionFieldsAssignment( srcParam, dstParam, back_inserter( funcDecl->get_statements()->get_kids() ) ); … … 700 700 701 701 Type * AutogenTupleRoutines::mutate( TupleType * tupleType ) { 702 tupleType = s afe_dynamic_cast< TupleType * >( Parent::mutate( tupleType ) );702 tupleType = strict_dynamic_cast< TupleType * >( Parent::mutate( tupleType ) ); 703 703 std::string mangleName = SymTab::Mangler::mangleType( tupleType ); 704 704 if ( seenTuples.find( mangleName ) != seenTuples.end() ) return tupleType; … … 768 768 CompoundStmt * AutogenTupleRoutines::mutate( CompoundStmt *compoundStmt ) { 769 769 seenTuples.beginScope(); 770 compoundStmt = s afe_dynamic_cast< CompoundStmt * >( Parent::mutate( compoundStmt ) );770 compoundStmt = strict_dynamic_cast< CompoundStmt * >( Parent::mutate( compoundStmt ) ); 771 771 seenTuples.endScope(); 772 772 return compoundStmt; -
src/SymTab/Indexer.cc
r9f5ecf5 re3e16bc 16 16 #include "Indexer.h" 17 17 18 #include <cassert> // for assert, s afe_dynamic_cast18 #include <cassert> // for assert, strict_dynamic_cast 19 19 #include <iostream> // for operator<<, basic_ostream, ostream 20 20 #include <string> // for string, operator<<, operator!= -
src/SymTab/Validate.cc
r9f5ecf5 re3e16bc 486 486 std::list< DeclarationWithType * > asserts; 487 487 for ( Declaration * decl : inst->baseTrait->members ) { 488 asserts.push_back( s afe_dynamic_cast<DeclarationWithType *>( decl->clone() ) );488 asserts.push_back( strict_dynamic_cast<DeclarationWithType *>( decl->clone() ) ); 489 489 } 490 490 // substitute trait decl parameters for instance parameters … … 530 530 // need to carry over the 'sized' status of each decl in the instance 531 531 for ( auto p : group_iterate( traitDecl->get_parameters(), traitInst->get_parameters() ) ) { 532 TypeExpr * expr = s afe_dynamic_cast< TypeExpr * >( std::get<1>(p) );532 TypeExpr * expr = strict_dynamic_cast< TypeExpr * >( std::get<1>(p) ); 533 533 if ( TypeInstType * inst = dynamic_cast< TypeInstType * >( expr->get_type() ) ) { 534 534 TypeDecl * formalDecl = std::get<0>(p); … … 892 892 for ( size_t i = 0; paramIter != params->end(); ++paramIter, ++i ) { 893 893 if ( i < args.size() ) { 894 TypeExpr * expr = s afe_dynamic_cast< TypeExpr * >( *std::next( args.begin(), i ) );894 TypeExpr * expr = strict_dynamic_cast< TypeExpr * >( *std::next( args.begin(), i ) ); 895 895 sub.add( (*paramIter)->get_name(), expr->get_type()->clone() ); 896 896 } else if ( i == args.size() ) { … … 962 962 if ( retVals.size() > 1 ) { 963 963 // generate a single return parameter which is the tuple of all of the return values 964 TupleType * tupleType = s afe_dynamic_cast< TupleType * >( ResolvExpr::extractResultType( ftype ) );964 TupleType * tupleType = strict_dynamic_cast< TupleType * >( ResolvExpr::extractResultType( ftype ) ); 965 965 // ensure return value is not destructed by explicitly creating an empty ListInit node wherein maybeConstruct is false. 966 966 ObjectDecl * newRet = new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, tupleType, new ListInit( std::list<Initializer*>(), noDesignators, false ) ); -
src/SynTree/AddressExpr.cc
r9f5ecf5 re3e16bc 47 47 } else { 48 48 // taking address of non-lvalue -- must be a reference, loses one layer of reference 49 ReferenceType * refType = s afe_dynamic_cast< ReferenceType * >( arg->get_result() );49 ReferenceType * refType = strict_dynamic_cast< ReferenceType * >( arg->get_result() ); 50 50 set_result( addrType( refType->get_base() ) ); 51 51 } -
src/SynTree/ApplicationExpr.cc
r9f5ecf5 re3e16bc 14 14 // 15 15 16 #include <cassert> // for s afe_dynamic_cast, assert16 #include <cassert> // for strict_dynamic_cast, assert 17 17 #include <list> // for list 18 18 #include <map> // for _Rb_tree_const_iterator, map, map<>:... … … 50 50 51 51 ApplicationExpr::ApplicationExpr( Expression *funcExpr, const std::list<Expression *> & args ) : function( funcExpr ), args( args ) { 52 PointerType *pointer = s afe_dynamic_cast< PointerType* >( funcExpr->get_result() );53 FunctionType *function = s afe_dynamic_cast< FunctionType* >( pointer->get_base() );52 PointerType *pointer = strict_dynamic_cast< PointerType* >( funcExpr->get_result() ); 53 FunctionType *function = strict_dynamic_cast< FunctionType* >( pointer->get_base() ); 54 54 55 55 set_result( ResolvExpr::extractResultType( function ) ); -
src/SynTree/CompoundStmt.cc
r9f5ecf5 re3e16bc 14 14 // 15 15 16 #include <cassert> // for assert, s afe_dynamic_cast16 #include <cassert> // for assert, strict_dynamic_cast 17 17 #include <list> // for list, _List_const_iterator, lis... 18 18 #include <ostream> // for operator<<, ostream, basic_ostream … … 52 52 Statement * origStmt = *origit++; 53 53 if ( DeclStmt * declStmt = dynamic_cast< DeclStmt * >( s ) ) { 54 DeclStmt * origDeclStmt = s afe_dynamic_cast< DeclStmt * >( origStmt );54 DeclStmt * origDeclStmt = strict_dynamic_cast< DeclStmt * >( origStmt ); 55 55 if ( DeclarationWithType * dwt = dynamic_cast< DeclarationWithType * > ( declStmt->get_decl() ) ) { 56 DeclarationWithType * origdwt = s afe_dynamic_cast< DeclarationWithType * > ( origDeclStmt->get_decl() );56 DeclarationWithType * origdwt = strict_dynamic_cast< DeclarationWithType * > ( origDeclStmt->get_decl() ); 57 57 assert( dwt->get_name() == origdwt->get_name() ); 58 58 declMap[ origdwt ] = dwt; -
src/SynTree/Constant.cc
r9f5ecf5 re3e16bc 14 14 // 15 15 16 #include <cassert> // for s afe_dynamic_cast, assertf16 #include <cassert> // for strict_dynamic_cast, assertf 17 17 #include <iostream> // for operator<<, ostream, basic_ostream 18 18 #include <string> // for to_string, string, char_traits, operator<< … … 58 58 59 59 unsigned long long Constant::get_ival() const { 60 assertf( s afe_dynamic_cast<BasicType*>(type)->isInteger(), "Attempt to retrieve ival from non-integer constant." );60 assertf( strict_dynamic_cast<BasicType*>(type)->isInteger(), "Attempt to retrieve ival from non-integer constant." ); 61 61 return val.ival; 62 62 } 63 63 64 64 double Constant::get_dval() const { 65 assertf( ! s afe_dynamic_cast<BasicType*>(type)->isInteger(), "Attempt to retrieve dval from integer constant." );65 assertf( ! strict_dynamic_cast<BasicType*>(type)->isInteger(), "Attempt to retrieve dval from integer constant." ); 66 66 return val.dval; 67 67 } -
src/SynTree/Declaration.h
r9f5ecf5 re3e16bc 156 156 157 157 Type * get_type() const { return type; } 158 virtual void set_type(Type * t) { type = s afe_dynamic_cast< FunctionType* >( t ); }158 virtual void set_type(Type * t) { type = strict_dynamic_cast< FunctionType* >( t ); } 159 159 160 160 FunctionType * get_functionType() const { return type; } -
src/SynTree/TupleExpr.cc
r9f5ecf5 re3e16bc 14 14 // 15 15 16 #include <cassert> // for assert, s afe_dynamic_cast, assertf16 #include <cassert> // for assert, strict_dynamic_cast, assertf 17 17 #include <iterator> // for next 18 18 #include <list> // for list, _List_iterator … … 64 64 65 65 TupleIndexExpr::TupleIndexExpr( Expression * tuple, unsigned int index ) : tuple( tuple ), index( index ) { 66 TupleType * type = s afe_dynamic_cast< TupleType * >( tuple->get_result() );66 TupleType * type = strict_dynamic_cast< TupleType * >( tuple->get_result() ); 67 67 assertf( type->size() > index, "TupleIndexExpr index out of bounds: tuple size %d, requested index %d in expr %s", type->size(), index, toString( tuple ).c_str() ); 68 68 set_result( (*std::next( type->get_types().begin(), index ))->clone() ); -
src/Tuples/TupleExpansion.cc
r9f5ecf5 re3e16bc 168 168 // steal the already generated assignment to var from the unqExpr - this has been generated by FixInit 169 169 Expression * expr = unqExpr->get_expr(); 170 CommaExpr * commaExpr = s afe_dynamic_cast< CommaExpr * >( expr );170 CommaExpr * commaExpr = strict_dynamic_cast< CommaExpr * >( expr ); 171 171 assignUnq = commaExpr->get_arg1(); 172 172 commaExpr->set_arg1( nullptr ); … … 237 237 delete tupleExpr; 238 238 239 StructInstType * type = s afe_dynamic_cast< StructInstType * >( tuple->get_result() );239 StructInstType * type = strict_dynamic_cast< StructInstType * >( tuple->get_result() ); 240 240 StructDecl * structDecl = type->get_baseStruct(); 241 241 assert( structDecl->get_members().size() > idx ); 242 242 Declaration * member = *std::next(structDecl->get_members().begin(), idx); 243 MemberExpr * memExpr = new MemberExpr( s afe_dynamic_cast< DeclarationWithType * >( member ), tuple );243 MemberExpr * memExpr = new MemberExpr( strict_dynamic_cast< DeclarationWithType * >( member ), tuple ); 244 244 memExpr->set_env( env ); 245 245 return memExpr; -
src/include/cassert
r9f5ecf5 re3e16bc 31 31 __ASSERT_FUNCTION, fmt, ## __VA_ARGS__ )) 32 32 33 void __assert_fail_f( const char *assertion, const char *file, 34 unsigned int line, const char *function, 35 const char *fmt, ... 33 void __assert_fail_f( const char *assertion, const char *file, 34 unsigned int line, const char *function, 35 const char *fmt, ... 36 36 ) __attribute__((noreturn, format(printf, 5, 6))); 37 37 … … 39 39 40 40 template<typename T, typename U> 41 static inline T s afe_dynamic_cast( const U & src ) {41 static inline T strict_dynamic_cast( const U & src ) { 42 42 T ret = dynamic_cast<T>(src); 43 43 assert(ret);
Note: See TracChangeset
for help on using the changeset viewer.