Ignore:
Timestamp:
Jun 6, 2015, 11:38:58 PM (9 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, with_gc
Children:
cd623a4
Parents:
a65d92e
Message:

constant types, first attempt

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    ra65d92e r59db689  
    1010// Created On       : Sat May 16 12:34:05 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jun  3 11:54:32 2015
    13 // Update Count     : 14
     12// Last Modified On : Sat Jun  6 23:29:13 2015
     13// Update Count     : 23
    1414//
    1515
     
    7474
    7575void DeclarationNode::print( std::ostream &os, int indent ) const {
    76         os << string(indent, ' ' );
     76        os << string( indent, ' ' );
    7777        if ( name == "" ) {
    7878                os << "unnamed: ";
     
    9393
    9494        if ( bitfieldWidth ) {
    95                 os << endl << string(indent+2,  ' ') << "with bitfield width ";
     95                os << endl << string( indent + 2, ' ' ) << "with bitfield width ";
    9696                bitfieldWidth->printOneLine( os );
    9797        }
    9898
    9999        if ( initializer != 0 ) {
    100                 os << endl << string(indent+2,  ' ') << "with initializer ";
     100                os << endl << string( indent + 2, ' ' ) << "with initializer ";
    101101                initializer->printOneLine( os );
    102102        }
     
    161161}
    162162
    163 DeclarationNode *DeclarationNode::newForall( DeclarationNode* forall ) {
     163DeclarationNode *DeclarationNode::newForall( DeclarationNode *forall ) {
    164164        DeclarationNode *newnode = new DeclarationNode;
    165165        newnode->type = new TypeData( TypeData::Unknown );
     
    168168}
    169169
    170 DeclarationNode *DeclarationNode::newFromTypedef( std::string* name ) {
     170DeclarationNode *DeclarationNode::newFromTypedef( std::string *name ) {
    171171        DeclarationNode *newnode = new DeclarationNode;
    172172        newnode->type = new TypeData( TypeData::SymbolicInst );
     
    177177}
    178178
    179 DeclarationNode *DeclarationNode::newAggregate( TyCon kind, std::string* name, DeclarationNode *formals, ExpressionNode *actuals, DeclarationNode *fields ) {
     179DeclarationNode *DeclarationNode::newAggregate( TyCon kind, std::string *name, DeclarationNode *formals, ExpressionNode *actuals, DeclarationNode *fields ) {
    180180        DeclarationNode *newnode = new DeclarationNode;
    181181        newnode->type = new TypeData( TypeData::Aggregate );
     
    203203}
    204204
    205 DeclarationNode *DeclarationNode::newEnumConstant( std::string* name, ExpressionNode *constant ) {
     205DeclarationNode *DeclarationNode::newEnumConstant( std::string *name, ExpressionNode *constant ) {
    206206        DeclarationNode *newnode = new DeclarationNode;
    207207        newnode->name = assign_strptr( name );
     
    210210}
    211211
    212 DeclarationNode *DeclarationNode::newName( std::string* name ) {
     212DeclarationNode *DeclarationNode::newName( std::string *name ) {
    213213        DeclarationNode *newnode = new DeclarationNode;
    214214        newnode->name = assign_strptr( name );
     
    216216}
    217217
    218 DeclarationNode *DeclarationNode::newFromTypeGen( std::string* name, ExpressionNode *params ) {
     218DeclarationNode *DeclarationNode::newFromTypeGen( std::string *name, ExpressionNode *params ) {
    219219        DeclarationNode *newnode = new DeclarationNode;
    220220        newnode->type = new TypeData( TypeData::SymbolicInst );
     
    225225}
    226226
    227 DeclarationNode *DeclarationNode::newTypeParam( TypeClass tc, std::string* name ) {
     227DeclarationNode *DeclarationNode::newTypeParam( TypeClass tc, std::string *name ) {
    228228        DeclarationNode *newnode = new DeclarationNode;
    229229        newnode->name = assign_strptr( name );
     
    467467}
    468468
    469 DeclarationNode *DeclarationNode::addAssertions( DeclarationNode* assertions ) {
     469DeclarationNode *DeclarationNode::addAssertions( DeclarationNode *assertions ) {
    470470        assert( type );
    471471        switch ( type->kind ) {
     
    493493}
    494494
    495 DeclarationNode *DeclarationNode::addName( std::string* newname ) {
     495DeclarationNode *DeclarationNode::addName( std::string *newname ) {
    496496        name = assign_strptr( newname );
    497497        return this;
     
    758758void buildList( const DeclarationNode *firstNode, std::list< Declaration * > &outputList ) {
    759759        SemanticError errors;
    760         std::back_insert_iterator< std::list< Declaration* > > out( outputList );
     760        std::back_insert_iterator< std::list< Declaration *> > out( outputList );
    761761        const DeclarationNode *cur = firstNode;
    762762        while ( cur ) {
     
    776776                        errors.append( e );
    777777                } // try
    778                 cur = dynamic_cast< DeclarationNode* >( cur->get_link() );
     778                cur = dynamic_cast< DeclarationNode *>( cur->get_link() );
    779779        } // while
    780780        if ( ! errors.isEmpty() ) {
     
    783783}
    784784
    785 void buildList( const DeclarationNode *firstNode, std::list< DeclarationWithType* > &outputList ) {
     785void buildList( const DeclarationNode *firstNode, std::list< DeclarationWithType *> &outputList ) {
    786786        SemanticError errors;
    787         std::back_insert_iterator< std::list< DeclarationWithType* > > out( outputList );
     787        std::back_insert_iterator< std::list< DeclarationWithType *> > out( outputList );
    788788        const DeclarationNode *cur = firstNode;
    789789        while ( cur ) {
     
    799799                        Declaration *decl = cur->build();
    800800                        if ( decl ) {
    801                                 if ( DeclarationWithType *dwt = dynamic_cast< DeclarationWithType* >( decl ) ) {
     801                                if ( DeclarationWithType *dwt = dynamic_cast< DeclarationWithType *>( decl ) ) {
    802802                                        *out++ = dwt;
    803                                 } else if ( StructDecl *agg = dynamic_cast< StructDecl* >( decl ) ) {
     803                                } else if ( StructDecl *agg = dynamic_cast< StructDecl *>( decl ) ) {
    804804                                        StructInstType *inst = new StructInstType( Type::Qualifiers(), agg->get_name() );
    805805                                        *out++ = new ObjectDecl( "", Declaration::NoStorageClass, linkage, 0, inst, 0 );
    806806                                        delete agg;
    807                                 } else if ( UnionDecl *agg = dynamic_cast< UnionDecl* >( decl ) ) {
     807                                } else if ( UnionDecl *agg = dynamic_cast< UnionDecl *>( decl ) ) {
    808808                                        UnionInstType *inst = new UnionInstType( Type::Qualifiers(), agg->get_name() );
    809809                                        *out++ = new ObjectDecl( "", Declaration::NoStorageClass, linkage, 0, inst, 0 );
     
    813813                        errors.append( e );
    814814                } // try
    815                 cur = dynamic_cast< DeclarationNode* >( cur->get_link() );
     815                cur = dynamic_cast< DeclarationNode *>( cur->get_link() );
    816816        } // while
    817817        if ( ! errors.isEmpty() ) {
     
    820820}
    821821
    822 void buildTypeList( const DeclarationNode *firstNode, std::list< Type* > &outputList ) {
     822void buildTypeList( const DeclarationNode *firstNode, std::list< Type *> &outputList ) {
    823823        SemanticError errors;
    824         std::back_insert_iterator< std::list< Type* > > out( outputList );
     824        std::back_insert_iterator< std::list< Type *> > out( outputList );
    825825        const DeclarationNode *cur = firstNode;
    826826        while ( cur ) {
     
    830830                        errors.append( e );
    831831                } // try
    832                 cur = dynamic_cast< DeclarationNode* >( cur->get_link() );
     832                cur = dynamic_cast< DeclarationNode *>( cur->get_link() );
    833833        } // while
    834834        if ( ! errors.isEmpty() ) {
Note: See TracChangeset for help on using the changeset viewer.