Changeset cb0bcf1


Ignore:
Timestamp:
Sep 6, 2023, 3:44:10 PM (15 months ago)
Author:
caparsons <caparson@…>
Branches:
master
Children:
01510fe
Parents:
9d47c1f (diff), 4a40fca7 (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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ControlStruct/MultiLevelExit.cpp

    r9d47c1f rcb0bcf1  
    1010// Created On       : Mon Nov  1 13:48:00 2021
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Mon Mar 28  9:42:00 2022
    13 // Update Count     : 34
     12// Last Modified On : Wed Sep  6 12:00:00 2023
     13// Update Count     : 35
    1414//
    1515
     
    1818#include "AST/Pass.hpp"
    1919#include "AST/Stmt.hpp"
    20 #include "Common/CodeLocationTools.hpp"
    2120#include "LabelGeneratorNew.hpp"
    2221
     
    2625
    2726namespace ControlStruct {
     27
     28namespace {
     29
    2830class Entry {
    2931  public:
     
    3537                bool used = false;
    3638                Target( const Label & label ) : label( label ) {}
    37                 Target() : label( CodeLocation() ) {}
     39                Target() : label( CodeLocation(), "" ) {}
    3840        };
    3941        Target firstTarget;
     
    524526        // if continue is used insert a continue label into the back of the body of the loop
    525527        if ( entry.isContUsed() ) {
    526                 CompoundStmt * new_body = new CompoundStmt( body->location );
    527                 // {}
    528                 new_body->kids.push_back( body );
    529528                // {
    530529                //  body
     530                //  ContinueLabel: ;
    531531                // }
    532                 new_body->kids.push_back(
    533                         labelledNullStmt( body->location, entry.useContExit() ) );
    534                 // {
    535                 //  body
    536                 //  ContinueLabel: {}
    537                 // }
    538                 return new_body;
     532                return new CompoundStmt( body->location, {
     533                        body,
     534                        labelledNullStmt( body->location, entry.useContExit() ),
     535                } );
    539536        }
    540537
     
    620617}
    621618
     619} // namespace
     620
    622621const CompoundStmt * multiLevelExitUpdate(
    623         const CompoundStmt * stmt,
    624         const LabelToStmt & labelTable ) {
     622                const CompoundStmt * stmt, const LabelToStmt & labelTable ) {
    625623        // Must start in the body, so FunctionDecls can be a stopping point.
    626624        Pass<MultiLevelExitCore> visitor( labelTable );
    627         const CompoundStmt * ret = stmt->accept( visitor );
    628         // There are some unset code locations slipping in, possibly by Labels.
    629         const Node * node = localFillCodeLocations( ret->location, ret );
    630         return strict_dynamic_cast<const CompoundStmt *>( node );
    631 }
     625        return stmt->accept( visitor );
     626}
     627
    632628} // namespace ControlStruct
    633629
Note: See TracChangeset for help on using the changeset viewer.