Ignore:
Timestamp:
May 19, 2015, 4:58:14 PM (11 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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, string, stuck-waitfor-destruct, with_gc
Children:
843054c2
Parents:
01aeade
Message:

licencing: sixth groups of files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • translator/SymTab/Mangler.cc

    r01aeade ra08ba92  
    1010// Created On       : Sun May 17 21:40:29 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun May 17 21:43:49 2015
    13 // Update Count     : 2
     12// Last Modified On : Tue May 19 16:50:47 2015
     13// Update Count     : 3
    1414//
    1515
     
    3030
    3131namespace SymTab {
    32     Mangler::Mangler() : nextVarNum( 0 ), isTopLevel( true ) {
     32        Mangler::Mangler() : nextVarNum( 0 ), isTopLevel( true ) {
    3333        }
    3434
     
    3737//{
    3838//}
    39     Mangler::Mangler( const Mangler &rhs ) : mangleName() {
     39        Mangler::Mangler( const Mangler &rhs ) : mangleName() {
    4040                varNums = rhs.varNums;
    4141                nextVarNum = rhs.nextVarNum;
    4242                isTopLevel = rhs.isTopLevel;
    43     }
    44 
    45     void Mangler::mangleDecl( DeclarationWithType *declaration ) {
     43        }
     44
     45        void Mangler::mangleDecl( DeclarationWithType *declaration ) {
    4646                bool wasTopLevel = isTopLevel;
    4747                if ( isTopLevel ) {
     
    6060                maybeAccept( declaration->get_type(), *this );
    6161                isTopLevel = wasTopLevel;
    62     }
    63 
    64     void Mangler::visit( ObjectDecl *declaration ) {
     62        }
     63
     64        void Mangler::visit( ObjectDecl *declaration ) {
    6565                mangleDecl( declaration );
    66     }
    67 
    68     void Mangler::visit( FunctionDecl *declaration ) {
     66        }
     67
     68        void Mangler::visit( FunctionDecl *declaration ) {
    6969                mangleDecl( declaration );
    70     }
    71 
    72     void Mangler::visit( VoidType *voidType ) {
     70        }
     71
     72        void Mangler::visit( VoidType *voidType ) {
    7373                printQualifiers( voidType );
    7474                mangleName << "v";
    75     }
    76 
    77     void Mangler::visit( BasicType *basicType ) {
     75        }
     76
     77        void Mangler::visit( BasicType *basicType ) {
    7878                static const char *btLetter[] = {
    7979                        "b",    // Bool
     
    102102                printQualifiers( basicType );
    103103                mangleName << btLetter[ basicType->get_kind() ];
    104     }
    105 
    106     void Mangler::visit( PointerType *pointerType ) {
     104        }
     105
     106        void Mangler::visit( PointerType *pointerType ) {
    107107                printQualifiers( pointerType );
    108108                mangleName << "P";
    109109                maybeAccept( pointerType->get_base(), *this );
    110     }
    111 
    112     void Mangler::visit( ArrayType *arrayType ) {
     110        }
     111
     112        void Mangler::visit( ArrayType *arrayType ) {
    113113                // TODO: encode dimension
    114114                printQualifiers( arrayType );
    115115                mangleName << "A0";
    116116                maybeAccept( arrayType->get_base(), *this );
    117     }
    118 
    119     namespace {
     117        }
     118
     119        namespace {
    120120                inline std::list< Type* > getTypes( const std::list< DeclarationWithType* > decls ) {
    121121                        std::list< Type* > ret;
     
    124124                        return ret;
    125125                }
    126     }
    127 
    128     void Mangler::visit( FunctionType *functionType ) {
     126        }
     127
     128        void Mangler::visit( FunctionType *functionType ) {
    129129                printQualifiers( functionType );
    130130                mangleName << "F";
     
    135135                acceptAll( paramTypes, *this );
    136136                mangleName << "_";
    137     }
    138 
    139     void Mangler::mangleRef( ReferenceToType *refType, std::string prefix ) {
     137        }
     138
     139        void Mangler::mangleRef( ReferenceToType *refType, std::string prefix ) {
    140140                printQualifiers( refType );
    141141                mangleName << ( refType->get_name().length() + prefix.length() ) << prefix << refType->get_name();
    142     }
    143 
    144     void Mangler::visit( StructInstType *aggregateUseType ) {
     142        }
     143
     144        void Mangler::visit( StructInstType *aggregateUseType ) {
    145145                mangleRef( aggregateUseType, "s" );
    146     }
    147 
    148     void Mangler::visit( UnionInstType *aggregateUseType ) {
     146        }
     147
     148        void Mangler::visit( UnionInstType *aggregateUseType ) {
    149149                mangleRef( aggregateUseType, "u" );
    150     }
    151 
    152     void Mangler::visit( EnumInstType *aggregateUseType ) {
     150        }
     151
     152        void Mangler::visit( EnumInstType *aggregateUseType ) {
    153153                mangleRef( aggregateUseType, "e" );
    154     }
    155 
    156     void Mangler::visit( TypeInstType *typeInst ) {
     154        }
     155
     156        void Mangler::visit( TypeInstType *typeInst ) {
    157157                VarMapType::iterator varNum = varNums.find( typeInst->get_name() );
    158158                if ( varNum == varNums.end() ) {
     
    176176                        mangleName << std::string( numStream.str(), numStream.pcount() );
    177177                } // if
    178     }
    179 
    180     void Mangler::visit( TupleType *tupleType ) {
     178        }
     179
     180        void Mangler::visit( TupleType *tupleType ) {
    181181                printQualifiers( tupleType );
    182182                mangleName << "T";
    183183                acceptAll( tupleType->get_types(), *this );
    184184                mangleName << "_";
    185     }
    186 
    187     void Mangler::visit( TypeDecl *decl ) {
     185        }
     186
     187        void Mangler::visit( TypeDecl *decl ) {
    188188                static const char *typePrefix[] = { "BT", "BD", "BF" };
    189189                mangleName << typePrefix[ decl->get_kind() ] << ( decl->get_name().length() + 1 ) << decl->get_name();
    190     }
    191 
    192     void printVarMap( const std::map< std::string, std::pair< int, int > > &varMap, std::ostream &os ) {
     190        }
     191
     192        void printVarMap( const std::map< std::string, std::pair< int, int > > &varMap, std::ostream &os ) {
    193193                for ( std::map< std::string, std::pair< int, int > >::const_iterator i = varMap.begin(); i != varMap.end(); ++i ) {
    194194                        os << i->first << "(" << i->second.first << "/" << i->second.second << ")" << std::endl;
    195195                } // for
    196     }
    197 
    198     void Mangler::printQualifiers( Type *type ) {
     196        }
     197
     198        void Mangler::printQualifiers( Type *type ) {
    199199                if ( ! type->get_forall().empty() ) {
    200200                        std::list< std::string > assertionNames;
     
    242242                        mangleName << "A";
    243243                } // if
    244     }
     244        }
    245245} // namespace SymTab
    246246
Note: See TracChangeset for help on using the changeset viewer.