Changeset 8688ce1 for src/ControlStruct


Ignore:
Timestamp:
Aug 4, 2016, 12:29:54 PM (8 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:
76e8c55
Parents:
e80ebe5
Message:

move case-list management into parser

Location:
src/ControlStruct
Files:
2 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • src/ControlStruct/MLEMutator.cc

    re80ebe5 r8688ce1  
    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:36:51 2016
    13 // Update Count     : 197
     12// Last Modified On : Thu Aug  4 11:21:32 2016
     13// Update Count     : 202
    1414//
    1515
     
    128128                Label brkLabel = generator->newLabel("switchBreak");
    129129                enclosingControlStructures.push_back( Entry(switchStmt, brkLabel) );
    130                 mutateAll( switchStmt->get_branches(), *this );
     130                mutateAll( switchStmt->get_statements(), *this );
    131131
    132132                Entry &e = enclosingControlStructures.back();
     
    138138                        // switch should be CastStmts), append the exit label + break to the last case statement; create a default
    139139                        // case if there are no cases
    140                         std::list< Statement * > &branches = switchStmt->get_branches();
    141                         if ( branches.empty() ) {
    142                                 branches.push_back( CaseStmt::makeDefault() );
    143                         } // if
    144 
    145                         if ( CaseStmt * c = dynamic_cast< CaseStmt * >( branches.back() ) ) {
     140                        std::list< Statement * > &statements = switchStmt->get_statements();
     141                        if ( statements.empty() ) {
     142                                statements.push_back( CaseStmt::makeDefault() );
     143                        } // if
     144
     145                        if ( CaseStmt * c = dynamic_cast< CaseStmt * >( statements.back() ) ) {
    146146                                std::list<Label> temp; temp.push_back( brkLabel );
    147147                                c->get_statements().push_back( new BranchStmt( temp, Label("brkLabel"), BranchStmt::Break ) );
    148                         } else assert(0); // as of this point, all branches of a switch are still CaseStmts
     148                        } else assert(0); // as of this point, all statements of a switch are still CaseStmts
    149149                } // if
    150150
  • src/ControlStruct/Mutate.cc

    re80ebe5 r8688ce1  
    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:37:45 2016
    13 // Update Count     : 8
     12// Last Modified On : Thu Aug  4 11:39:08 2016
     13// Update Count     : 9
    1414//
    1515
     
    2222#include "LabelFixer.h"
    2323#include "MLEMutator.h"
    24 #include "CaseRangeMutator.h"
    2524#include "ForExprMutator.h"
    2625#include "LabelTypeChecker.h"
     
    4140                LabelFixer lfix;
    4241
    43                 // expand case ranges and turn fallthru into a null statement
    44                 CaseRangeMutator ranges;
    45 
    4642                //ExceptMutator exc;
    4743                // LabelTypeChecker lbl;
     
    4945                mutateAll( translationUnit, formut );
    5046                acceptAll( translationUnit, lfix );
    51                 mutateAll( translationUnit, ranges );
    5247                //mutateAll( translationUnit, exc );
    5348                //acceptAll( translationUnit, lbl );
  • src/ControlStruct/module.mk

    re80ebe5 r8688ce1  
    1111## Created On       : Mon Jun  1 17:49:17 2015
    1212## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Tue Jul 12 17:40:31 2016
    14 ## Update Count     : 2
     13## Last Modified On : Thu Aug  4 11:38:06 2016
     14## Update Count     : 3
    1515###############################################################################
    1616
     
    1818        ControlStruct/LabelFixer.cc \
    1919        ControlStruct/MLEMutator.cc \
    20         ControlStruct/CaseRangeMutator.cc \
    2120        ControlStruct/Mutate.cc \
    2221        ControlStruct/ForExprMutator.cc \
Note: See TracChangeset for help on using the changeset viewer.