Changeset f80e0218 for src/ControlStruct/LabelFixer.cc
- Timestamp:
- Jun 30, 2016, 4:32:56 PM (10 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- ea29e73
- Parents:
- 1b5c81ed (diff), 84d4d6f (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
-
src/ControlStruct/LabelFixer.cc (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/ControlStruct/LabelFixer.cc
r1b5c81ed rf80e0218 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // LabelFixer.cc -- 7 // LabelFixer.cc -- 8 8 // 9 9 // Author : Rodolfo G. Esteves … … 86 86 87 87 88 // sets the definition of the labelTable entry to be the provided 88 // sets the definition of the labelTable entry to be the provided 89 89 // statement for every label in the list parameter. Happens for every kind of statement 90 90 Label LabelFixer::setLabelsDef( std::list< Label > &llabel, Statement *definition ) { … … 95 95 96 96 for ( std::list< Label >::iterator i = llabel.begin(); i != llabel.end(); i++ ) { 97 if ( labelTable.find( *i ) == labelTable.end() ) { 97 Label & l = *i; 98 l.set_statement( definition ); // attach statement to the label to be used later 99 if ( labelTable.find( l ) == labelTable.end() ) { 98 100 // all labels on this statement need to use the same entry, so this should only be created once 99 101 // undefined and unused until now, add an entry 100 labelTable[ *i] = e;101 } else if ( labelTable[ *i]->defined() ) {102 labelTable[ l ] = e; 103 } else if ( labelTable[ l ]->defined() ) { 102 104 // defined twice, error 103 throw SemanticError( "Duplicate definition of label: " + *i);105 throw SemanticError( "Duplicate definition of label: " + l.get_name() ); 104 106 } else { 105 107 // used previously, but undefined until now -> link with this entry 106 delete labelTable[ *i];107 labelTable[ *i] = e;108 delete labelTable[ l ]; 109 labelTable[ l ] = e; 108 110 } // if 109 111 } // for 110 112 111 // produce one of the labels attached to this statement to be 113 // produce one of the labels attached to this statement to be 112 114 // temporarily used as the canonical label 113 115 return labelTable[ llabel.front() ]->get_label(); 114 116 } 115 117 116 // A label was used, add it otthe table if it isn't already there118 // A label was used, add it to the table if it isn't already there 117 119 template< typename UsageNode > 118 120 void LabelFixer::setLabelsUsg( Label orgValue, UsageNode *use ) { … … 130 132 for ( std::map< Label, Entry * >::iterator i = labelTable.begin(); i != labelTable.end(); ++i ) { 131 133 if ( ! i->second->defined() ) { 132 throw SemanticError( "Use of undefined label: " + i->first );134 throw SemanticError( "Use of undefined label: " + i->first.get_name() ); 133 135 } 134 136 (*ret)[ i->first ] = i->second->get_definition();
Note:
See TracChangeset
for help on using the changeset viewer.