Changeset b29f8f3 for src/SynTree


Ignore:
Timestamp:
Jul 29, 2015, 12:07:38 PM (10 years ago)
Author:
Aaron Moss <a3moss@…>
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:
093f1a0
Parents:
1e8f143 (diff), 51b986f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge from origin

Location:
src/SynTree
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Declaration.cc

    r1e8f143 rb29f8f3  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jun 13 08:07:20 2015
    13 // Update Count     : 9
     12// Last Modified On : Mon Jul 13 17:58:38 2015
     13// Update Count     : 10
    1414//
    1515
     
    2727
    2828Declaration::Declaration( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage )
    29                 : name( name ), storageClass( sc ), linkage( linkage ), uniqueId( 0 ) {
     29                : name( name ), storageClass( sc ), linkage( linkage ), isInline( false ), isNoreturn( false ), uniqueId( 0 ) {
    3030}
    3131
    3232Declaration::Declaration( const Declaration &other )
    33                 : name( other.name ), storageClass( other.storageClass ), linkage( other.linkage ), uniqueId( other.uniqueId ) {
     33        : name( other.name ), storageClass( other.storageClass ), linkage( other.linkage ), isInline( other.isInline ), isNoreturn( other.isNoreturn ), uniqueId( other.uniqueId ) {
    3434}
    3535
  • src/SynTree/Declaration.h

    r1e8f143 rb29f8f3  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jun 13 09:10:31 2015
    13 // Update Count     : 25
     12// Last Modified On : Mon Jul 13 18:15:59 2015
     13// Update Count     : 28
    1414//
    1515
     
    3535        LinkageSpec::Type get_linkage() const { return linkage; }
    3636        void set_linkage( LinkageSpec::Type newValue ) { linkage = newValue; }
     37        bool get_isInline() const { return isInline; }
     38        void set_isInline( bool newValue ) { isInline = newValue; }
     39        bool get_isNoreturn() const { return isNoreturn; }
     40        void set_isNoreturn( bool newValue ) { isNoreturn = newValue; }
    3741        UniqueId get_uniqueId() const { return uniqueId; }
    3842
     
    5054        DeclarationNode::StorageClass storageClass;
    5155        LinkageSpec::Type linkage;
     56        bool isInline, isNoreturn;
    5257        UniqueId uniqueId;
    5358};
     
    7580        typedef DeclarationWithType Parent;
    7681  public:
    77         ObjectDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, Expression *bitfieldWidth, Type *type, Initializer *init );
     82        ObjectDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, Expression *bitfieldWidth, Type *type, Initializer *init, bool isInline = false, bool isNoreturn = false );
    7883        ObjectDecl( const ObjectDecl &other );
    7984        virtual ~ObjectDecl();
     
    8994        virtual ObjectDecl *clone() const { return new ObjectDecl( *this ); }
    9095        virtual void accept( Visitor &v ) { v.visit( this ); }
    91         virtual ObjectDecl *acceptMutator( Mutator &m ) { return m.mutate( this ); }
     96        virtual DeclarationWithType *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    9297        virtual void print( std::ostream &os, int indent = 0 ) const;
    9398        virtual void printShort( std::ostream &os, int indent = 0 ) const;
     
    112117        CompoundStmt *get_statements() const { return statements; }
    113118        void set_statements( CompoundStmt *newValue ) { statements = newValue; }
    114         bool get_isInline() const { return isInline; }
    115         bool get_isNoreturn() const { return isNoreturn; }
    116119        std::list< std::string >& get_oldIdents() { return oldIdents; }
    117120        std::list< Declaration* >& get_oldDecls() { return oldDecls; }
     
    125128        FunctionType *type;
    126129        CompoundStmt *statements;
    127         bool isInline, isNoreturn;
    128130        std::list< std::string > oldIdents;
    129131        std::list< Declaration* > oldDecls;
  • src/SynTree/FunctionDecl.cc

    r1e8f143 rb29f8f3  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jun 13 09:10:32 2015
    13 // Update Count     : 16
     12// Last Modified On : Mon Jul 13 18:11:44 2015
     13// Update Count     : 19
    1414//
    1515
     
    2222
    2323FunctionDecl::FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, FunctionType *type, CompoundStmt *statements, bool isInline, bool isNoreturn )
    24                 : Parent( name, sc, linkage ), type( type ), statements( statements ), isInline( isInline ), isNoreturn( isNoreturn ) {
     24                : Parent( name, sc, linkage ), type( type ), statements( statements ) {
     25        set_isInline( isInline );
     26        set_isNoreturn( isNoreturn );
    2527        // this is a brazen hack to force the function "main" to have C linkage
    2628        if ( name == "main" ) {
     
    3032
    3133FunctionDecl::FunctionDecl( const FunctionDecl &other )
    32         : Parent( other ), type( maybeClone( other.type ) ), statements( maybeClone( other.statements ) ), isInline( other.isInline ), isNoreturn( other.isNoreturn ) {
     34        : Parent( other ), type( maybeClone( other.type ) ), statements( maybeClone( other.statements ) ) {
    3335}
    3436
     
    5759                os << LinkageSpec::toString( get_linkage() ) << " ";
    5860        } // if
    59         if ( isInline ) {
     61        if ( get_isInline() ) {
    6062                os << "inline ";
    6163        } // if
    62         if ( isNoreturn ) {
     64        if ( get_isNoreturn() ) {
    6365                os << "_Noreturn ";
    6466        } // if
     
    9698                os << get_name() << ": ";
    9799        } // if
    98         if ( isInline ) {
     100        if ( get_isInline() ) {
    99101                os << "inline ";
    100102        } // if
    101         if ( isNoreturn ) {
     103        if ( get_isNoreturn() ) {
    102104                os << "_Noreturn ";
    103105        } // if
  • src/SynTree/Mutator.cc

    r1e8f143 rb29f8f3  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon May 18 10:10:46 2015
    13 // Update Count     : 1
     12// Last Modified On : Thu Jul 16 16:10:54 2015
     13// Update Count     : 3
    1414//
    1515
     
    2828Mutator::~Mutator() {}
    2929
    30 ObjectDecl *Mutator::mutate( ObjectDecl *objectDecl ) {
     30DeclarationWithType *Mutator::mutate( ObjectDecl *objectDecl ) {
    3131        objectDecl->set_type( maybeMutate( objectDecl->get_type(), *this ) );
    3232        objectDecl->set_init( maybeMutate( objectDecl->get_init(), *this ) );
     
    109109
    110110Statement *Mutator::mutate( ForStmt *forStmt ) {
    111         forStmt->set_initialization( maybeMutate( forStmt->get_initialization(), *this ) );
     111        mutateAll( forStmt->get_initialization(), *this );
    112112        forStmt->set_condition( maybeMutate( forStmt->get_condition(), *this ) );
    113113        forStmt->set_increment( maybeMutate( forStmt->get_increment(), *this ) );
  • src/SynTree/Mutator.h

    r1e8f143 rb29f8f3  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Rob Schluntz
    12 // Last Modified On : Fri May 29 16:34:08 2015
    13 // Update Count     : 4
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Mon Jul 13 18:14:47 2015
     13// Update Count     : 5
    1414//
    1515#include <cassert>
     
    2626        virtual ~Mutator();
    2727  public:
    28         virtual ObjectDecl* mutate( ObjectDecl *objectDecl );
     28        virtual DeclarationWithType* mutate( ObjectDecl *objectDecl );
    2929        virtual DeclarationWithType* mutate( FunctionDecl *functionDecl );
    3030        virtual Declaration* mutate( StructDecl *aggregateDecl );
  • src/SynTree/ObjectDecl.cc

    r1e8f143 rb29f8f3  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jun 13 08:10:16 2015
    13 // Update Count     : 15
     12// Last Modified On : Mon Jul 13 18:08:27 2015
     13// Update Count     : 16
    1414//
    1515
     
    2020#include "utility.h"
    2121
    22 ObjectDecl::ObjectDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, Expression *bitfieldWidth, Type *type, Initializer *init )
     22ObjectDecl::ObjectDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, Expression *bitfieldWidth, Type *type, Initializer *init, bool isInline, bool isNoreturn )
    2323        : Parent( name, sc, linkage ), type( type ), init( init ), bitfieldWidth( bitfieldWidth ) {
     24        set_isInline( isInline );
     25        set_isNoreturn( isNoreturn );
    2426}
    2527
  • src/SynTree/Statement.cc

    r1e8f143 rb29f8f3  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Jun 29 17:37:10 2015
    13 // Update Count     : 22
     11// Last Modified By : Rob Schluntz
     12// Last Modified On : Wed Jul 15 14:57:40 2015
     13// Update Count     : 27
    1414//
    1515
     
    192192}
    193193
    194 ForStmt::ForStmt( std::list<Label> labels, Statement *initialization_, Expression *condition_, Expression *increment_, Statement *body_ ):
     194ForStmt::ForStmt( std::list<Label> labels, std::list<Statement *> initialization_, Expression *condition_, Expression *increment_, Statement *body_ ):
    195195        Statement( labels ), initialization( initialization_ ), condition( condition_ ), increment( increment_ ), body( body_ ) {
    196196}
    197197
    198198ForStmt::~ForStmt() {
    199         delete initialization;
     199        deleteAll( initialization );
    200200        delete condition;
    201201        delete increment;
     
    213213
    214214        os << string( indent + 2, ' ' ) << "initialization: \n";
    215         if ( initialization != 0 )
    216                 initialization->print( os, indent + 4 );
     215        for ( std::list<Statement *>::const_iterator it = initialization.begin(); it != initialization.end(); ++it ) {
     216                (*it)->print( os, indent + 4 );
     217        }
    217218
    218219        os << "\n" << string( indent + 2, ' ' ) << "condition: \n";
  • src/SynTree/Statement.h

    r1e8f143 rb29f8f3  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jun 23 11:44:27 2015
    13 // Update Count     : 20
     11// Last Modified By : Rob Schluntz
     12// Last Modified On : Tue Jul 14 12:14:54 2015
     13// Update Count     : 24
    1414//
    1515
     
    199199class ForStmt : public Statement {
    200200  public:
    201         ForStmt( std::list<Label> labels, Statement *initialization = 0,
     201        ForStmt( std::list<Label> labels, std::list<Statement *> initialization,
    202202             Expression *condition = 0, Expression *increment = 0, Statement *body = 0 );
    203203        virtual ~ForStmt();
    204204
    205         Statement *get_initialization() { return initialization; }
    206         void set_initialization( Statement *newValue ) { initialization = newValue; }
     205        std::list<Statement *> &get_initialization() { return initialization; }
     206        void set_initialization( std::list<Statement *> newValue ) { initialization = newValue; }
    207207        Expression *get_condition() { return condition; }
    208208        void set_condition( Expression *newValue ) { condition = newValue; }
     
    217217        virtual void print( std::ostream &os, int indent = 0 ) const;
    218218  private:
    219         Statement *initialization;
     219        std::list<Statement *> initialization;
    220220        Expression *condition;
    221221        Expression *increment;
  • src/SynTree/Type.cc

    r1e8f143 rb29f8f3  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue May 19 16:52:27 2015
    13 // Update Count     : 2
     12// Last Modified On : Thu Jul  9 16:45:13 2015
     13// Update Count     : 3
    1414//
    1515
     
    7575                os << "_Atomic ";
    7676        } // if
     77        if ( tq.isAttribute ) {
     78                os << "__attribute(( )) ";
     79        } // if
    7780}
    7881
  • src/SynTree/Type.h

    r1e8f143 rb29f8f3  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jun 26 16:47:54 2015
    13 // Update Count     : 13
     12// Last Modified On : Thu Jul  9 16:46:15 2015
     13// Update Count     : 14
    1414//
    1515
     
    2525        struct Qualifiers { 
    2626                Qualifiers(): isConst( false ), isVolatile( false ), isRestrict( false ), isLvalue( false ), isAtomic( false ), isAttribute( false ) {}
    27                 Qualifiers( bool isConst, bool isVolatile, bool isRestrict, bool isLvalue, bool isAtomic, bool isAttribute): isConst( isConst ), isVolatile( isVolatile ), isRestrict( isRestrict ), isLvalue( isLvalue ), isAtomic( isAtomic ), isAttribute( isAttribute ) {}
     27                Qualifiers( bool isConst, bool isVolatile, bool isRestrict, bool isLvalue, bool isAtomic, bool isAttribute ): isConst( isConst ), isVolatile( isVolatile ), isRestrict( isRestrict ), isLvalue( isLvalue ), isAtomic( isAtomic ), isAttribute( isAttribute ) {}
    2828       
    2929                Qualifiers &operator+=( const Qualifiers &other );
  • src/SynTree/Visitor.cc

    r1e8f143 rb29f8f3  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon May 18 11:14:51 2015
    13 // Update Count     : 2
     11// Last Modified By : Rob Schluntz
     12// Last Modified On : Tue Jul 14 12:31:03 2015
     13// Update Count     : 3
    1414//
    1515
     
    9494
    9595void Visitor::visit( ForStmt *forStmt ) {
    96         // ForStmt still needs to be fixed
    97         maybeAccept( forStmt->get_initialization(), *this );
     96        acceptAll( forStmt->get_initialization(), *this );
    9897        maybeAccept( forStmt->get_condition(), *this );
    9998        maybeAccept( forStmt->get_increment(), *this );
Note: See TracChangeset for help on using the changeset viewer.