Changeset 66d12f7 for src/ControlStruct


Ignore:
Timestamp:
Jul 30, 2016, 2:31:17 AM (9 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, 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:
ac911f4
Parents:
2750cde
Message:

change case ranges to use gcc syntax, first attempt

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ControlStruct/CaseRangeMutator.cc

    r2750cde r66d12f7  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 12 17:35:13 2016
    13 // Update Count     : 9
     12// Last Modified On : Thu Jul 28 01:56:47 2016
     13// Update Count     : 14
    1414//
    1515
     
    7171                        NameExpr *nmfunc;
    7272                        if ( ( nmfunc = dynamic_cast< NameExpr *>( cond->get_function() )) != 0 ) {
    73                                 if ( nmfunc->get_name() == std::string("Range") ) {
     73                                if ( nmfunc->get_name() == "Range" ) {
    7474                                        assert( cond->get_args().size() == 2 );
    7575                                        std::list<Expression *>::iterator i = cond->get_args().begin();
    7676                                        Expression *lo = *i, *hi = *(++i ); // "unnecessary" temporaries
    77                                         fillRange( lo, hi );
     77                                        //fillRange( lo, hi );
    7878                                } // if
    7979                        } // if
     
    8282                        assert( ! tcond->get_exprs().empty() );
    8383                        for ( std::list< Expression * >::iterator i = tcond->get_exprs().begin(); i != tcond->get_exprs().end(); i++ )
    84                                 newCaseLabels.push_back( *i ); // do I need to clone them?
     84                                newCaseLabels.push_back( *i );                  // do I need to clone them?
    8585                } // if
    8686
     
    9999
    100100                if ( ce_lo && ce_hi ) {
     101                        std::cout << ce_lo->get_constant()->get_value() << " " << ce_hi->get_constant()->get_value() << std::endl;
    101102                        c_lo = ce_lo->get_constant(); c_hi = ce_hi->get_constant();
    102103                } /* else {
     
    109110                if ( ! ty_lo || ! ty_hi )
    110111                        return; // one of them is not a constant
    111 
     112#if 0
    112113                switch ( ty_lo->get_kind() ) {
    113114                  case BasicType::Char:
     
    176177                        break;
    177178                } // switch
    178 
     179#endif
    179180                /* End: */{
    180181                        // invalid range, signal a warning (it still generates the two case labels)
    181                         newCaseLabels.push_back( lo );
    182                         newCaseLabels.push_back( hi );
     182//                      newCaseLabels.push_back( lo );
     183//                      newCaseLabels.push_back( hi );
    183184                        return;
    184185                }
Note: See TracChangeset for help on using the changeset viewer.