Changeset 0f8e4ac
- Timestamp:
- Jun 16, 2016, 12:24:39 PM (9 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:
- 25296a3
- Parents:
- f4bc57c
- Location:
- src
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/CodeGenerator.cc
rf4bc57c r0f8e4ac 806 806 807 807 for ( std::list< Label >::iterator i = l.begin(); i != l.end(); i++ ) 808 str += *i+ ": ";808 str += (*i).get_name() + ": "; 809 809 810 810 return str; -
src/ControlStruct/LabelFixer.cc
rf4bc57c r0f8e4ac 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 ) { … … 101 101 } else if ( labelTable[ *i ]->defined() ) { 102 102 // defined twice, error 103 throw SemanticError( "Duplicate definition of label: " + *i);103 throw SemanticError( "Duplicate definition of label: " + (*i).get_name() ); 104 104 } else { 105 105 // used previously, but undefined until now -> link with this entry … … 109 109 } // for 110 110 111 // produce one of the labels attached to this statement to be 111 // produce one of the labels attached to this statement to be 112 112 // temporarily used as the canonical label 113 113 return labelTable[ llabel.front() ]->get_label(); … … 130 130 for ( std::map< Label, Entry * >::iterator i = labelTable.begin(); i != labelTable.end(); ++i ) { 131 131 if ( ! i->second->defined() ) { 132 throw SemanticError( "Use of undefined label: " + i->first );132 throw SemanticError( "Use of undefined label: " + i->first.get_name() ); 133 133 } 134 134 (*ret)[ i->first ] = i->second->get_definition(); -
src/ControlStruct/LabelFixer.h
rf4bc57c r0f8e4ac 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // LabelFixer.h -- 7 // LabelFixer.h -- 8 8 // 9 9 // Author : Rodolfo G. Esteves … … 20 20 #include "SynTree/SynTree.h" 21 21 #include "SynTree/Visitor.h" 22 #include "SynTree/Label.h" 22 23 #include "LabelGenerator.h" 23 24 24 #include <map> 25 25 … … 74 74 75 75 private: 76 Label label; 76 Label label; 77 77 Statement *definition; 78 78 }; 79 79 80 80 std::map < Label, Entry *> labelTable; 81 81 LabelGenerator *generator; -
src/ControlStruct/LabelGenerator.cc
rf4bc57c r0f8e4ac 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // LabelGenerator.cc -- 7 // LabelGenerator.cc -- 8 8 // 9 9 // Author : Rodolfo G. Esteves … … 18 18 19 19 #include "LabelGenerator.h" 20 #include "SynTree/Label.h" 20 21 21 22 namespace ControlStruct { -
src/ControlStruct/MLEMutator.h
rf4bc57c r0f8e4ac 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // MLEMutator.h -- 7 // MLEMutator.h -- 8 8 // 9 9 // Author : Rodolfo G. Esteves … … 23 23 #include "SynTree/SynTree.h" 24 24 #include "SynTree/Mutator.h" 25 #include "SynTree/Label.h" 25 26 26 27 #include "LabelGenerator.h" … … 38 39 Statement *mutate( BranchStmt *branchStmt ) throw ( SemanticError ); 39 40 40 Statement *mutate( CaseStmt *caseStmt ); 41 Statement *mutate( CaseStmt *caseStmt ); 41 42 Statement *mutate( SwitchStmt *switchStmt ); 42 43 Statement *mutate( ChooseStmt *switchStmt ); … … 79 80 Statement *handleLoopStmt( LoopClass *loopStmt ); 80 81 81 template< typename SwitchClass > 82 template< typename SwitchClass > 82 83 Statement *handleSwitchStmt( SwitchClass *switchStmt ); 83 84 -
src/GenPoly/Specialize.cc
rf4bc57c r0f8e4ac 99 99 } // if 100 100 // create new thunk with same signature as formal type (C linkage, empty body) 101 FunctionDecl *thunkFunc = new FunctionDecl( thunkNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, newType, new CompoundStmt( std::list< std::string >()), false, false );101 FunctionDecl *thunkFunc = new FunctionDecl( thunkNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, newType, new CompoundStmt( noLabels ), false, false ); 102 102 thunkFunc->fixUniqueId(); 103 103 -
src/InitTweak/FixInit.cc
rf4bc57c r0f8e4ac 281 281 PRINT( std::cerr << "Coming out the back..." << impCpCtorExpr << std::endl; ) 282 282 283 // xxx - some of these aren't necessary, and can be removed once this is stable283 // detach fields from wrapper node so that it can be deleted without deleting too much 284 284 dtors.clear(); 285 285 tempDecls.clear(); -
src/Parser/ParseNode.h
rf4bc57c r0f8e4ac 28 28 //#include "SynTree/Declaration.h" 29 29 #include "Common/UniqueName.h" 30 #include "SynTree/Label.h" 30 31 31 32 class ExpressionNode; … … 284 285 virtual void printOneLine( std::ostream &, int indent = 0) const; 285 286 286 const std::list< std::string> &get_labels() const { return labels; };287 const std::list< Label > &get_labels() const { return labels; }; 287 288 void append_label( std::string *label ) { labels.push_back( *label ); delete label; } 288 289 private: 289 std::list< std::string> labels;290 std::list< Label > labels; 290 291 }; 291 292 … … 524 525 ExpressionNode *output, *input; 525 526 ConstantNode *clobber; 526 std::list< std::string> gotolabels;527 std::list< Label > gotolabels; 527 528 }; 528 529 -
src/Parser/StatementNode.cc
rf4bc57c r0f8e4ac 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // StatementNode.cc -- 7 // StatementNode.cc -- 8 8 // 9 9 // Author : Rodolfo G. Esteves … … 27 27 28 28 const char *StatementNode::StType[] = { 29 "Exp", "If", "Switch", "Case", "Default", "Choose", "Fallthru", 30 "While", "Do", "For", 29 "Exp", "If", "Switch", "Case", "Default", "Choose", "Fallthru", 30 "While", "Do", "For", 31 31 "Goto", "Continue", "Break", "Return", "Throw", 32 32 "Try", "Catch", "Finally", "Asm", … … 62 62 StatementNode::StatementNode( Type t, ExpressionNode *ctrl_label, StatementNode *block ) : type( t ), control( ctrl_label ), block( block ), labels( 0 ), target( 0 ), decl( 0 ), isCatchRest ( false ) { 63 63 this->control = ( t == Default ) ? 0 : control; 64 } 64 } 65 65 66 66 StatementNode::StatementNode( Type t, string *target ) : type( t ), control( 0 ), block( 0 ), labels( 0 ), target( target ), decl( 0 ), isCatchRest ( false ) {} … … 74 74 75 75 StatementNode * StatementNode::newCatchStmt( DeclarationNode *d, StatementNode *s, bool catchRestP ) { 76 StatementNode *ret = new StatementNode( StatementNode::Catch, 0, s ); 76 StatementNode *ret = new StatementNode( StatementNode::Catch, 0, s ); 77 77 ret->addDeclaration( d ); 78 78 ret->setCatchRest( catchRestP ); … … 101 101 StatementNode *StatementNode::add_label( const std::string *l ) { 102 102 if ( l != 0 ) { 103 labels.push_front( *l ); 103 labels.push_front( *l ); 104 104 delete l; 105 105 } // if … … 156 156 control->print( os, indent ); 157 157 os << endl; 158 } else 158 } else 159 159 os << string( indent, ' ' ) << "Null Statement" << endl; 160 160 break; … … 177 177 if ( block ) { 178 178 os << string( indent + ParseNode::indent_by, ' ' ) << "Branches of execution: " << endl; 179 block->printList( os, indent + 2 * ParseNode::indent_by ); 179 block->printList( os, indent + 2 * ParseNode::indent_by ); 180 180 } // if 181 181 if ( target ) { … … 258 258 case Fallthru: 259 259 return new FallthruStmt( labs ); 260 case Case: 260 case Case: 261 261 return new CaseStmt( labs, maybeBuild<Expression>(get_control()), branches ); 262 262 case Default: … … 394 394 os << string( indent + ParseNode::indent_by, ' ' ) << "Goto Labels:" << endl; 395 395 os << string( indent + 2 * ParseNode::indent_by, ' ' ); 396 for ( std::list< std::string>::const_iterator i = gotolabels.begin();; ) {396 for ( std::list<Label>::const_iterator i = gotolabels.begin();; ) { 397 397 os << *i; 398 398 i++; … … 426 426 } 427 427 428 Statement *NullStmtNode::build() const { 428 Statement *NullStmtNode::build() const { 429 429 return new NullStmt; 430 430 } -
src/SymTab/Autogen.h
rf4bc57c r0f8e4ac 24 24 25 25 namespace SymTab { 26 static const std::list< std::string > noLabels;27 28 26 /// Generates assignment operators, constructors, and destructor for aggregate types as required 29 27 void autogenerateRoutines( std::list< Declaration * > &translationUnit ); -
src/SynTree/Statement.cc
rf4bc57c r0f8e4ac 87 87 Statement( labels ), originalTarget( _target ), target( _target ), computedTarget( NULL ), type( _type ) { 88 88 //actually this is a syntactic error signaled by the parser 89 if ( type == BranchStmt::Goto && target. size() == 0)89 if ( type == BranchStmt::Goto && target.empty() ) 90 90 throw SemanticError("goto without target"); 91 91 } -
src/SynTree/Statement.h
rf4bc57c r0f8e4ac 22 22 #include "Common/SemanticError.h" 23 23 #include "Type.h" 24 #include "Label.h" 24 25 25 26 class Statement { -
src/SynTree/SynTree.h
rf4bc57c r0f8e4ac 113 113 class Constant; 114 114 115 typedef std::string Label; 115 // typedef std::string Label; 116 class Label; 116 117 typedef unsigned int UniqueId; 117 118
Note: See TracChangeset
for help on using the changeset viewer.