Ignore:
Timestamp:
Feb 1, 2022, 8:22:12 PM (3 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
Children:
fde0a58
Parents:
729c991
Message:

change class name WhileStmt? to WhileDoStmt?, add else clause to WhileDoStmt? and ForStmt?, change names thenPart/ElsePart to then/else_

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ControlStruct/MultiLevelExit.cpp

    r729c991 r3b0bc16  
    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.