Ignore:
Timestamp:
Aug 8, 2016, 4:20:29 PM (8 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, 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:
0853178
Parents:
242d458
Message:

generate a field constructor for union types and some refactoring

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/InitTweak.cc

    r242d458 ra465caf  
    291291        }
    292292
     293        namespace {
     294                template <typename Predicate>
     295                bool allofCtorDtor( Statement * stmt, const Predicate & pred ) {
     296                        std::list< Expression * > callExprs;
     297                        collectCtorDtorCalls( stmt, callExprs );
     298                        // if ( callExprs.empty() ) return false; // xxx - do I still need this check?
     299                        return std::all_of( callExprs.begin(), callExprs.end(), pred);
     300                }
     301        }
     302
    293303        bool isIntrinsicSingleArgCallStmt( Statement * stmt ) {
    294                 std::list< Expression * > callExprs;
    295                 collectCtorDtorCalls( stmt, callExprs );
    296                 // if ( callExprs.empty() ) return false; // xxx - do I still need this check?
    297                 return std::all_of( callExprs.begin(), callExprs.end(), []( Expression * callExpr ){
     304                return allofCtorDtor( stmt, []( Expression * callExpr ){
    298305                        if ( ApplicationExpr * appExpr = isIntrinsicCallExpr( callExpr ) ) {
    299306                                assert( ! appExpr->get_function()->get_results().empty() );
     
    303310                        }
    304311                        return false;
     312                });
     313        }
     314
     315        bool isIntrinsicCallStmt( Statement * stmt ) {
     316                return allofCtorDtor( stmt, []( Expression * callExpr ) {
     317                        return isIntrinsicCallExpr( callExpr );
    305318                });
    306319        }
Note: See TracChangeset for help on using the changeset viewer.