Changes in / [4b5857f:f6ed7fd]


Ignore:
Location:
src
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    r4b5857f rf6ed7fd  
    806806
    807807                for ( std::list< Label >::iterator i = l.begin(); i != l.end(); i++ )
    808                         str += (*i).get_name() + ": ";
     808                        str += *i + ": ";
    809809
    810810                return str;
  • src/ControlStruct/LabelFixer.cc

    r4b5857f rf6ed7fd  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // LabelFixer.cc --
     7// LabelFixer.cc -- 
    88//
    99// Author           : Rodolfo G. Esteves
     
    8686
    8787
    88         // sets the definition of the labelTable entry to be the provided
     88        // sets the definition of the labelTable entry to be the provided 
    8989        // statement for every label in the list parameter. Happens for every kind of statement
    9090        Label LabelFixer::setLabelsDef( std::list< Label > &llabel, Statement *definition ) {
     
    101101                        } else if ( labelTable[ *i ]->defined() ) {
    102102                                // defined twice, error
    103                                 throw SemanticError( "Duplicate definition of label: " + (*i).get_name() );
     103                                throw SemanticError( "Duplicate definition of label: " + *i );
    104104                        }       else {
    105105                                // used previously, but undefined until now -> link with this entry
     
    109109                } // for
    110110
    111                 // produce one of the labels attached to this statement to be
     111                // produce one of the labels attached to this statement to be 
    112112                // temporarily used as the canonical label
    113113                return labelTable[ llabel.front() ]->get_label();
     
    130130                for ( std::map< Label, Entry * >::iterator i = labelTable.begin(); i != labelTable.end(); ++i ) {
    131131                        if ( ! i->second->defined() ) {
    132                                 throw SemanticError( "Use of undefined label: " + i->first.get_name() );
     132                                throw SemanticError( "Use of undefined label: " + i->first );
    133133                        }
    134134                        (*ret)[ i->first ] = i->second->get_definition();
  • src/ControlStruct/LabelFixer.h

    r4b5857f rf6ed7fd  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // LabelFixer.h --
     7// LabelFixer.h -- 
    88//
    99// Author           : Rodolfo G. Esteves
     
    2020#include "SynTree/SynTree.h"
    2121#include "SynTree/Visitor.h"
    22 #include "SynTree/Label.h"
    2322#include "LabelGenerator.h"
     23
    2424#include <map>
    2525
     
    7474
    7575                  private:
    76                         Label label;
     76                        Label label; 
    7777                        Statement *definition;
    7878                };
    79 
     79                 
    8080                std::map < Label, Entry *> labelTable;
    8181                LabelGenerator *generator;
  • src/ControlStruct/LabelGenerator.cc

    r4b5857f rf6ed7fd  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // LabelGenerator.cc --
     7// LabelGenerator.cc -- 
    88//
    99// Author           : Rodolfo G. Esteves
     
    1818
    1919#include "LabelGenerator.h"
    20 #include "SynTree/Label.h"
    2120
    2221namespace ControlStruct {
  • src/ControlStruct/MLEMutator.h

    r4b5857f rf6ed7fd  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // MLEMutator.h --
     7// MLEMutator.h -- 
    88//
    99// Author           : Rodolfo G. Esteves
     
    2323#include "SynTree/SynTree.h"
    2424#include "SynTree/Mutator.h"
    25 #include "SynTree/Label.h"
    2625
    2726#include "LabelGenerator.h"
     
    3938                Statement *mutate( BranchStmt *branchStmt ) throw ( SemanticError );
    4039
    41                 Statement *mutate( CaseStmt *caseStmt );
     40                Statement *mutate( CaseStmt *caseStmt ); 
    4241                Statement *mutate( SwitchStmt *switchStmt );
    4342                Statement *mutate( ChooseStmt *switchStmt );
     
    8079                Statement *handleLoopStmt( LoopClass *loopStmt );
    8180
    82                 template< typename SwitchClass >
     81                template< typename SwitchClass > 
    8382                Statement *handleSwitchStmt( SwitchClass *switchStmt );
    8483
  • src/GenPoly/Specialize.cc

    r4b5857f rf6ed7fd  
    9999                } // if
    100100                // 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( noLabels ), false, false );
     101                FunctionDecl *thunkFunc = new FunctionDecl( thunkNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, newType, new CompoundStmt( std::list< std::string >() ), false, false );
    102102                thunkFunc->fixUniqueId();
    103103
  • src/InitTweak/FixInit.cc

    r4b5857f rf6ed7fd  
    281281                PRINT( std::cerr << "Coming out the back..." << impCpCtorExpr << std::endl; )
    282282
    283                 // detach fields from wrapper node so that it can be deleted without deleting too much
     283                // xxx - some of these aren't necessary, and can be removed once this is stable
    284284                dtors.clear();
    285285                tempDecls.clear();
  • src/InitTweak/InitTweak.cc

    r4b5857f rf6ed7fd  
    115115
    116116        namespace {
    117                 std::string funcName( Expression * func ) {
     117                template<typename CallExpr>
     118                std::string funcName( CallExpr * expr ) {
     119                        Expression * func = expr->get_function();
    118120                        if ( NameExpr * nameExpr = dynamic_cast< NameExpr * >( func ) ) {
    119121                                return nameExpr->get_name();
    120122                        } else if ( VariableExpr * varExpr = dynamic_cast< VariableExpr * >( func ) ) {
    121123                                return varExpr->get_var()->get_name();
    122                         }       else if ( CastExpr * castExpr = dynamic_cast< CastExpr * >( func ) ) {
    123                                 return funcName( castExpr->get_arg() );
    124124                        } else {
    125125                                assert( false && "Unexpected expression type being called as a function in call expression" );
     
    130130        std::string getFunctionName( Expression * expr ) {
    131131                if ( ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * >( expr ) ) {
    132                         return funcName( appExpr->get_function() );
     132                        return funcName( appExpr );
    133133                } else if ( UntypedExpr * untypedExpr = dynamic_cast< UntypedExpr * > ( expr ) ) {
    134                         return funcName( untypedExpr->get_function() );
     134                        return funcName( untypedExpr );
    135135                } else {
    136                         std::cerr << expr << std::endl;
    137136                        assert( false && "Unexpected expression type passed to getFunctionName" );
    138137                }
  • src/Parser/ParseNode.h

    r4b5857f rf6ed7fd  
    2828//#include "SynTree/Declaration.h"
    2929#include "Common/UniqueName.h"
    30 #include "SynTree/Label.h"
    3130
    3231class ExpressionNode;
     
    285284        virtual void printOneLine( std::ostream &, int indent = 0) const;
    286285
    287         const std::list< Label > &get_labels() const { return labels; };
     286        const std::list< std::string > &get_labels() const { return labels; };
    288287        void append_label( std::string *label ) { labels.push_back( *label ); delete label; }
    289288  private:
    290         std::list< Label > labels;
     289        std::list< std::string > labels;
    291290};
    292291
     
    525524        ExpressionNode *output, *input;
    526525        ConstantNode *clobber;
    527         std::list< Label > gotolabels;
     526        std::list<std::string> gotolabels;
    528527};
    529528
  • src/Parser/StatementNode.cc

    r4b5857f rf6ed7fd  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // StatementNode.cc --
     7// StatementNode.cc -- 
    88//
    99// Author           : Rodolfo G. Esteves
     
    2727
    2828const 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", 
    3131        "Goto",  "Continue", "Break",  "Return",  "Throw",
    3232        "Try",   "Catch",    "Finally", "Asm",
     
    6262StatementNode::StatementNode( Type t, ExpressionNode *ctrl_label, StatementNode *block ) : type( t ), control( ctrl_label ), block( block ), labels( 0 ), target( 0 ), decl( 0 ), isCatchRest ( false ) {
    6363        this->control = ( t == Default ) ? 0 : control;
    64 }
     64} 
    6565
    6666StatementNode::StatementNode( Type t, string *target ) : type( t ), control( 0 ), block( 0 ), labels( 0 ), target( target ), decl( 0 ), isCatchRest ( false ) {}
     
    7474
    7575StatementNode * 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 ); 
    7777        ret->addDeclaration( d );
    7878        ret->setCatchRest( catchRestP );
     
    101101StatementNode *StatementNode::add_label( const std::string *l ) {
    102102        if ( l != 0 ) {
    103                 labels.push_front( *l );
     103                labels.push_front( *l ); 
    104104                delete l;
    105105        } // if
     
    156156                        control->print( os, indent );
    157157                        os << endl;
    158                 } else
     158                } else 
    159159                        os << string( indent, ' ' ) << "Null Statement" << endl;
    160160                break;
     
    177177                if ( block ) {
    178178                        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 ); 
    180180                } // if
    181181                if ( target ) {
     
    258258          case Fallthru:
    259259                return new FallthruStmt( labs );
    260           case Case:
     260          case Case: 
    261261                return new CaseStmt( labs, maybeBuild<Expression>(get_control()), branches );
    262262          case Default:
     
    394394                os << string( indent + ParseNode::indent_by, ' ' ) << "Goto Labels:" << endl;
    395395                os << string( indent + 2 * ParseNode::indent_by, ' ' );
    396                 for ( std::list<Label>::const_iterator i = gotolabels.begin();; ) {
     396                for ( std::list<std::string>::const_iterator i = gotolabels.begin();; ) {
    397397                        os << *i;
    398398                        i++;
     
    426426}
    427427
    428 Statement *NullStmtNode::build() const {
     428Statement *NullStmtNode::build() const { 
    429429        return new NullStmt;
    430430}
  • src/SymTab/Autogen.cc

    r4b5857f rf6ed7fd  
    482482                ObjectDecl *dst = new ObjectDecl( "_dst", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), typeInst->clone() ), 0 );
    483483                if ( typeDecl->get_base() ) {
    484                         // xxx - generate ctor/dtors for typedecls, e.g.
    485                         // otype T = int *;
    486484                        stmts = new CompoundStmt( std::list< Label >() );
    487485                        UntypedExpr *assign = new UntypedExpr( new NameExpr( "?=?" ) );
  • src/SymTab/Autogen.h

    r4b5857f rf6ed7fd  
    2424
    2525namespace SymTab {
     26  static const std::list< std::string > noLabels;
     27
    2628  /// Generates assignment operators, constructors, and destructor for aggregate types as required
    2729  void autogenerateRoutines( std::list< Declaration * > &translationUnit );
  • src/SynTree/Statement.cc

    r4b5857f rf6ed7fd  
    8787        Statement( labels ), originalTarget( _target ), target( _target ), computedTarget( NULL ), type( _type ) {
    8888        //actually this is a syntactic error signaled by the parser
    89         if ( type == BranchStmt::Goto && target.empty() )
     89        if ( type == BranchStmt::Goto && target.size() == 0 )
    9090                throw SemanticError("goto without target");
    9191}
  • src/SynTree/Statement.h

    r4b5857f rf6ed7fd  
    2222#include "Common/SemanticError.h"
    2323#include "Type.h"
    24 #include "Label.h"
    2524
    2625class Statement {
  • src/SynTree/SynTree.h

    r4b5857f rf6ed7fd  
    113113class Constant;
    114114
    115 // typedef std::string Label;
    116 class Label;
     115typedef std::string Label;
    117116typedef unsigned int UniqueId;
    118117
Note: See TracChangeset for help on using the changeset viewer.