Changeset 4162aea9


Ignore:
Timestamp:
Jun 3, 2015, 11:09:48 PM (8 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
aaron-thesis, arm-eh, 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, string, with_gc
Children:
1136d96
Parents:
27de955
Message:

documentation and update control_structures.c example

Location:
src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/ControlStruct/ChooseMutator.cc

    r27de955 r4162aea9  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue May 19 15:31:39 2015
    13 // Update Count     : 2
     11// Last Modified By : Rob Schluntz
     12// Last Modified On : Wed Jun 03 15:30:20 2015
     13// Update Count     : 5
    1414//
    1515
     
    4444                std::list< Statement * > &stmts = caseStmt->get_statements();
    4545
     46                // the difference between switch and choose is that switch has an implicit fallthrough
     47                // to the next case, whereas choose has an implicit break at the end of the current case.
     48                // thus to transform a choose statement into a switch, we only need to insert breaks at the
     49                // end of any case that doesn't already end in a break and that doesn't end in a fallthru
     50
    4651                if ( insideChoose ) {
    4752                        BranchStmt *posBrk;
  • src/ControlStruct/Mutate.cc

    r27de955 r4162aea9  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue May 19 15:32:52 2015
    13 // Update Count     : 2
     11// Last Modified By : Rob Schluntz
     12// Last Modified On : Wed Jun 03 23:08:43 2015
     13// Update Count     : 5
    1414//
    1515
     
    3737        void mutate( std::list< Declaration * > translationUnit ) {
    3838                // ForExprMutator formut;
     39
     40                // normalizes label definitions and generates multi-level
     41                // exit labels
    3942                LabelFixer lfix;
     43
     44                // transform choose statements into switch statements
    4045                ChooseMutator chmut;
     46
     47                // expand case ranges and turn fallthru into a null statement
    4148                CaseRangeMutator ranges;  // has to run after ChooseMutator
     49
    4250                //ExceptMutator exc;
    4351                // LabelTypeChecker lbl;
  • src/examples/control_structures.c

    r27de955 r4162aea9  
    1818                L2: switch ( 3_333_333 ) {                                              // underscores in constant
    1919                        case 1,2,3:                                                                     // 4~8, 4...8 not working
     20                        case 4~8:
    2021                                L3: for ( ;; ) {
    2122                                        L4: for ( ;; ) {
Note: See TracChangeset for help on using the changeset viewer.