Changeset 8cb149f for src/ControlStruct


Ignore:
Timestamp:
Feb 2, 2022, 2:50:46 PM (2 years ago)
Author:
caparsons <caparson@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
Children:
21a99cc
Parents:
4de48c5 (diff), 4e7171f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Location:
src/ControlStruct
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • src/ControlStruct/ForExprMutator.cc

    r4de48c5 r8cb149f  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Mar 11 22:26:52 2019
    13 // Update Count     : 14
     12// Last Modified On : Tue Feb  1 09:26:12 2022
     13// Update Count     : 16
    1414//
    1515
     
    4545                return hoist( forStmt, forStmt->initialization );
    4646        }
    47         Statement * ForExprMutator::postmutate( WhileStmt * whileStmt ) {
    48                 return hoist( whileStmt, whileStmt->initialization );
     47        Statement * ForExprMutator::postmutate( WhileDoStmt * whileDoStmt ) {
     48                return hoist( whileDoStmt, whileDoStmt->initialization );
    4949        }
    5050} // namespace ControlStruct
  • src/ControlStruct/ForExprMutator.h

    r4de48c5 r8cb149f  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Jan 30 09:14:46 2022
    13 // Update Count     : 6
     12// Last Modified On : Tue Feb  1 09:18:50 2022
     13// Update Count     : 7
    1414//
    1515
     
    1818class IfStmt;
    1919class ForStmt;
    20 class WhileStmt;
     20class WhileDoStmt;
    2121class Statement;
    2222
     
    2626                Statement * postmutate( IfStmt * );
    2727                Statement * postmutate( ForStmt * );
    28                 Statement * postmutate( WhileStmt * );
     28                Statement * postmutate( WhileDoStmt * );
    2929        };
    3030} // namespace ControlStruct
  • src/ControlStruct/HoistControlDecls.cpp

    r4de48c5 r8cb149f  
    1010// Created On       : Fri Dec  3 15:34:00 2021
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Jan 31 18:52:35 2022
    13 // Update Count     : 23
     12// Last Modified On : Tue Feb  1 18:59:47 2022
     13// Update Count     : 25
    1414//
    1515
     
    3535
    3636        CompoundStmt * block = new CompoundStmt( stmt->location ); // create empty compound statement
    37         //    {
    38         //    }
     37        //    {}
    3938
    4039        for ( const Stmt * next : stmt->inits ) {                       // link conditional declarations into compound
     
    6968                return hoist<ForStmt>( stmt );
    7069        }
    71         const Stmt * postvisit( const WhileStmt * stmt ) {
    72                 return hoist<WhileStmt>( stmt );
     70        const Stmt * postvisit( const WhileDoStmt * stmt ) {
     71                return hoist<WhileDoStmt>( stmt );
    7372        }
    7473};
  • src/ControlStruct/LabelFixer.cc

    r4de48c5 r8cb149f  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Jan 31 22:28:31 2022
    13 // Update Count     : 161
     12// Last Modified On : Tue Feb  1 09:12:09 2022
     13// Update Count     : 162
    1414//
    1515
     
    2929bool LabelFixer::Entry::insideLoop() {
    3030        return ( dynamic_cast< ForStmt * > ( definition ) ||
    31                 dynamic_cast< WhileStmt * > ( definition )  );
     31                dynamic_cast< WhileDoStmt * > ( definition )  );
    3232}
    3333
  • src/ControlStruct/LabelGeneratorNew.cpp

    r4de48c5 r8cb149f  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Jan 31 18:51:10 2022
    13 // Update Count     : 71
     12// Last Modified On : Wed Feb  2 09:11:17 2022
     13// Update Count     : 72
    1414//
    1515
     
    2828        static int current = 0;
    2929
    30         assert( ( (void)"CFA internal error: parameter statement cannot be null pointer", stmt ) );
     30        assertf( stmt, "CFA internal error: parameter statement cannot be null pointer" );
    3131
    3232        enum { size = 128 };
    3333        char buf[size];                                                                         // space to build label
    3434        int len = snprintf( buf, size, "__L%d__%s", current++, suffix.c_str() );
    35         assert( ( (void)"CFA Internal error: buffer overflow creating label", len < size ) );
     35        assertf( len < size, "CFA Internal error: buffer overflow creating label" );
    3636
    3737        // What does this do?
    3838        if ( ! stmt->labels.empty() ) {
    3939                len = snprintf( buf + len, size - len, "_%s__", stmt->labels.front().name.c_str() );
    40                 assert( ( (void)"CFA Internal error: buffer overflow creating label", len < size - len ) );
     40                assertf( len < size - len, "CFA Internal error: buffer overflow creating label" );
    4141        } // if
    4242
  • src/ControlStruct/MLEMutator.cc

    r4de48c5 r8cb149f  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Jan 22 11:50:00 2020
    13 // Update Count     : 223
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Tue Feb  1 09:26:28 2022
     13// Update Count     : 225
    1414//
    1515
     
    3939        namespace {
    4040                bool isLoop( const MultiLevelExitMutator::Entry & e ) {
    41                         return dynamic_cast< WhileStmt * >( e.get_controlStructure() )
     41                        return dynamic_cast< WhileDoStmt * >( e.get_controlStructure() )
    4242                                || dynamic_cast< ForStmt * >( e.get_controlStructure() );
    4343                }
     
    295295        }
    296296
    297         void MultiLevelExitMutator::premutate( WhileStmt * whileStmt ) {
    298                 return prehandleLoopStmt( whileStmt );
     297        void MultiLevelExitMutator::premutate( WhileDoStmt * whileDoStmt ) {
     298                return prehandleLoopStmt( whileDoStmt );
    299299        }
    300300
     
    303303        }
    304304
    305         Statement * MultiLevelExitMutator::postmutate( WhileStmt * whileStmt ) {
    306                 return posthandleLoopStmt( whileStmt );
     305        Statement * MultiLevelExitMutator::postmutate( WhileDoStmt * whileDoStmt ) {
     306                return posthandleLoopStmt( whileDoStmt );
    307307        }
    308308
  • src/ControlStruct/MLEMutator.h

    r4de48c5 r8cb149f  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Jan 22 11:50:00 2020
    13 // Update Count     : 48
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Tue Feb  1 09:27:24 2022
     13// Update Count     : 50
    1414//
    1515
     
    4242                void premutate( CompoundStmt *cmpndStmt );
    4343                Statement * postmutate( BranchStmt *branchStmt ) throw ( SemanticErrorException );
    44                 void premutate( WhileStmt *whileStmt );
    45                 Statement * postmutate( WhileStmt *whileStmt );
     44                void premutate( WhileDoStmt *whileDoStmt );
     45                Statement * postmutate( WhileDoStmt *whileDoStmt );
    4646                void premutate( ForStmt *forStmt );
    4747                Statement * postmutate( ForStmt *forStmt );
     
    6767                                stmt( stmt ), breakExit( breakExit ), contExit( contExit ) {}
    6868
    69                         explicit Entry( WhileStmt *stmt, Label breakExit, Label contExit ) :
     69                        explicit Entry( WhileDoStmt *stmt, Label breakExit, Label contExit ) :
    7070                                stmt( stmt ), breakExit( breakExit ), contExit( contExit ) {}
    7171
  • src/ControlStruct/MultiLevelExit.cpp

    r4de48c5 r8cb149f  
    1010// Created On       : Mon Nov  1 13:48:00 2021
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Jan 31 22:35:08 2022
    13 // Update Count     : 28
     12// Last Modified On : Tue Feb  1 18:48:47 2022
     13// Update Count     : 29
    1414//
    1515
     
    4040
    4141        enum Kind {
    42                 ForStmtK, WhileStmtK, CompoundStmtK, IfStmtK, CaseStmtK, SwitchStmtK, TryStmtK
     42                ForStmtK, WhileDoStmtK, CompoundStmtK, IfStmtK, CaseStmtK, SwitchStmtK, TryStmtK
    4343        } kind;
    4444
     
    5353        Entry( const ForStmt * stmt, Label breakExit, Label contExit ) :
    5454                stmt( stmt ), firstTarget( breakExit ), secondTarget( contExit ), kind( ForStmtK ) {}
    55         Entry( const WhileStmt * stmt, Label breakExit, Label contExit ) :
    56                 stmt( stmt ), firstTarget( breakExit ), secondTarget( contExit ), kind( WhileStmtK ) {}
     55        Entry( const WhileDoStmt * stmt, Label breakExit, Label contExit ) :
     56                stmt( stmt ), firstTarget( breakExit ), secondTarget( contExit ), kind( WhileDoStmtK ) {}
    5757        Entry( const CompoundStmt *stmt, Label breakExit ) :
    5858                stmt( stmt ), firstTarget( breakExit ), secondTarget(), kind( CompoundStmtK ) {}
     
    6666                stmt( stmt ), firstTarget( breakExit ), secondTarget(), kind( TryStmtK ) {}
    6767
    68         bool isContTarget() const { return kind <= WhileStmtK; }
     68        bool isContTarget() const { return kind <= WhileDoStmtK; }
    6969        bool isBreakTarget() const { return kind != CaseStmtK; }
    7070        bool isFallTarget() const { return kind == CaseStmtK; }
     
    7272
    7373        // These routines set a target as being "used" by a BranchStmt
    74         Label useContExit() { assert( kind <= WhileStmtK ); return useTarget(secondTarget); }
     74        Label useContExit() { assert( kind <= WhileDoStmtK ); return useTarget(secondTarget); }
    7575        Label useBreakExit() { assert( kind != CaseStmtK ); return useTarget(firstTarget); }
    7676        Label useFallExit() { assert( kind == CaseStmtK );  return useTarget(firstTarget); }
     
    7878
    7979        // These routines check if a specific label for a statement is used by a BranchStmt
    80         bool isContUsed() const { assert( kind <= WhileStmtK ); return secondTarget.used; }
     80        bool isContUsed() const { assert( kind <= WhileDoStmtK ); return secondTarget.used; }
    8181        bool isBreakUsed() const { assert( kind != CaseStmtK ); return firstTarget.used; }
    8282        bool isFallUsed() const { assert( kind == CaseStmtK ); return firstTarget.used; }
     
    112112        const CompoundStmt * previsit( const CompoundStmt * );
    113113        const BranchStmt * postvisit( const BranchStmt * );
    114         void previsit( const WhileStmt * );
    115         const WhileStmt * postvisit( const WhileStmt * );
     114        void previsit( const WhileDoStmt * );
     115        const WhileDoStmt * postvisit( const WhileDoStmt * );
    116116        void previsit( const ForStmt * );
    117117        const ForStmt * postvisit( const ForStmt * );
     
    342342}
    343343
    344 void MultiLevelExitCore::previsit( const WhileStmt * stmt ) {
     344void MultiLevelExitCore::previsit( const WhileDoStmt * stmt ) {
    345345        return prehandleLoopStmt( stmt );
    346346}
    347347
    348 const WhileStmt * MultiLevelExitCore::postvisit( const WhileStmt * stmt ) {
     348const WhileDoStmt * MultiLevelExitCore::postvisit( const WhileDoStmt * stmt ) {
    349349        return posthandleLoopStmt( stmt );
    350350}
Note: See TracChangeset for help on using the changeset viewer.