Changes in src/InitTweak/FixInit.cc [7b3f66b:ec79847]
- File:
-
- 1 edited
-
src/InitTweak/FixInit.cc (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/FixInit.cc
r7b3f66b rec79847 10 10 // Created On : Wed Jan 13 16:29:30 2016 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Fri May 13 11:44:26201612 // Last Modified On : Mon May 09 12:36:02 2016 13 13 // Update Count : 30 14 14 // … … 17 17 #include <list> 18 18 #include "FixInit.h" 19 #include "InitTweak.h"20 19 #include "ResolvExpr/Resolver.h" 21 20 #include "ResolvExpr/typeops.h" … … 28 27 #include "SymTab/Indexer.h" 29 28 #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/dtor 408 // 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 array 414 assert( compoundStmt->get_kids().size() == 2 ); // loop variable and loop 415 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 here 420 assert( false && "encountered unknown call statement" ); 421 } 422 } 423 400 424 namespace { 401 425 template<typename Iterator, typename OutputIterator> … … 404 428 // remove if instrinsic destructor statement. Note that this is only called 405 429 // on lists of implicit dtors, so if the user manually calls an intrinsic 406 // dtor then the call must (and will) still be generated since the argument 407 // may contain side effects. 430 // dtor then the call will still be generated 408 431 if ( ! isInstrinsicSingleArgCallStmt( *it ) ) { 409 432 // don't need to call intrinsic dtor, because it does nothing, but
Note:
See TracChangeset
for help on using the changeset viewer.