Changeset c0aa336 for src/SynTree


Ignore:
Timestamp:
Feb 6, 2017, 4:19:41 PM (9 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
b4d65c7
Parents:
a362f97
Message:

third attempt at gcc attributes

Location:
src/SynTree
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/AggregateDecl.cc

    ra362f97 rc0aa336  
    1010// Created On       : Sun May 17 23:56:39 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jul 13 18:03:30 2016
    13 // Update Count     : 10
     12// Last Modified On : Mon Feb  6 15:31:23 2017
     13// Update Count     : 17
    1414//
    1515
    1616#include "Declaration.h"
     17#include "Attribute.h"
    1718#include "Type.h"
    1819#include "Common/utility.h"
    1920
    2021
    21 AggregateDecl::AggregateDecl( const std::string &name ) : Parent( name, DeclarationNode::NoStorageClass, LinkageSpec::Cforall ), body( false ) {
     22AggregateDecl::AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes ) : Parent( name, DeclarationNode::NoStorageClass, LinkageSpec::Cforall ), body( false ), attributes( attributes ) {
    2223}
    2324
     
    2526        cloneAll( other.members, members );
    2627        cloneAll( other.parameters, parameters );
     28        cloneAll( other.attributes, attributes );
    2729        body = other.body;
    2830}
    2931
    3032AggregateDecl::~AggregateDecl() {
     33        deleteAll( attributes );
     34        deleteAll( parameters );
    3135        deleteAll( members );
    32         deleteAll( parameters );
    3336}
    3437
     
    4750                os << endl << string( indent+2, ' ' ) << "with members" << endl;
    4851                printAll( members, os, indent+4 );
     52        } // if
     53        if ( ! attributes.empty() ) {
     54                os << endl << string( indent+2, ' ' ) << "with attributes" << endl;
     55                printAll( attributes, os, indent+4 );
    4956        } // if
    5057}
  • src/SynTree/ArrayType.cc

    ra362f97 rc0aa336  
    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 : Thu May 12 14:07:16 2016
    13 // Update Count     : 11
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Wed Feb  1 17:16:29 2017
     13// Update Count     : 12
    1414//
    1515
     
    1919
    2020
    21 ArrayType::ArrayType( const Type::Qualifiers &tq, Type *base, Expression *dimension, bool isVarLen, bool isStatic )
    22                 : Type( tq ), base( base ), dimension( dimension ), isVarLen( isVarLen ), isStatic( isStatic ) {
     21ArrayType::ArrayType( const Type::Qualifiers &tq, Type *base, Expression *dimension, bool isVarLen, bool isStatic, const std::list< Attribute * > & attributes )
     22        : Type( tq, attributes ), base( base ), dimension( dimension ), isVarLen( isVarLen ), isStatic( isStatic ) {
    2323        base->set_isLvalue( false );
    2424}
  • src/SynTree/AttrType.cc

    ra362f97 rc0aa336  
    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:41:51 2015
    13 // Update Count     : 2
     12// Last Modified On : Wed Feb  1 17:17:59 2017
     13// Update Count     : 3
    1414//
    1515
     
    1919
    2020
    21 AttrType::AttrType( const Type::Qualifiers &tq, const std::string &name, Expression *expr )
    22         : Type( tq ), name( name ), expr( expr ), type( 0 ), isType( false ) {
     21AttrType::AttrType( const Type::Qualifiers &tq, const std::string &name, Expression *expr, const std::list< Attribute * > & attributes )
     22        : Type( tq, attributes ), name( name ), expr( expr ), type( 0 ), isType( false ) {
    2323}
    2424
    25 AttrType::AttrType( const Type::Qualifiers &tq, const std::string &name, Type *type )
    26         : Type( tq ), name( name ), expr( 0 ), type( type ), isType( true ) {
     25AttrType::AttrType( const Type::Qualifiers &tq, const std::string &name, Type *type, const std::list< Attribute * > & attributes )
     26        : Type( tq, attributes ), name( name ), expr( 0 ), type( type ), isType( true ) {
    2727}
    2828
  • src/SynTree/BasicType.cc

    ra362f97 rc0aa336  
    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 : Wed Aug 12 14:15:45 2015
    13 // Update Count     : 6
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Wed Feb  1 17:12:15 2017
     13// Update Count     : 8
    1414//
    1515
     
    1717#include "Type.h"
    1818
    19 BasicType::BasicType( const Type::Qualifiers &tq, Kind bt ) : Type( tq ), kind( bt ) {}
     19BasicType::BasicType( const Type::Qualifiers &tq, Kind bt, const std::list< Attribute * > & attributes ) : Type( tq, attributes ), kind( bt ) {}
    2020
    2121void BasicType::print( std::ostream &os, int indent ) const {
  • src/SynTree/Declaration.h

    ra362f97 rc0aa336  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Dec 13 13:37:33 2016
    13 // Update Count     : 49
     12// Last Modified On : Fri Jan 20 15:07:29 2017
     13// Update Count     : 53
    1414//
    1515
     
    225225        typedef Declaration Parent;
    226226  public:
    227         AggregateDecl( const std::string &name );
     227        AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >() );
    228228        AggregateDecl( const AggregateDecl &other );
    229229        virtual ~AggregateDecl();
     
    231231        std::list<Declaration*>& get_members() { return members; }
    232232        std::list<TypeDecl*>& get_parameters() { return parameters; }
     233
     234        std::list< Attribute * >& get_attributes() { return attributes; }
     235        const std::list< Attribute * >& get_attributes() const { return attributes; }
    233236
    234237        bool has_body() const { return body; }
     
    244247        std::list<TypeDecl*> parameters;
    245248        bool body;
     249        std::list< Attribute * > attributes;
    246250};
    247251
     
    249253        typedef AggregateDecl Parent;
    250254  public:
    251         StructDecl( const std::string &name ) : Parent( name ) {}
     255        StructDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >() ) : Parent( name, attributes ) {}
    252256        StructDecl( const StructDecl &other ) : Parent( other ) {}
    253257
     
    262266        typedef AggregateDecl Parent;
    263267  public:
    264         UnionDecl( const std::string &name ) : Parent( name ) {}
     268        UnionDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >() ) : Parent( name, attributes ) {}
    265269        UnionDecl( const UnionDecl &other ) : Parent( other ) {}
    266270
     
    275279        typedef AggregateDecl Parent;
    276280  public:
    277         EnumDecl( const std::string &name ) : Parent( name ) {}
     281        EnumDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >() ) : Parent( name, attributes ) {}
    278282        EnumDecl( const EnumDecl &other ) : Parent( other ) {}
    279283
     
    288292        typedef AggregateDecl Parent;
    289293  public:
    290         TraitDecl( const std::string &name ) : Parent( name ) {}
     294        TraitDecl( const std::string &name, const std::list< Attribute * > & attributes ) : Parent( name ) {
     295                assertf( attributes.empty(), "attribute unsupported for traits" );
     296        }
    291297        TraitDecl( const TraitDecl &other ) : Parent( other ) {}
    292298
  • src/SynTree/FunctionType.cc

    ra362f97 rc0aa336  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon May 18 09:01:28 2015
    13 // Update Count     : 1
     12// Last Modified On : Wed Feb  1 17:21:00 2017
     13// Update Count     : 2
    1414//
    1515
     
    2121#include "Tuples/Tuples.h"
    2222
    23 FunctionType::FunctionType( const Type::Qualifiers &tq, bool isVarArgs ) : Type( tq ), isVarArgs( isVarArgs ) {
     23FunctionType::FunctionType( const Type::Qualifiers &tq, bool isVarArgs, const std::list< Attribute * > & attributes ) : Type( tq, attributes ), isVarArgs( isVarArgs ) {
    2424}
    2525
  • src/SynTree/PointerType.cc

    ra362f97 rc0aa336  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Dec 15 15:39:10 2015
    13 // Update Count     : 5
     12// Last Modified On : Wed Feb  1 17:17:13 2017
     13// Update Count     : 6
    1414//
    1515
     
    1818#include "Common/utility.h"
    1919
    20 PointerType::PointerType( const Type::Qualifiers &tq, Type *base )
    21         : Type( tq ), base( base ), dimension( 0 ), isVarLen( false ), isStatic( false ) {
     20PointerType::PointerType( const Type::Qualifiers &tq, Type *base, const std::list< Attribute * > & attributes )
     21        : Type( tq, attributes ), base( base ), dimension( 0 ), isVarLen( false ), isStatic( false ) {
    2222}
    2323
    24 PointerType::PointerType( const Type::Qualifiers &tq, Type *base, Expression *dimension, bool isVarLen, bool isStatic )
    25         : Type( tq ), base( base ), dimension( dimension ), isVarLen( isVarLen ), isStatic( isStatic ) {
     24PointerType::PointerType( const Type::Qualifiers &tq, Type *base, Expression *dimension, bool isVarLen, bool isStatic, const std::list< Attribute * > & attributes )
     25        : Type( tq, attributes ), base( base ), dimension( dimension ), isVarLen( isVarLen ), isStatic( isStatic ) {
    2626}
    2727
  • src/SynTree/ReferenceToType.cc

    ra362f97 rc0aa336  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jul 13 18:03:30 2016
    13 // Update Count     : 9
     12// Last Modified On : Thu Feb  2 17:45:07 2017
     13// Update Count     : 23
    1414//
    1515
     
    2323#include "Common/utility.h"
    2424
    25 ReferenceToType::ReferenceToType( const Type::Qualifiers &tq, const std::string &name ) : Type( tq ), name( name ) {
     25ReferenceToType::ReferenceToType( const Type::Qualifiers &tq, const std::string &name, const std::list< Attribute * > & attributes ) : Type( tq, attributes ), name( name ) {
    2626}
    2727
     
    5555} // namespace
    5656
    57 StructInstType::StructInstType( const Type::Qualifiers & tq, StructDecl * baseStruct ) : Parent( tq, baseStruct->get_name() ), baseStruct( baseStruct ) {}
     57StructInstType::StructInstType( const Type::Qualifiers & tq, StructDecl * baseStruct, const std::list< Attribute * > & attributes ) :
     58                Parent( tq, baseStruct->get_name(), attributes ), baseStruct( baseStruct ) {}
    5859
    5960std::string StructInstType::typeString() const { return "struct"; }
     
    6465}
    6566
    66 bool StructInstType::isComplete() const { return baseStruct->has_body(); }
     67bool StructInstType::isComplete() const { return baseStruct ? baseStruct->has_body() : false; }
    6768
    6869void StructInstType::lookup( const std::string &name, std::list< Declaration* > &foundDecls ) const {
     
    8586}
    8687
     88
     89UnionInstType::UnionInstType( const Type::Qualifiers & tq, UnionDecl * baseUnion, const std::list< Attribute * > & attributes ) :
     90                Parent( tq, baseUnion->get_name(), attributes ), baseUnion( baseUnion ) {}
     91
    8792std::string UnionInstType::typeString() const { return "union"; }
    8893
    89 std::list<TypeDecl*>* UnionInstType::get_baseParameters() {
     94std::list< TypeDecl * > * UnionInstType::get_baseParameters() {
    9095        if ( ! baseUnion ) return NULL;
    9196        return &baseUnion->get_parameters();
    9297}
    9398
    94 bool UnionInstType::isComplete() const { return baseUnion->has_body(); }
     99bool UnionInstType::isComplete() const { return baseUnion ? baseUnion->has_body() : false; }
    95100
    96101void UnionInstType::lookup( const std::string &name, std::list< Declaration* > &foundDecls ) const {
     
    113118}
    114119
     120
     121EnumInstType::EnumInstType( const Type::Qualifiers & tq, EnumDecl * baseEnum, const std::list< Attribute * > & attributes ) :
     122                Parent( tq, baseEnum->get_name(), attributes ), baseEnum( baseEnum ) {}
     123
    115124std::string EnumInstType::typeString() const { return "enum"; }
     125
     126bool EnumInstType::isComplete() const { return baseEnum ? baseEnum->has_body() : false; }
    116127
    117128std::string TraitInstType::typeString() const { return "trait"; }
     
    127138bool TraitInstType::isComplete() const { assert( false ); }
    128139
    129 TypeInstType::TypeInstType( const Type::Qualifiers &tq, const std::string &name, TypeDecl *baseType ) : Parent( tq, name ) {
     140TypeInstType::TypeInstType( const Type::Qualifiers &tq, const std::string &name, TypeDecl *baseType, const std::list< Attribute * > & attributes ) : Parent( tq, name, attributes ) {
    130141        set_baseType( baseType );
    131142}
    132143
    133 TypeInstType::TypeInstType( const Type::Qualifiers &tq, const std::string &name, bool isFtype ) : Parent( tq, name ), baseType( 0 ), isFtype( isFtype ) {
     144TypeInstType::TypeInstType( const Type::Qualifiers &tq, const std::string &name, bool isFtype, const std::list< Attribute * > & attributes ) : Parent( tq, name, attributes ), baseType( 0 ), isFtype( isFtype ) {
    134145}
    135146
  • src/SynTree/TupleType.cc

    ra362f97 rc0aa336  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon May 18 11:00:01 2015
    13 // Update Count     : 2
     12// Last Modified On : Wed Feb  1 17:10:58 2017
     13// Update Count     : 3
    1414//
    1515
     
    1717#include "Common/utility.h"
    1818
    19 TupleType::TupleType( const Type::Qualifiers &tq, const std::list< Type * > & types ) : Type( tq ), types( types ) {
     19TupleType::TupleType( const Type::Qualifiers &tq, const std::list< Type * > & types, const std::list< Attribute * > & attributes ) : Type( tq, attributes ), types( types ) {
    2020}
    2121
  • src/SynTree/Type.cc

    ra362f97 rc0aa336  
    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 : Wed Dec 09 14:08:48 2015
    13 // Update Count     : 4
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Thu Feb  2 11:26:24 2017
     13// Update Count     : 12
    1414//
    1515
     
    1818#include "Type.h"
    1919#include "Declaration.h"
     20#include "Attribute.h"
    2021#include "Common/utility.h"
     22
     23using namespace std;
    2124
    2225const char *BasicType::typeNames[BasicType::NUMBER_OF_BASIC_TYPES] = {
     
    4447};
    4548
    46 Type::Type( const Qualifiers &tq ) : tq( tq ) {}
     49Type::Type( const Qualifiers &tq, const std::list< Attribute * > & attributes ) : tq( tq ), attributes( attributes ) {}
    4750
    4851Type::Type( const Type &other ) : tq( other.tq ) {
    4952        cloneAll( other.forall, forall );
     53        cloneAll( other.attributes, attributes );
    5054}
    5155
    5256Type::~Type() {
    5357        deleteAll( forall );
     58        deleteAll( attributes );
    5459}
    5560
     
    7075                os << "_Atomic ";
    7176        } // if
    72         if ( isAttribute ) {
    73                 os << "__attribute(( )) ";
    74         } // if
    7577}
    7678
     
    8183                os << std::string( indent+2, ' ' );
    8284        } // if
     85
     86        if ( ! attributes.empty() ) {
     87                os << endl << string( indent+2, ' ' ) << "with attributes" << endl;
     88                printAll( attributes, os, indent+4 );
     89        } // if
     90       
    8391        tq.print( os, indent );
    8492}
     
    8997        } else {
    9098                out << "nullptr";
    91         }
     99        } // if
    92100        return out;
    93101}
  • src/SynTree/Type.h

    ra362f97 rc0aa336  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jul 13 11:46:54 2016
    13 // Update Count     : 23
     12// Last Modified On : Thu Feb  2 17:43:01 2017
     13// Update Count     : 33
    1414//
    1515
     
    2525  public:
    2626        struct Qualifiers {
    27                 Qualifiers(): isConst( false ), isVolatile( false ), isRestrict( false ), isLvalue( false ), isAtomic( false ), isAttribute( false ) {}
    28                 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(): isConst( false ), isVolatile( false ), isRestrict( false ), isLvalue( false ), isAtomic( false ) {}
     28                Qualifiers( bool isConst, bool isVolatile, bool isRestrict, bool isLvalue, bool isAtomic ): isConst( isConst ), isVolatile( isVolatile ), isRestrict( isRestrict ), isLvalue( isLvalue ), isAtomic( isAtomic ) {}
    2929
    3030                Qualifiers &operator&=( const Qualifiers &other );
     
    4545                bool isLvalue;
    4646                bool isAtomic;
    47                 bool isAttribute;
    4847        };
    4948
    50         Type( const Qualifiers &tq );
     49        Type( const Qualifiers &tq, const std::list< Attribute * > & attributes );
    5150        Type( const Type &other );
    5251        virtual ~Type();
     
    5857        bool get_isLvalue() { return tq.isLvalue; }
    5958        bool get_isAtomic() { return tq.isAtomic; }
    60         bool get_isAttribute() { return tq.isAttribute; }
    6159        void set_isConst( bool newValue ) { tq.isConst = newValue; }
    6260        void set_isVolatile( bool newValue ) { tq.isVolatile = newValue; }
     
    6462        void set_isLvalue( bool newValue ) { tq.isLvalue = newValue; }
    6563        void set_isAtomic( bool newValue ) { tq.isAtomic = newValue; }
    66         void set_isAttribute( bool newValue ) { tq.isAttribute = newValue; }
    6764
    6865        typedef std::list<TypeDecl *> ForallList;
    6966        ForallList& get_forall() { return forall; }
     67
     68        std::list< Attribute * >& get_attributes() { return attributes; }
     69        const std::list< Attribute * >& get_attributes() const { return attributes; }
    7070
    7171        /// How many elemental types are represented by this type
     
    8383        Qualifiers tq;
    8484        ForallList forall;
     85        std::list< Attribute * > attributes;
    8586};
    8687
     
    8990class VoidType : public Type {
    9091  public:
    91         VoidType( const Type::Qualifiers &tq );
     92        VoidType( const Type::Qualifiers &tq, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
    9293
    9394        virtual unsigned size() const { return 0; };
     
    129130        static const char *typeNames[];                                         // string names for basic types, MUST MATCH with Kind
    130131
    131         BasicType( const Type::Qualifiers &tq, Kind bt );
     132        BasicType( const Type::Qualifiers &tq, Kind bt, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
    132133
    133134        Kind get_kind() { return kind; }
     
    146147class PointerType : public Type {
    147148  public:
    148         PointerType( const Type::Qualifiers &tq, Type *base );
    149         PointerType( const Type::Qualifiers &tq, Type *base, Expression *dimension, bool isVarLen, bool isStatic );
     149        PointerType( const Type::Qualifiers &tq, Type *base, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
     150        PointerType( const Type::Qualifiers &tq, Type *base, Expression *dimension, bool isVarLen, bool isStatic, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
    150151        PointerType( const PointerType& );
    151152        virtual ~PointerType();
     
    175176class ArrayType : public Type {
    176177  public:
    177         ArrayType( const Type::Qualifiers &tq, Type *base, Expression *dimension, bool isVarLen, bool isStatic );
     178        ArrayType( const Type::Qualifiers &tq, Type *base, Expression *dimension, bool isVarLen, bool isStatic, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
    178179        ArrayType( const ArrayType& );
    179180        virtual ~ArrayType();
     
    203204class FunctionType : public Type {
    204205  public:
    205         FunctionType( const Type::Qualifiers &tq, bool isVarArgs );
     206        FunctionType( const Type::Qualifiers &tq, bool isVarArgs, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
    206207        FunctionType( const FunctionType& );
    207208        virtual ~FunctionType();
     
    231232class ReferenceToType : public Type {
    232233  public:
    233         ReferenceToType( const Type::Qualifiers &tq, const std::string &name );
     234        ReferenceToType( const Type::Qualifiers &tq, const std::string &name, const std::list< Attribute * > & attributes );
    234235        ReferenceToType( const ReferenceToType &other );
    235236        virtual ~ReferenceToType();
     
    253254        typedef ReferenceToType Parent;
    254255  public:
    255         StructInstType( const Type::Qualifiers &tq, const std::string &name ) : Parent( tq, name ), baseStruct( 0 ) {}
    256         StructInstType( const Type::Qualifiers &tq, StructDecl * baseStruct );
     256        StructInstType( const Type::Qualifiers &tq, const std::string &name, const std::list< Attribute * > & attributes = std::list< Attribute * >()  ) : Parent( tq, name, attributes ), baseStruct( 0 ) {}
     257        StructInstType( const Type::Qualifiers &tq, StructDecl * baseStruct, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
    257258        StructInstType( const StructInstType &other ) : Parent( other ), baseStruct( other.baseStruct ) {}
    258259
     
    285286        typedef ReferenceToType Parent;
    286287  public:
    287         UnionInstType( const Type::Qualifiers &tq, const std::string &name ) : Parent( tq, name ), baseUnion( 0 ) {}
     288        UnionInstType( const Type::Qualifiers &tq, const std::string &name, const std::list< Attribute * > & attributes = std::list< Attribute * >()  ) : Parent( tq, name, attributes ), baseUnion( 0 ) {}
     289        UnionInstType( const Type::Qualifiers &tq, UnionDecl * baseUnion, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
    288290        UnionInstType( const UnionInstType &other ) : Parent( other ), baseUnion( other.baseUnion ) {}
    289291
    290292        UnionDecl *get_baseUnion() const { return baseUnion; }
    291         void set_baseUnion( UnionDecl *newValue ) { baseUnion = newValue; }
     293        void set_baseUnion( UnionDecl * newValue ) { baseUnion = newValue; }
    292294
    293295        /// Accesses generic parameters of base union (NULL if none such)
    294         std::list<TypeDecl*> * get_baseParameters();
     296        std::list< TypeDecl * > * get_baseParameters();
    295297
    296298        virtual bool isComplete() const;
     
    316318        typedef ReferenceToType Parent;
    317319  public:
    318         EnumInstType( const Type::Qualifiers &tq, const std::string &name ) : Parent( tq, name ) {}
    319         EnumInstType( const EnumInstType &other ) : Parent( other ) {}
    320 
    321         // xxx - enum inst does not currently contain a pointer to base, this should be fixed.
    322         // virtual bool isComplete() const { return baseEnum()->hasBody(); }
     320        EnumInstType( const Type::Qualifiers &tq, const std::string &name, const std::list< Attribute * > & attributes = std::list< Attribute * >()  ) : Parent( tq, name, attributes ) {}
     321        EnumInstType( const Type::Qualifiers &tq, EnumDecl * baseEnum, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
     322        EnumInstType( const EnumInstType &other ) : Parent( other ), baseEnum( other.baseEnum ) {}
     323
     324        EnumDecl *get_baseEnum() const { return baseEnum; }
     325        void set_baseEnum( EnumDecl *newValue ) { baseEnum = newValue; }
     326
     327        virtual bool isComplete() const;
    323328
    324329        virtual EnumInstType *clone() const { return new EnumInstType( *this ); }
     
    327332  private:
    328333        virtual std::string typeString() const;
     334
     335        // this decl is not "owned" by the union inst; it is merely a pointer to elsewhere in the tree,
     336        // where the union used in this type is actually defined
     337        EnumDecl *baseEnum = nullptr;
    329338};
    330339
     
    332341        typedef ReferenceToType Parent;
    333342  public:
    334         TraitInstType( const Type::Qualifiers &tq, const std::string &name ) : Parent( tq, name ) {}
     343        TraitInstType( const Type::Qualifiers &tq, const std::string &name, const std::list< Attribute * > & attributes = std::list< Attribute * >()  ) : Parent( tq, name, attributes ) {}
    335344        TraitInstType( const TraitInstType &other );
    336345        ~TraitInstType();
     
    354363        typedef ReferenceToType Parent;
    355364  public:
    356         TypeInstType( const Type::Qualifiers &tq, const std::string &name, TypeDecl *baseType );
    357         TypeInstType( const Type::Qualifiers &tq, const std::string &name, bool isFtype );
     365        TypeInstType( const Type::Qualifiers &tq, const std::string &name, TypeDecl *baseType, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
     366        TypeInstType( const Type::Qualifiers &tq, const std::string &name, bool isFtype, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
    358367        TypeInstType( const TypeInstType &other );
    359368        ~TypeInstType();
     
    380389class TupleType : public Type {
    381390  public:
    382         TupleType( const Type::Qualifiers &tq, const std::list< Type * > & types = std::list< Type * >() );
     391        TupleType( const Type::Qualifiers &tq, const std::list< Type * > & types = std::list< Type * >(), const std::list< Attribute * > & attributes = std::list< Attribute * >() );
    383392        TupleType( const TupleType& );
    384393        virtual ~TupleType();
     
    410419class TypeofType : public Type {
    411420  public:
    412         TypeofType( const Type::Qualifiers &tq, Expression *expr );
     421        TypeofType( const Type::Qualifiers &tq, Expression *expr, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
    413422        TypeofType( const TypeofType& );
    414423        virtual ~TypeofType();
     
    429438class AttrType : public Type {
    430439  public:
    431         AttrType( const Type::Qualifiers &tq, const std::string &name, Expression *expr );
    432         AttrType( const Type::Qualifiers &tq, const std::string &name, Type *type );
     440        AttrType( const Type::Qualifiers &tq, const std::string &name, Expression *expr, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
     441        AttrType( const Type::Qualifiers &tq, const std::string &name, Type *type, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
    433442        AttrType( const AttrType& );
    434443        virtual ~AttrType();
     
    460469  public:
    461470        VarArgsType();
    462         VarArgsType( Type::Qualifiers tq );
     471        VarArgsType( Type::Qualifiers tq, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
    463472
    464473        virtual bool isComplete() const{ return true; } // xxx - is this right?
     
    474483  public:
    475484        ZeroType();
    476         ZeroType( Type::Qualifiers tq );
     485        ZeroType( Type::Qualifiers tq, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
    477486
    478487        virtual ZeroType *clone() const { return new ZeroType( *this ); }
     
    486495  public:
    487496        OneType();
    488         OneType( Type::Qualifiers tq );
     497        OneType( Type::Qualifiers tq, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
    489498
    490499        virtual OneType *clone() const { return new OneType( *this ); }
  • src/SynTree/TypeofType.cc

    ra362f97 rc0aa336  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon May 18 11:13:29 2015
    13 // Update Count     : 2
     12// Last Modified On : Wed Feb  1 17:18:29 2017
     13// Update Count     : 3
    1414//
    1515
     
    1818#include "Common/utility.h"
    1919
    20 TypeofType::TypeofType( const Type::Qualifiers &tq, Expression *expr ) : Type( tq ), expr( expr ) {
     20TypeofType::TypeofType( const Type::Qualifiers &tq, Expression *expr, const std::list< Attribute * > & attributes ) : Type( tq, attributes ), expr( expr ) {
    2121}
    2222
  • src/SynTree/VarArgsType.cc

    ra362f97 rc0aa336  
    1010// Created On       : Thu Feb 25 16:34:00 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Mar  2 17:10:40 2016
    13 // Update Count     : 2
     12// Last Modified On : Wed Feb  1 17:14:48 2017
     13// Update Count     : 4
    1414//
    1515
    1616#include "Type.h"
    1717
    18 VarArgsType::VarArgsType() : Type( Type::Qualifiers() ) {}
     18VarArgsType::VarArgsType() : Type( Type::Qualifiers(), std::list< Attribute * >() ) {}
    1919
    20 VarArgsType::VarArgsType( Type::Qualifiers tq ) : Type( tq ) {}
     20VarArgsType::VarArgsType( Type::Qualifiers tq, const std::list< Attribute * > & attributes ) : Type( tq, attributes ) {}
    2121
    2222void VarArgsType::print( std::ostream &os, int indent ) const {
  • src/SynTree/VoidType.cc

    ra362f97 rc0aa336  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon May 18 11:16:42 2015
    13 // Update Count     : 1
     12// Last Modified On : Wed Feb  1 17:09:26 2017
     13// Update Count     : 3
    1414//
    1515
    1616#include "Type.h"
    1717
    18 VoidType::VoidType( const Type::Qualifiers &tq ) : Type( tq ) {
     18VoidType::VoidType( const Type::Qualifiers &tq, const std::list< Attribute * > & attributes ) : Type( tq, attributes ) {
    1919}
    2020
  • src/SynTree/ZeroOneType.cc

    ra362f97 rc0aa336  
    99// Author           : Aaron B. Moss
    1010// Created On       : Fri Sep 16 14:08:00 2016
    11 // Last Modified By : Aaron B. Moss
    12 // Last Modified On : Fri Sep 16 14:08:00 2016
    13 // Update Count     : 1
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Wed Feb  1 17:15:46 2017
     13// Update Count     : 4
    1414//
    1515
    1616#include "Type.h"
    1717
    18 ZeroType::ZeroType() : Type( Type::Qualifiers() ) {}
     18ZeroType::ZeroType() : Type( Type::Qualifiers(), std::list< Attribute * >() ) {}
    1919
    20 ZeroType::ZeroType( Type::Qualifiers tq ) : Type( tq ) {}
     20ZeroType::ZeroType( Type::Qualifiers tq, const std::list< Attribute * > & attributes ) : Type( tq, attributes ) {}
    2121
    2222void ZeroType::print( std::ostream &os, int indent ) const {
     
    2424}
    2525
    26 OneType::OneType() : Type( Type::Qualifiers() ) {}
     26OneType::OneType() : Type( Type::Qualifiers(), std::list< Attribute * >() ) {}
    2727
    28 OneType::OneType( Type::Qualifiers tq ) : Type( tq ) {}
     28OneType::OneType( Type::Qualifiers tq, const std::list< Attribute * > & attributes ) : Type( tq, attributes ) {}
    2929
    3030void OneType::print( std::ostream &os, int indent ) const {
Note: See TracChangeset for help on using the changeset viewer.