Changeset 1db21619 for src/SynTree


Ignore:
Timestamp:
Jul 16, 2015, 5:28:24 PM (10 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

Location:
src/SynTree
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Declaration.cc

    r724c2b6 r1db21619  
    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

    r724c2b6 r1db21619  
    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

    r724c2b6 r1db21619  
    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

    r724c2b6 r1db21619  
    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 : Tue Jul 14 12:31:39 2015
    13 // Update Count     : 2
     11// Last Modified By : Peter A. Buhr
     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 ) );
  • src/SynTree/Mutator.h

    r724c2b6 r1db21619  
    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

    r724c2b6 r1db21619  
    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/Type.cc

    r724c2b6 r1db21619  
    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

    r724c2b6 r1db21619  
    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 );
Note: See TracChangeset for help on using the changeset viewer.