Changeset 4737d8e


Ignore:
Timestamp:
Jan 10, 2020, 2:04:57 PM (21 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
arm-eh, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr
Children:
0608e007
Parents:
9e1fa35 (diff), 6b6a3b8 (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/LabelFixer.cc

    r9e1fa35 r4737d8e  
    7575
    7676
    77         // sets the definition of the labelTable entry to be the provided statement for every label in the list
    78         // parameter. Happens for every kind of statement
     77        // Sets the definition of the labelTable entry to be the provided statement for every label in
     78        // the list parameter. Happens for every kind of statement.
    7979        Label LabelFixer::setLabelsDef( std::list< Label > & llabel, Statement * definition ) {
    8080                assert( definition != 0 );
    8181                assert( llabel.size() > 0 );
    82 
    83                 Entry * e = new Entry( definition );
    8482
    8583                for ( std::list< Label >::iterator i = llabel.begin(); i != llabel.end(); i++ ) {
     
    8785                        l.set_statement( definition ); // attach statement to the label to be used later
    8886                        if ( labelTable.find( l ) == labelTable.end() ) {
    89                                 // all labels on this statement need to use the same entry, so this should only be created once
     87                                // All labels on this statement need to use the same entry,
     88                                // so this should only be created once.
    9089                                // undefined and unused until now, add an entry
    91                                 labelTable[ l ] =  e;
     90                                labelTable[ l ] = new Entry( definition );
    9291                        } else if ( labelTable[ l ]->defined() ) {
    9392                                // defined twice, error
    94                                 SemanticError( l.get_statement()->location, "Duplicate definition of label: " + l.get_name() );
    95                         }       else {
     93                                SemanticError( l.get_statement()->location,
     94                                        "Duplicate definition of label: " + l.get_name() );
     95                        } else {
    9696                                // used previously, but undefined until now -> link with this entry
     97                                // Question: Is changing objects important?
    9798                                delete labelTable[ l ];
    98                                 labelTable[ l ] = e;
     99                                labelTable[ l ] = new Entry( definition );
    99100                        } // if
    100101                } // for
    101102
    102                 // produce one of the labels attached to this statement to be temporarily used as the canonical label
     103                // Produce one of the labels attached to this statement to be temporarily used as the
     104                // canonical label.
    103105                return labelTable[ llabel.front() ]->get_label();
    104106        }
Note: See TracChangeset for help on using the changeset viewer.