Changes in / [cb0bcf1:9d47c1f]


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ControlStruct/MultiLevelExit.cpp

    rcb0bcf1 r9d47c1f  
    1010// Created On       : Mon Nov  1 13:48:00 2021
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Sep  6 12:00:00 2023
    13 // Update Count     : 35
     12// Last Modified On : Mon Mar 28  9:42:00 2022
     13// Update Count     : 34
    1414//
    1515
     
    1818#include "AST/Pass.hpp"
    1919#include "AST/Stmt.hpp"
     20#include "Common/CodeLocationTools.hpp"
    2021#include "LabelGeneratorNew.hpp"
    2122
     
    2526
    2627namespace ControlStruct {
    27 
    28 namespace {
    29 
    3028class Entry {
    3129  public:
     
    3735                bool used = false;
    3836                Target( const Label & label ) : label( label ) {}
    39                 Target() : label( CodeLocation(), "" ) {}
     37                Target() : label( CodeLocation() ) {}
    4038        };
    4139        Target firstTarget;
     
    526524        // if continue is used insert a continue label into the back of the body of the loop
    527525        if ( entry.isContUsed() ) {
     526                CompoundStmt * new_body = new CompoundStmt( body->location );
     527                // {}
     528                new_body->kids.push_back( body );
    528529                // {
    529530                //  body
    530                 //  ContinueLabel: ;
    531531                // }
    532                 return new CompoundStmt( body->location, {
    533                         body,
    534                         labelledNullStmt( body->location, entry.useContExit() ),
    535                 } );
     532                new_body->kids.push_back(
     533                        labelledNullStmt( body->location, entry.useContExit() ) );
     534                // {
     535                //  body
     536                //  ContinueLabel: {}
     537                // }
     538                return new_body;
    536539        }
    537540
     
    617620}
    618621
    619 } // namespace
    620 
    621622const CompoundStmt * multiLevelExitUpdate(
    622                 const CompoundStmt * stmt, const LabelToStmt & labelTable ) {
     623        const CompoundStmt * stmt,
     624        const LabelToStmt & labelTable ) {
    623625        // Must start in the body, so FunctionDecls can be a stopping point.
    624626        Pass<MultiLevelExitCore> visitor( labelTable );
    625         return stmt->accept( visitor );
    626 }
    627 
     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}
    628632} // namespace ControlStruct
    629633
Note: See TracChangeset for help on using the changeset viewer.