Changeset 7b3f66b for src/InitTweak/FixInit.cc
- Timestamp:
- May 13, 2016, 1:18:35 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- d668182
- Parents:
- fb24492
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/FixInit.cc
rfb24492 r7b3f66b 10 10 // Created On : Wed Jan 13 16:29:30 2016 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Mon May 09 12:36:02201612 // Last Modified On : Fri May 13 11:44:26 2016 13 13 // Update Count : 30 14 14 // … … 17 17 #include <list> 18 18 #include "FixInit.h" 19 #include "InitTweak.h" 19 20 #include "ResolvExpr/Resolver.h" 20 21 #include "ResolvExpr/typeops.h" … … 27 28 #include "SymTab/Indexer.h" 28 29 #include "GenPoly/PolyMutator.h" 29 #include "GenPoly/GenPoly.h"30 30 31 31 bool ctordtorp = false; … … 398 398 } 399 399 400 bool isInstrinsicSingleArgCallStmt( Statement * stmt ) {401 if ( stmt == NULL ) return false;402 if ( ExprStmt * exprStmt = dynamic_cast< ExprStmt * >( stmt ) ) {403 ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * >( exprStmt->get_expr() );404 assert( appExpr );405 VariableExpr * function = dynamic_cast< VariableExpr * >( appExpr->get_function() );406 assert( function );407 // check for Intrinsic only - don't want to remove all overridable ctor/dtors because autogenerated ctor/dtor408 // will call all member dtors, and some members may have a user defined dtor.409 FunctionType * funcType = GenPoly::getFunctionType( function->get_var()->get_type() );410 assert( funcType );411 return function->get_var()->get_linkage() == LinkageSpec::Intrinsic && funcType->get_parameters().size() == 1;412 } else if ( CompoundStmt * compoundStmt = dynamic_cast< CompoundStmt * >( stmt ) ) {413 // could also be a compound statement with a loop, in the case of an array414 assert( compoundStmt->get_kids().size() == 2 ); // loop variable and loop415 ForStmt * forStmt = dynamic_cast< ForStmt * >( compoundStmt->get_kids().back() );416 assert( forStmt && forStmt->get_body() );417 return isInstrinsicSingleArgCallStmt( forStmt->get_body() );418 } else {419 // should never get here420 assert( false && "encountered unknown call statement" );421 }422 }423 424 400 namespace { 425 401 template<typename Iterator, typename OutputIterator> … … 428 404 // remove if instrinsic destructor statement. Note that this is only called 429 405 // on lists of implicit dtors, so if the user manually calls an intrinsic 430 // dtor then the call will still be generated 406 // dtor then the call must (and will) still be generated since the argument 407 // may contain side effects. 431 408 if ( ! isInstrinsicSingleArgCallStmt( *it ) ) { 432 409 // don't need to call intrinsic dtor, because it does nothing, but
Note: See TracChangeset
for help on using the changeset viewer.