Ignore:
Timestamp:
Jul 16, 2015, 5:28:24 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:
994ec2c
Parents:
724c2b6
Message:

add CFA flag, remove -p from cc1, typedef on functions become function declarations, move isInline/isNoreturn to Declaration, cleaned up label code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Validate.cc

    r724c2b6 r1db21619  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sun May 17 21:50:04 2015
    11 // Last Modified By : Rob Schluntz
    12 // Last Modified On : Tue Jul 14 12:27:54 2015
    13 // Update Count     : 186
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Thu Jul 16 16:10:02 2015
     13// Update Count     : 189
    1414//
    1515
     
    162162        class EliminateTypedef : public Mutator {
    163163          public:
    164           EliminateTypedef() : scopeLevel( 0 ) {}
     164                EliminateTypedef() : scopeLevel( 0 ) {}
    165165                static void eliminateTypedef( std::list< Declaration * > &translationUnit );
    166166          private:
     
    168168                virtual TypeDecl *mutate( TypeDecl *typeDecl );
    169169                virtual DeclarationWithType *mutate( FunctionDecl *funcDecl );
    170                 virtual ObjectDecl *mutate( ObjectDecl *objDecl );
     170                virtual DeclarationWithType *mutate( ObjectDecl *objDecl );
    171171                virtual CompoundStmt *mutate( CompoundStmt *compoundStmt );
    172172                virtual Type *mutate( TypeInstType *aggregateUseType );
     
    612612
    613613                // need to remove the prototypes, since this may be nested in a routine
    614                 for (int start = 0, end = assigns.size()/2; start < end; start++) {
     614                for ( int start = 0, end = assigns.size() / 2; start < end; start++ ) {
    615615                        delete assigns.front();
    616616                        assigns.pop_front();
    617                 }
     617                } // for
    618618
    619619                declsToAdd.insert( declsToAdd.begin(), assigns.begin(), assigns.end() );
     
    830830                                rtt->get_parameters().clear();
    831831                                cloneAll(typeInst->get_parameters(), rtt->get_parameters());
    832                         }
     832                        } // if
    833833                        delete typeInst;
    834834                        return ret;
     
    884884        }
    885885
    886         ObjectDecl *EliminateTypedef::mutate( ObjectDecl * objDecl ) {
     886        DeclarationWithType *EliminateTypedef::mutate( ObjectDecl * objDecl ) {
    887887                TypedefMap oldNames = typedefNames;
    888                 ObjectDecl *ret = Mutator::mutate( objDecl );
     888                DeclarationWithType *ret = Mutator::mutate( objDecl );
     889                if ( FunctionType *funtype = dynamic_cast<FunctionType *>( ret->get_type() ) ) {
     890                        return new FunctionDecl( ret->get_name(), ret->get_storageClass(), ret->get_linkage(), funtype, 0, ret->get_isInline(), ret->get_isNoreturn() );
     891                } else if ( objDecl->get_isInline() || objDecl->get_isNoreturn() ) {
     892                        throw SemanticError( "invalid inline or _Noreturn specification in declaration of ", objDecl );
     893                } // if
    889894                typedefNames = oldNames;
    890895                return ret;
     
    950955        }
    951956
    952                 Declaration *EliminateTypedef::mutate( ContextDecl * contextDecl ) {
     957        Declaration *EliminateTypedef::mutate( ContextDecl * contextDecl ) {
    953958                Mutator::mutate( contextDecl );
    954959                return handleAggregate( contextDecl );
Note: See TracChangeset for help on using the changeset viewer.