source: src/SynTree/Type.h @ 26ba208

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since 26ba208 was 68fe077a, checked in by Peter A. Buhr <pabuhr@…>, 7 years ago

move type StorageClasses? from DeclarationNode? to Type

  • Property mode set to 100644
File size: 21.9 KB
Line 
1//
2// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
3//
4// The contents of this file are covered under the licence agreement in the
5// file "LICENCE" distributed with Cforall.
6//
7// Type.h --
8//
9// Author           : Richard C. Bilson
10// Created On       : Mon May 18 07:44:20 2015
11// Last Modified By : Peter A. Buhr
12// Last Modified On : Thu Mar 16 07:45:29 2017
13// Update Count     : 90
14//
15
16#ifndef TYPE_H
17#define TYPE_H
18
19#include "BaseSyntaxNode.h"
20#include "Mutator.h"
21#include "SynTree.h"
22#include "Visitor.h"
23
24class Type : public BaseSyntaxNode {
25  public:
26        // enum must remain in the same order as the corresponding bit fields.
27
28        enum { Extern = 1 << 0, Static = 1 << 1, Auto = 1 << 2, Register = 1 << 3, Threadlocal = 1 << 4, NumStorageClass = 5 };
29        union StorageClasses {
30                static const char * Names[];
31                unsigned int val;
32                struct {
33                        bool is_extern : 1;
34                        bool is_static : 1;
35                        bool is_auto : 1;
36                        bool is_register : 1;
37                        bool is_threadlocal : 1;
38                };
39
40                StorageClasses() : val( 0 ) {}
41                StorageClasses( unsigned int val ) : val( val ) {}
42                bool operator[]( unsigned int i ) const { return val & (1 << i); }
43                bool any() const { return val != 0; }
44                void print( std::ostream & os ) const {
45                        if ( (*this).any() ) {                                          // any storage classes ?
46                                for ( unsigned int i = 0; i < NumStorageClass; i += 1 ) {
47                                        if ( (*this)[i] ) {
48                                                os << StorageClasses::Names[i] << ' ';
49                                        } // if
50                                } // for
51                        } // if
52                }
53        }; // StorageClasses
54
55        enum { Const = 1 << 0, Restrict = 1 << 1, Volatile = 1 << 2, Lvalue = 1 << 3, Mutex = 1 << 4, Atomic = 1 << 5, NumTypeQualifier = 6 };
56        union Qualifiers {
57                static const char * Names[];
58                enum { Mask = ~(Restrict | Lvalue) };
59                unsigned int val;
60                struct {
61                        bool isConst : 1;
62                        bool isRestrict : 1;
63                        bool isVolatile : 1;
64                        bool isLvalue : 1;
65                        bool isMutex : 1;
66                        bool isAtomic : 1;
67                };
68
69                Qualifiers() : val( 0 ) {}
70                Qualifiers( unsigned int val ) : val( val ) {}
71                bool operator[]( unsigned int i ) const { return val & (1 << i); }
72                bool any() const { return val != 0; }
73                bool operator==( const Qualifiers other ) const {
74                        return (val & Mask) == (other.val & Mask);
75                }
76                bool operator!=( const Qualifiers other ) const {
77                        return (val & Mask) != (other.val & Mask);
78                }
79                bool operator<=( const Qualifiers other ) const {
80                        return isConst <= other.isConst && isVolatile <= other.isVolatile &&
81                                isMutex == other.isMutex && isAtomic == other.isAtomic;
82                }
83                bool operator>=( const Qualifiers other ) const {
84                        return isConst >= other.isConst && isVolatile >= other.isVolatile &&
85                                isMutex == other.isMutex && isAtomic == other.isAtomic;
86                }
87                bool operator<( const Qualifiers other ) const {
88                        return *this != other && *this <= other;
89                }
90                bool operator>( const Qualifiers other ) const {
91                        return *this != other && *this >= other;
92                }
93                Qualifiers operator&=( const Type::Qualifiers other ) {
94                        val &= other.val; return *this;
95                }
96                Qualifiers operator+=( const Qualifiers other ) {
97                        val |= other.val; return *this;
98                }
99                Qualifiers operator-=( const Qualifiers other ) {
100                        val &= ~other.val; return *this;
101                }
102                Qualifiers operator+( const Qualifiers other ) const {
103                        Qualifiers q = other;
104                        q += *this;
105                        return q;
106                }
107                void print( std::ostream & os, int indent = 0 ) const {
108                        if ( (*this).any() ) {                                          // any type qualifiers ?
109                                for ( unsigned int i = 0; i < NumTypeQualifier; i += 1 ) {
110                                        if ( (*this)[i] ) {
111                                                os << Names[i] << ' ';
112                                        } // if
113                                } // for
114                        } // if
115                }
116        }; // Qualifiers
117
118        Type( const Qualifiers & tq, const std::list< Attribute * > & attributes );
119        Type( const Type & other );
120        virtual ~Type();
121
122        Qualifiers & get_qualifiers() { return tq; }
123        bool get_isConst() { return tq.isConst; }
124        bool get_isVolatile() { return tq.isVolatile; }
125        bool get_isRestrict() { return tq.isRestrict; }
126        bool get_isLvalue() { return tq.isLvalue; }
127        bool get_isAtomic() { return tq.isAtomic; }
128        void set_isConst( bool newValue ) { tq.isConst = newValue; }
129        void set_isVolatile( bool newValue ) { tq.isVolatile = newValue; }
130        void set_isRestrict( bool newValue ) { tq.isRestrict = newValue; }
131        void set_isLvalue( bool newValue ) { tq.isLvalue = newValue; }
132        void set_isAtomic( bool newValue ) { tq.isAtomic = newValue; }
133
134        typedef std::list<TypeDecl *> ForallList;
135        ForallList& get_forall() { return forall; }
136
137        std::list< Attribute * >& get_attributes() { return attributes; }
138        const std::list< Attribute * >& get_attributes() const { return attributes; }
139
140        /// How many elemental types are represented by this type
141        virtual unsigned size() const { return 1; };
142        virtual bool isVoid() const { return size() == 0; }
143        virtual Type * getComponent( unsigned i ) { assertf( size() == 1 && i == 0, "Type::getComponent was called with size %d and index %d\n", size(), i ); return this; }
144
145        virtual bool isComplete() const { return true; }
146
147        virtual Type *clone() const = 0;
148        virtual void accept( Visitor & v ) = 0;
149        virtual Type *acceptMutator( Mutator & m ) = 0;
150        virtual void print( std::ostream & os, int indent = 0 ) const;
151  private:
152        Qualifiers tq;
153        ForallList forall;
154        std::list< Attribute * > attributes;
155};
156
157extern Type::Qualifiers emptyQualifiers;                                // no qualifiers on constants
158
159class VoidType : public Type {
160  public:
161        VoidType( const Type::Qualifiers & tq, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
162
163        virtual unsigned size() const { return 0; };
164        virtual bool isComplete() const { return false; }
165
166        virtual VoidType *clone() const { return new VoidType( *this ); }
167        virtual void accept( Visitor & v ) { v.visit( this ); }
168        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
169        virtual void print( std::ostream & os, int indent = 0 ) const;
170};
171
172class BasicType : public Type {
173  public:
174        enum Kind {
175                Bool,
176                Char,
177                SignedChar,
178                UnsignedChar,
179                ShortSignedInt,
180                ShortUnsignedInt,
181                SignedInt,
182                UnsignedInt,
183                LongSignedInt,
184                LongUnsignedInt,
185                LongLongSignedInt,
186                LongLongUnsignedInt,
187                Float,
188                Double,
189                LongDouble,
190                FloatComplex,
191                DoubleComplex,
192                LongDoubleComplex,
193                FloatImaginary,
194                DoubleImaginary,
195                LongDoubleImaginary,
196                NUMBER_OF_BASIC_TYPES
197        };
198
199        static const char *typeNames[];                                         // string names for basic types, MUST MATCH with Kind
200
201        BasicType( const Type::Qualifiers & tq, Kind bt, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
202
203        Kind get_kind() { return kind; }
204        void set_kind( Kind newValue ) { kind = newValue; }
205
206        virtual BasicType *clone() const { return new BasicType( *this ); }
207        virtual void accept( Visitor & v ) { v.visit( this ); }
208        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
209        virtual void print( std::ostream & os, int indent = 0 ) const;
210
211        bool isInteger() const;
212  private:
213        Kind kind;
214};
215
216class PointerType : public Type {
217  public:
218        PointerType( const Type::Qualifiers & tq, Type *base, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
219        PointerType( const Type::Qualifiers & tq, Type *base, Expression *dimension, bool isVarLen, bool isStatic, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
220        PointerType( const PointerType& );
221        virtual ~PointerType();
222
223        Type *get_base() { return base; }
224        void set_base( Type *newValue ) { base = newValue; }
225        Expression *get_dimension() { return dimension; }
226        void set_dimension( Expression *newValue ) { dimension = newValue; }
227        bool get_isVarLen() { return isVarLen; }
228        void set_isVarLen( bool newValue ) { isVarLen = newValue; }
229        bool get_isStatic() { return isStatic; }
230        void set_isStatic( bool newValue ) { isStatic = newValue; }
231
232        virtual PointerType *clone() const { return new PointerType( *this ); }
233        virtual void accept( Visitor & v ) { v.visit( this ); }
234        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
235        virtual void print( std::ostream & os, int indent = 0 ) const;
236  private:
237        Type *base;
238
239        // In C99, pointer types can be qualified in many ways e.g., int f( int a[ static 3 ] )
240        Expression *dimension;
241        bool isVarLen;
242        bool isStatic;
243};
244
245class ArrayType : public Type {
246  public:
247        ArrayType( const Type::Qualifiers & tq, Type *base, Expression *dimension, bool isVarLen, bool isStatic, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
248        ArrayType( const ArrayType& );
249        virtual ~ArrayType();
250
251        Type *get_base() { return base; }
252        void set_base( Type *newValue ) { base = newValue; }
253        Expression *get_dimension() { return dimension; }
254        void set_dimension( Expression *newValue ) { dimension = newValue; }
255        bool get_isVarLen() { return isVarLen; }
256        void set_isVarLen( bool newValue ) { isVarLen = newValue; }
257        bool get_isStatic() { return isStatic; }
258        void set_isStatic( bool newValue ) { isStatic = newValue; }
259
260        virtual bool isComplete() const { return ! isVarLen; }
261
262        virtual ArrayType *clone() const { return new ArrayType( *this ); }
263        virtual void accept( Visitor & v ) { v.visit( this ); }
264        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
265        virtual void print( std::ostream & os, int indent = 0 ) const;
266  private:
267        Type *base;
268        Expression *dimension;
269        bool isVarLen;
270        bool isStatic;
271};
272
273class FunctionType : public Type {
274  public:
275        FunctionType( const Type::Qualifiers & tq, bool isVarArgs, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
276        FunctionType( const FunctionType& );
277        virtual ~FunctionType();
278
279        std::list<DeclarationWithType*> & get_returnVals() { return returnVals; }
280        std::list<DeclarationWithType*> & get_parameters() { return parameters; }
281        bool get_isVarArgs() const { return isVarArgs; }
282        void set_isVarArgs( bool newValue ) { isVarArgs = newValue; }
283        bool isTtype() const;
284
285        virtual FunctionType *clone() const { return new FunctionType( *this ); }
286        virtual void accept( Visitor & v ) { v.visit( this ); }
287        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
288        virtual void print( std::ostream & os, int indent = 0 ) const;
289  private:
290        std::list<DeclarationWithType*> returnVals;
291        std::list<DeclarationWithType*> parameters;
292
293        // Does the function accept a variable number of arguments following the arguments specified in the parameters list.
294        // This could be because of
295        // - an ellipsis in a prototype declaration
296        // - an unprototyped declaration
297        bool isVarArgs;
298};
299
300class ReferenceToType : public Type {
301  public:
302        ReferenceToType( const Type::Qualifiers & tq, const std::string & name, const std::list< Attribute * > & attributes );
303        ReferenceToType( const ReferenceToType & other );
304        virtual ~ReferenceToType();
305
306        const std::string & get_name() const { return name; }
307        void set_name( std::string newValue ) { name = newValue; }
308        std::list< Expression* >& get_parameters() { return parameters; }
309        bool get_hoistType() const { return hoistType; }
310        void set_hoistType( bool newValue ) { hoistType = newValue; }
311
312        virtual ReferenceToType *clone() const = 0;
313        virtual void accept( Visitor & v ) = 0;
314        virtual Type *acceptMutator( Mutator & m ) = 0;
315        virtual void print( std::ostream & os, int indent = 0 ) const;
316  protected:
317        virtual std::string typeString() const = 0;
318        std::list< Expression* > parameters;
319        std::string name;
320  private:
321        bool hoistType;
322};
323
324class StructInstType : public ReferenceToType {
325        typedef ReferenceToType Parent;
326  public:
327        StructInstType( const Type::Qualifiers & tq, const std::string & name, const std::list< Attribute * > & attributes = std::list< Attribute * >()  ) : Parent( tq, name, attributes ), baseStruct( 0 ) {}
328        StructInstType( const Type::Qualifiers & tq, StructDecl * baseStruct, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
329        StructInstType( const StructInstType & other ) : Parent( other ), baseStruct( other.baseStruct ) {}
330
331        StructDecl *get_baseStruct() const { return baseStruct; }
332        void set_baseStruct( StructDecl *newValue ) { baseStruct = newValue; }
333
334        /// Accesses generic parameters of base struct (NULL if none such)
335        std::list<TypeDecl*> * get_baseParameters();
336
337        virtual bool isComplete() const;
338
339        /// Looks up the members of this struct named "name" and places them into "foundDecls".
340        /// Clones declarations into "foundDecls", caller responsible for freeing
341        void lookup( const std::string & name, std::list< Declaration* > & foundDecls ) const;
342
343        virtual StructInstType *clone() const { return new StructInstType( *this ); }
344        virtual void accept( Visitor & v ) { v.visit( this ); }
345        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
346
347        virtual void print( std::ostream & os, int indent = 0 ) const;
348  private:
349        virtual std::string typeString() const;
350
351        // this decl is not "owned" by the struct inst; it is merely a pointer to elsewhere in the tree,
352        // where the structure used in this type is actually defined
353        StructDecl *baseStruct;
354};
355
356class UnionInstType : public ReferenceToType {
357        typedef ReferenceToType Parent;
358  public:
359        UnionInstType( const Type::Qualifiers & tq, const std::string & name, const std::list< Attribute * > & attributes = std::list< Attribute * >()  ) : Parent( tq, name, attributes ), baseUnion( 0 ) {}
360        UnionInstType( const Type::Qualifiers & tq, UnionDecl * baseUnion, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
361        UnionInstType( const UnionInstType & other ) : Parent( other ), baseUnion( other.baseUnion ) {}
362
363        UnionDecl *get_baseUnion() const { return baseUnion; }
364        void set_baseUnion( UnionDecl * newValue ) { baseUnion = newValue; }
365
366        /// Accesses generic parameters of base union (NULL if none such)
367        std::list< TypeDecl * > * get_baseParameters();
368
369        virtual bool isComplete() const;
370
371        /// looks up the members of this union named "name" and places them into "foundDecls"
372        /// Clones declarations into "foundDecls", caller responsible for freeing
373        void lookup( const std::string & name, std::list< Declaration* > & foundDecls ) const;
374
375        virtual UnionInstType *clone() const { return new UnionInstType( *this ); }
376        virtual void accept( Visitor & v ) { v.visit( this ); }
377        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
378
379        virtual void print( std::ostream & os, int indent = 0 ) const;
380  private:
381        virtual std::string typeString() const;
382
383        // this decl is not "owned" by the union inst; it is merely a pointer to elsewhere in the tree,
384        // where the union used in this type is actually defined
385        UnionDecl *baseUnion;
386};
387
388class EnumInstType : public ReferenceToType {
389        typedef ReferenceToType Parent;
390  public:
391        EnumInstType( const Type::Qualifiers & tq, const std::string & name, const std::list< Attribute * > & attributes = std::list< Attribute * >()  ) : Parent( tq, name, attributes ) {}
392        EnumInstType( const Type::Qualifiers & tq, EnumDecl * baseEnum, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
393        EnumInstType( const EnumInstType & other ) : Parent( other ), baseEnum( other.baseEnum ) {}
394
395        EnumDecl *get_baseEnum() const { return baseEnum; }
396        void set_baseEnum( EnumDecl *newValue ) { baseEnum = newValue; }
397
398        virtual bool isComplete() const;
399
400        virtual EnumInstType *clone() const { return new EnumInstType( *this ); }
401        virtual void accept( Visitor & v ) { v.visit( this ); }
402        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
403  private:
404        virtual std::string typeString() const;
405
406        // this decl is not "owned" by the union inst; it is merely a pointer to elsewhere in the tree,
407        // where the union used in this type is actually defined
408        EnumDecl *baseEnum = nullptr;
409};
410
411class TraitInstType : public ReferenceToType {
412        typedef ReferenceToType Parent;
413  public:
414        TraitInstType( const Type::Qualifiers & tq, const std::string & name, const std::list< Attribute * > & attributes = std::list< Attribute * >()  ) : Parent( tq, name, attributes ) {}
415        TraitInstType( const TraitInstType & other );
416        ~TraitInstType();
417
418        std::list< Declaration* >& get_members() { return members; }
419
420        virtual bool isComplete() const;
421
422        virtual TraitInstType *clone() const { return new TraitInstType( *this ); }
423        virtual void accept( Visitor & v ) { v.visit( this ); }
424        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
425  private:
426        virtual std::string typeString() const;
427
428        // this member is filled in by the validate pass, which instantiates the members of the correponding
429        // aggregate with the actual type parameters specified for this use of the context
430        std::list< Declaration* > members;
431};
432
433class TypeInstType : public ReferenceToType {
434        typedef ReferenceToType Parent;
435  public:
436        TypeInstType( const Type::Qualifiers & tq, const std::string & name, TypeDecl *baseType, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
437        TypeInstType( const Type::Qualifiers & tq, const std::string & name, bool isFtype, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
438        TypeInstType( const TypeInstType & other );
439        ~TypeInstType();
440
441        TypeDecl *get_baseType() const { return baseType; }
442        void set_baseType( TypeDecl *newValue );
443        bool get_isFtype() const { return isFtype; }
444        void set_isFtype( bool newValue ) { isFtype = newValue; }
445
446        virtual bool isComplete() const;
447
448        virtual TypeInstType *clone() const { return new TypeInstType( *this ); }
449        virtual void accept( Visitor & v ) { v.visit( this ); }
450        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
451        virtual void print( std::ostream & os, int indent = 0 ) const;
452  private:
453        virtual std::string typeString() const;
454        // this decl is not "owned" by the type inst; it is merely a pointer to elsewhere in the tree,
455        // where the type used here is actually defined
456        TypeDecl *baseType;
457        bool isFtype;
458};
459
460class TupleType : public Type {
461  public:
462        TupleType( const Type::Qualifiers & tq, const std::list< Type * > & types = std::list< Type * >(), const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
463        TupleType( const TupleType& );
464        virtual ~TupleType();
465
466        typedef std::list<Type*> value_type;
467        typedef value_type::iterator iterator;
468
469        std::list<Type*>& get_types() { return types; }
470        virtual unsigned size() const { return types.size(); };
471
472        iterator begin() { return types.begin(); }
473        iterator end() { return types.end(); }
474
475        virtual Type * getComponent( unsigned i ) {
476                assertf( i < size(), "TupleType::getComponent: index %d must be less than size %d", i, size() );
477                return *(begin()+i);
478        }
479
480        // virtual bool isComplete() const { return true; } // xxx - not sure if this is right, might need to recursively check complete-ness
481
482        virtual TupleType *clone() const { return new TupleType( *this ); }
483        virtual void accept( Visitor & v ) { v.visit( this ); }
484        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
485        virtual void print( std::ostream & os, int indent = 0 ) const;
486  private:
487        std::list<Type*> types;
488};
489
490class TypeofType : public Type {
491  public:
492        TypeofType( const Type::Qualifiers & tq, Expression *expr, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
493        TypeofType( const TypeofType& );
494        virtual ~TypeofType();
495
496        Expression *get_expr() const { return expr; }
497        void set_expr( Expression *newValue ) { expr = newValue; }
498
499        virtual bool isComplete() const { assert( false ); return false; }
500
501        virtual TypeofType *clone() const { return new TypeofType( *this ); }
502        virtual void accept( Visitor & v ) { v.visit( this ); }
503        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
504        virtual void print( std::ostream & os, int indent = 0 ) const;
505  private:
506        Expression *expr;
507};
508
509class AttrType : public Type {
510  public:
511        AttrType( const Type::Qualifiers & tq, const std::string & name, Expression *expr, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
512        AttrType( const Type::Qualifiers & tq, const std::string & name, Type *type, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
513        AttrType( const AttrType& );
514        virtual ~AttrType();
515
516        const std::string & get_name() const { return name; }
517        void set_name( const std::string & newValue ) { name = newValue; }
518        Expression *get_expr() const { return expr; }
519        void set_expr( Expression *newValue ) { expr = newValue; }
520        Type *get_type() const { return type; }
521        void set_type( Type *newValue ) { type = newValue; }
522        bool get_isType() const { return isType; }
523        void set_isType( bool newValue ) { isType = newValue; }
524
525        virtual bool isComplete() const { assert( false ); } // xxx - not sure what to do here
526
527        virtual AttrType *clone() const { return new AttrType( *this ); }
528        virtual void accept( Visitor & v ) { v.visit( this ); }
529        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
530        virtual void print( std::ostream & os, int indent = 0 ) const;
531  private:
532        std::string name;
533        Expression *expr;
534        Type *type;
535        bool isType;
536};
537
538/// Represents the GCC built-in varargs type
539class VarArgsType : public Type {
540  public:
541        VarArgsType();
542        VarArgsType( Type::Qualifiers tq, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
543
544        virtual bool isComplete() const{ return true; } // xxx - is this right?
545
546        virtual VarArgsType *clone() const { return new VarArgsType( *this ); }
547        virtual void accept( Visitor & v ) { v.visit( this ); }
548        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
549        virtual void print( std::ostream & os, int indent = 0 ) const;
550};
551
552/// Represents a zero constant
553class ZeroType : public Type {
554  public:
555        ZeroType();
556        ZeroType( Type::Qualifiers tq, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
557
558        virtual ZeroType *clone() const { return new ZeroType( *this ); }
559        virtual void accept( Visitor & v ) { v.visit( this ); }
560        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
561        virtual void print( std::ostream & os, int indent = 0 ) const;
562};
563
564/// Represents a one constant
565class OneType : public Type {
566  public:
567        OneType();
568        OneType( Type::Qualifiers tq, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
569
570        virtual OneType *clone() const { return new OneType( *this ); }
571        virtual void accept( Visitor & v ) { v.visit( this ); }
572        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
573        virtual void print( std::ostream & os, int indent = 0 ) const;
574};
575
576std::ostream & operator<<( std::ostream & out, const Type * type );
577
578#endif // TYPE_H
579
580// Local Variables: //
581// tab-width: 4 //
582// mode: c++ //
583// compile-command: "make install" //
584// End: //
Note: See TracBrowser for help on using the repository browser.