source: src/SynTree/Type.h @ 615a096

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 615a096 was 615a096, checked in by Peter A. Buhr <pabuhr@…>, 7 years ago

fix BFCommon problem on gcc-4.9, and begin consistent renaming

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