Changes in / [9e1fa35:4737d8e]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ControlStruct/LabelFixer.cc
r9e1fa35 r4737d8e 75 75 76 76 77 // sets the definition of the labelTable entry to be the provided statement for every label in the list78 // parameter. Happens for every kind of statement77 // 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. 79 79 Label LabelFixer::setLabelsDef( std::list< Label > & llabel, Statement * definition ) { 80 80 assert( definition != 0 ); 81 81 assert( llabel.size() > 0 ); 82 83 Entry * e = new Entry( definition );84 82 85 83 for ( std::list< Label >::iterator i = llabel.begin(); i != llabel.end(); i++ ) { … … 87 85 l.set_statement( definition ); // attach statement to the label to be used later 88 86 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. 90 89 // undefined and unused until now, add an entry 91 labelTable[ l ] = e;90 labelTable[ l ] = new Entry( definition ); 92 91 } else if ( labelTable[ l ]->defined() ) { 93 92 // 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 { 96 96 // used previously, but undefined until now -> link with this entry 97 // Question: Is changing objects important? 97 98 delete labelTable[ l ]; 98 labelTable[ l ] = e;99 labelTable[ l ] = new Entry( definition ); 99 100 } // if 100 101 } // for 101 102 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. 103 105 return labelTable[ llabel.front() ]->get_label(); 104 106 }
Note: See TracChangeset
for help on using the changeset viewer.