Changeset 4737d8e
- Timestamp:
- Jan 10, 2020, 2:04:57 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- 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. - 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.