Changeset 1f44196 for src/SynTree/Type.h


Ignore:
Timestamp:
Nov 29, 2016, 3:30:59 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:
8e5724e
Parents:
3a2128f (diff), 9129a84 (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 branch 'master' of plg2:software/cfa/cfa-cc

Conflicts:

src/Parser/parser.cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Type.h

    r3a2128f r1f44196  
    2020#include "Visitor.h"
    2121#include "Mutator.h"
     22#include "Common/utility.h"
    2223
    2324class Type {
     
    2728                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 ) {}
    2829
     30                Qualifiers &operator&=( const Qualifiers &other );
    2931                Qualifiers &operator+=( const Qualifiers &other );
    3032                Qualifiers &operator-=( const Qualifiers &other );
     
    6365        void set_isAtomic( bool newValue ) { tq.isAtomic = newValue; }
    6466        void set_isAttribute( bool newValue ) { tq.isAttribute = newValue; }
    65         std::list<TypeDecl*>& get_forall() { return forall; }
     67
     68        typedef std::list<TypeDecl *> ForallList;
     69        ForallList& get_forall() { return forall; }
     70
     71        /// How many elemental types are represented by this type
     72        virtual unsigned size() const { return 1; };
     73        virtual bool isVoid() const { return size() == 0; }
    6674
    6775        virtual Type *clone() const = 0;
     
    7179  private:
    7280        Qualifiers tq;
    73         std::list<TypeDecl*> forall;
     81        ForallList forall;
    7482};
    7583
     
    7785  public:
    7886        VoidType( const Type::Qualifiers &tq );
     87
     88        virtual unsigned size() const { return 0; };
    7989
    8090        virtual VoidType *clone() const { return new VoidType( *this ); }
     
    234244  public:
    235245        StructInstType( const Type::Qualifiers &tq, const std::string &name ) : Parent( tq, name ), baseStruct( 0 ) {}
     246        StructInstType( const Type::Qualifiers &tq, StructDecl * baseStruct );
    236247        StructInstType( const StructInstType &other ) : Parent( other ), baseStruct( other.baseStruct ) {}
    237248
     
    348359class TupleType : public Type {
    349360  public:
    350         TupleType( const Type::Qualifiers &tq );
     361        TupleType( const Type::Qualifiers &tq, const std::list< Type * > & types = std::list< Type * >() );
    351362        TupleType( const TupleType& );
    352363        virtual ~TupleType();
    353364
     365        typedef std::list<Type*> value_type;
     366        typedef value_type::iterator iterator;
     367
    354368        std::list<Type*>& get_types() { return types; }
     369        virtual unsigned size() const { return types.size(); };
     370
     371        iterator begin() { return types.begin(); }
     372        iterator end() { return types.end(); }
    355373
    356374        virtual TupleType *clone() const { return new TupleType( *this ); }
     
    442460};
    443461
     462inline Type::Qualifiers &Type::Qualifiers::operator&=( const Type::Qualifiers &other ) {
     463        isConst &= other.isConst;
     464        isVolatile &= other.isVolatile;
     465        isRestrict &= other.isRestrict;
     466        isLvalue &= other.isLvalue;
     467        isAtomic &= other.isAtomic;
     468        return *this;
     469}
     470
    444471inline Type::Qualifiers &Type::Qualifiers::operator+=( const Type::Qualifiers &other ) {
    445472        isConst |= other.isConst;
Note: See TracChangeset for help on using the changeset viewer.