source: src/SynTree/Type.h @ 142cf5d

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 142cf5d was 142cf5d, checked in by Rob Schluntz <rschlunt@…>, 7 years ago

change type of string literal from char[] to const char[]

  • Property mode set to 100644
File size: 22.7 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        /// return type without outer pointers and arrays
158        Type *stripDeclarator();
159
160        virtual bool isComplete() const { return true; }
161
162        virtual Type *clone() const = 0;
163        virtual void accept( Visitor & v ) = 0;
164        virtual Type *acceptMutator( Mutator & m ) = 0;
165        virtual void print( std::ostream & os, int indent = 0 ) const;
166  private:
167        Qualifiers tq;
168        ForallList forall;
169        std::list< Attribute * > attributes;
170};
171
172extern Type::Qualifiers emptyQualifiers;                                // no qualifiers on constants
173
174class VoidType : public Type {
175  public:
176        VoidType( const Type::Qualifiers & tq, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
177
178        virtual unsigned size() const { return 0; };
179        virtual bool isComplete() const { return false; }
180
181        virtual VoidType *clone() const { return new VoidType( *this ); }
182        virtual void accept( Visitor & v ) { v.visit( this ); }
183        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
184        virtual void print( std::ostream & os, int indent = 0 ) const;
185};
186
187class BasicType : public Type {
188  public:
189        enum Kind {
190                Bool,
191                Char,
192                SignedChar,
193                UnsignedChar,
194                ShortSignedInt,
195                ShortUnsignedInt,
196                SignedInt,
197                UnsignedInt,
198                LongSignedInt,
199                LongUnsignedInt,
200                LongLongSignedInt,
201                LongLongUnsignedInt,
202                Float,
203                Double,
204                LongDouble,
205                FloatComplex,
206                DoubleComplex,
207                LongDoubleComplex,
208                FloatImaginary,
209                DoubleImaginary,
210                LongDoubleImaginary,
211                NUMBER_OF_BASIC_TYPES
212        };
213
214        static const char *typeNames[];                                         // string names for basic types, MUST MATCH with Kind
215
216        BasicType( const Type::Qualifiers & tq, Kind bt, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
217
218        Kind get_kind() { return kind; }
219        void set_kind( Kind newValue ) { kind = newValue; }
220
221        virtual BasicType *clone() const { return new BasicType( *this ); }
222        virtual void accept( Visitor & v ) { v.visit( this ); }
223        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
224        virtual void print( std::ostream & os, int indent = 0 ) const;
225
226        bool isInteger() const;
227  private:
228        Kind kind;
229};
230
231class PointerType : public Type {
232  public:
233        PointerType( const Type::Qualifiers & tq, Type *base, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
234        PointerType( const Type::Qualifiers & tq, Type *base, Expression *dimension, bool isVarLen, bool isStatic, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
235        PointerType( const PointerType& );
236        virtual ~PointerType();
237
238        Type *get_base() { return base; }
239        void set_base( Type *newValue ) { base = newValue; }
240        Expression *get_dimension() { return dimension; }
241        void set_dimension( Expression *newValue ) { dimension = newValue; }
242        bool get_isVarLen() { return isVarLen; }
243        void set_isVarLen( bool newValue ) { isVarLen = newValue; }
244        bool get_isStatic() { return isStatic; }
245        void set_isStatic( bool newValue ) { isStatic = newValue; }
246
247        virtual PointerType *clone() const { return new PointerType( *this ); }
248        virtual void accept( Visitor & v ) { v.visit( this ); }
249        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
250        virtual void print( std::ostream & os, int indent = 0 ) const;
251  private:
252        Type *base;
253
254        // In C99, pointer types can be qualified in many ways e.g., int f( int a[ static 3 ] )
255        Expression *dimension;
256        bool isVarLen;
257        bool isStatic;
258};
259
260class ArrayType : public Type {
261  public:
262        ArrayType( const Type::Qualifiers & tq, Type *base, Expression *dimension, bool isVarLen, bool isStatic, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
263        ArrayType( const ArrayType& );
264        virtual ~ArrayType();
265
266        Type *get_base() { return base; }
267        void set_base( Type *newValue ) { base = newValue; }
268        Expression *get_dimension() { return dimension; }
269        void set_dimension( Expression *newValue ) { dimension = newValue; }
270        bool get_isVarLen() { return isVarLen; }
271        void set_isVarLen( bool newValue ) { isVarLen = newValue; }
272        bool get_isStatic() { return isStatic; }
273        void set_isStatic( bool newValue ) { isStatic = newValue; }
274
275        virtual bool isComplete() const { return ! isVarLen; }
276
277        virtual ArrayType *clone() const { return new ArrayType( *this ); }
278        virtual void accept( Visitor & v ) { v.visit( this ); }
279        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
280        virtual void print( std::ostream & os, int indent = 0 ) const;
281  private:
282        Type *base;
283        Expression *dimension;
284        bool isVarLen;
285        bool isStatic;
286};
287
288class FunctionType : public Type {
289  public:
290        FunctionType( const Type::Qualifiers & tq, bool isVarArgs, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
291        FunctionType( const FunctionType& );
292        virtual ~FunctionType();
293
294        std::list<DeclarationWithType*> & get_returnVals() { return returnVals; }
295        std::list<DeclarationWithType*> & get_parameters() { return parameters; }
296        bool get_isVarArgs() const { return isVarArgs; }
297        void set_isVarArgs( bool newValue ) { isVarArgs = newValue; }
298        bool isTtype() const;
299
300        virtual FunctionType *clone() const { return new FunctionType( *this ); }
301        virtual void accept( Visitor & v ) { v.visit( this ); }
302        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
303        virtual void print( std::ostream & os, int indent = 0 ) const;
304  private:
305        std::list<DeclarationWithType*> returnVals;
306        std::list<DeclarationWithType*> parameters;
307
308        // Does the function accept a variable number of arguments following the arguments specified in the parameters list.
309        // This could be because of
310        // - an ellipsis in a prototype declaration
311        // - an unprototyped declaration
312        bool isVarArgs;
313};
314
315class ReferenceToType : public Type {
316  public:
317        ReferenceToType( const Type::Qualifiers & tq, const std::string & name, const std::list< Attribute * > & attributes );
318        ReferenceToType( const ReferenceToType & other );
319        virtual ~ReferenceToType();
320
321        const std::string & get_name() const { return name; }
322        void set_name( std::string newValue ) { name = newValue; }
323        std::list< Expression* >& get_parameters() { return parameters; }
324        bool get_hoistType() const { return hoistType; }
325        void set_hoistType( bool newValue ) { hoistType = newValue; }
326
327        virtual ReferenceToType *clone() const = 0;
328        virtual void accept( Visitor & v ) = 0;
329        virtual Type *acceptMutator( Mutator & m ) = 0;
330        virtual void print( std::ostream & os, int indent = 0 ) const;
331  protected:
332        virtual std::string typeString() const = 0;
333        std::list< Expression* > parameters;
334        std::string name;
335  private:
336        bool hoistType;
337};
338
339class StructInstType : public ReferenceToType {
340        typedef ReferenceToType Parent;
341  public:
342        StructInstType( const Type::Qualifiers & tq, const std::string & name, const std::list< Attribute * > & attributes = std::list< Attribute * >()  ) : Parent( tq, name, attributes ), baseStruct( 0 ) {}
343        StructInstType( const Type::Qualifiers & tq, StructDecl * baseStruct, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
344        StructInstType( const StructInstType & other ) : Parent( other ), baseStruct( other.baseStruct ) {}
345
346        StructDecl *get_baseStruct() const { return baseStruct; }
347        void set_baseStruct( StructDecl *newValue ) { baseStruct = newValue; }
348
349        /// Accesses generic parameters of base struct (NULL if none such)
350        std::list<TypeDecl*> * get_baseParameters();
351
352        virtual bool isComplete() const;
353
354        /// Looks up the members of this struct named "name" and places them into "foundDecls".
355        /// Clones declarations into "foundDecls", caller responsible for freeing
356        void lookup( const std::string & name, std::list< Declaration* > & foundDecls ) const;
357
358        virtual StructInstType *clone() const { return new StructInstType( *this ); }
359        virtual void accept( Visitor & v ) { v.visit( this ); }
360        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
361
362        virtual void print( std::ostream & os, int indent = 0 ) const;
363  private:
364        virtual std::string typeString() const;
365
366        // this decl is not "owned" by the struct inst; it is merely a pointer to elsewhere in the tree,
367        // where the structure used in this type is actually defined
368        StructDecl *baseStruct;
369};
370
371class UnionInstType : public ReferenceToType {
372        typedef ReferenceToType Parent;
373  public:
374        UnionInstType( const Type::Qualifiers & tq, const std::string & name, const std::list< Attribute * > & attributes = std::list< Attribute * >()  ) : Parent( tq, name, attributes ), baseUnion( 0 ) {}
375        UnionInstType( const Type::Qualifiers & tq, UnionDecl * baseUnion, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
376        UnionInstType( const UnionInstType & other ) : Parent( other ), baseUnion( other.baseUnion ) {}
377
378        UnionDecl *get_baseUnion() const { return baseUnion; }
379        void set_baseUnion( UnionDecl * newValue ) { baseUnion = newValue; }
380
381        /// Accesses generic parameters of base union (NULL if none such)
382        std::list< TypeDecl * > * get_baseParameters();
383
384        virtual bool isComplete() const;
385
386        /// looks up the members of this union named "name" and places them into "foundDecls"
387        /// Clones declarations into "foundDecls", caller responsible for freeing
388        void lookup( const std::string & name, std::list< Declaration* > & foundDecls ) const;
389
390        virtual UnionInstType *clone() const { return new UnionInstType( *this ); }
391        virtual void accept( Visitor & v ) { v.visit( this ); }
392        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
393
394        virtual void print( std::ostream & os, int indent = 0 ) const;
395  private:
396        virtual std::string typeString() const;
397
398        // this decl is not "owned" by the union inst; it is merely a pointer to elsewhere in the tree,
399        // where the union used in this type is actually defined
400        UnionDecl *baseUnion;
401};
402
403class EnumInstType : public ReferenceToType {
404        typedef ReferenceToType Parent;
405  public:
406        EnumInstType( const Type::Qualifiers & tq, const std::string & name, const std::list< Attribute * > & attributes = std::list< Attribute * >()  ) : Parent( tq, name, attributes ) {}
407        EnumInstType( const Type::Qualifiers & tq, EnumDecl * baseEnum, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
408        EnumInstType( const EnumInstType & other ) : Parent( other ), baseEnum( other.baseEnum ) {}
409
410        EnumDecl *get_baseEnum() const { return baseEnum; }
411        void set_baseEnum( EnumDecl *newValue ) { baseEnum = newValue; }
412
413        virtual bool isComplete() const;
414
415        virtual EnumInstType *clone() const { return new EnumInstType( *this ); }
416        virtual void accept( Visitor & v ) { v.visit( this ); }
417        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
418  private:
419        virtual std::string typeString() const;
420
421        // this decl is not "owned" by the union inst; it is merely a pointer to elsewhere in the tree,
422        // where the union used in this type is actually defined
423        EnumDecl *baseEnum = nullptr;
424};
425
426class TraitInstType : public ReferenceToType {
427        typedef ReferenceToType Parent;
428  public:
429        TraitInstType( const Type::Qualifiers & tq, const std::string & name, const std::list< Attribute * > & attributes = std::list< Attribute * >()  ) : Parent( tq, name, attributes ) {}
430        TraitInstType( const TraitInstType & other );
431        ~TraitInstType();
432
433        std::list< Declaration* >& get_members() { return members; }
434
435        virtual bool isComplete() const;
436
437        virtual TraitInstType *clone() const { return new TraitInstType( *this ); }
438        virtual void accept( Visitor & v ) { v.visit( this ); }
439        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
440  private:
441        virtual std::string typeString() const;
442
443        // this member is filled in by the validate pass, which instantiates the members of the correponding
444        // aggregate with the actual type parameters specified for this use of the context
445        std::list< Declaration* > members;
446};
447
448class TypeInstType : public ReferenceToType {
449        typedef ReferenceToType Parent;
450  public:
451        TypeInstType( const Type::Qualifiers & tq, const std::string & name, TypeDecl *baseType, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
452        TypeInstType( const Type::Qualifiers & tq, const std::string & name, bool isFtype, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
453        TypeInstType( const TypeInstType & other );
454        ~TypeInstType();
455
456        TypeDecl *get_baseType() const { return baseType; }
457        void set_baseType( TypeDecl *newValue );
458        bool get_isFtype() const { return isFtype; }
459        void set_isFtype( bool newValue ) { isFtype = newValue; }
460
461        virtual bool isComplete() const;
462
463        virtual TypeInstType *clone() const { return new TypeInstType( *this ); }
464        virtual void accept( Visitor & v ) { v.visit( this ); }
465        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
466        virtual void print( std::ostream & os, int indent = 0 ) const;
467  private:
468        virtual std::string typeString() const;
469        // this decl is not "owned" by the type inst; it is merely a pointer to elsewhere in the tree,
470        // where the type used here is actually defined
471        TypeDecl *baseType;
472        bool isFtype;
473};
474
475class TupleType : public Type {
476  public:
477        TupleType( const Type::Qualifiers & tq, const std::list< Type * > & types = std::list< Type * >(), const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
478        TupleType( const TupleType& );
479        virtual ~TupleType();
480
481        typedef std::list<Type*> value_type;
482        typedef value_type::iterator iterator;
483
484        std::list<Type*>& get_types() { return types; }
485        virtual unsigned size() const { return types.size(); };
486
487        iterator begin() { return types.begin(); }
488        iterator end() { return types.end(); }
489
490        virtual Type * getComponent( unsigned i ) {
491                assertf( i < size(), "TupleType::getComponent: index %d must be less than size %d", i, size() );
492                return *(begin()+i);
493        }
494
495        // virtual bool isComplete() const { return true; } // xxx - not sure if this is right, might need to recursively check complete-ness
496
497        virtual TupleType *clone() const { return new TupleType( *this ); }
498        virtual void accept( Visitor & v ) { v.visit( this ); }
499        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
500        virtual void print( std::ostream & os, int indent = 0 ) const;
501  private:
502        std::list<Type*> types;
503};
504
505class TypeofType : public Type {
506  public:
507        TypeofType( const Type::Qualifiers & tq, Expression *expr, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
508        TypeofType( const TypeofType& );
509        virtual ~TypeofType();
510
511        Expression *get_expr() const { return expr; }
512        void set_expr( Expression *newValue ) { expr = newValue; }
513
514        virtual bool isComplete() const { assert( false ); return false; }
515
516        virtual TypeofType *clone() const { return new TypeofType( *this ); }
517        virtual void accept( Visitor & v ) { v.visit( this ); }
518        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
519        virtual void print( std::ostream & os, int indent = 0 ) const;
520  private:
521        Expression *expr;
522};
523
524class AttrType : public Type {
525  public:
526        AttrType( const Type::Qualifiers & tq, const std::string & name, Expression *expr, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
527        AttrType( const Type::Qualifiers & tq, const std::string & name, Type *type, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
528        AttrType( const AttrType& );
529        virtual ~AttrType();
530
531        const std::string & get_name() const { return name; }
532        void set_name( const std::string & newValue ) { name = newValue; }
533        Expression *get_expr() const { return expr; }
534        void set_expr( Expression *newValue ) { expr = newValue; }
535        Type *get_type() const { return type; }
536        void set_type( Type *newValue ) { type = newValue; }
537        bool get_isType() const { return isType; }
538        void set_isType( bool newValue ) { isType = newValue; }
539
540        virtual bool isComplete() const { assert( false ); } // xxx - not sure what to do here
541
542        virtual AttrType *clone() const { return new AttrType( *this ); }
543        virtual void accept( Visitor & v ) { v.visit( this ); }
544        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
545        virtual void print( std::ostream & os, int indent = 0 ) const;
546  private:
547        std::string name;
548        Expression *expr;
549        Type *type;
550        bool isType;
551};
552
553/// Represents the GCC built-in varargs type
554class VarArgsType : public Type {
555  public:
556        VarArgsType();
557        VarArgsType( Type::Qualifiers tq, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
558
559        virtual bool isComplete() const{ return true; } // xxx - is this right?
560
561        virtual VarArgsType *clone() const { return new VarArgsType( *this ); }
562        virtual void accept( Visitor & v ) { v.visit( this ); }
563        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
564        virtual void print( std::ostream & os, int indent = 0 ) const;
565};
566
567/// Represents a zero constant
568class ZeroType : public Type {
569  public:
570        ZeroType();
571        ZeroType( Type::Qualifiers tq, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
572
573        virtual ZeroType *clone() const { return new ZeroType( *this ); }
574        virtual void accept( Visitor & v ) { v.visit( this ); }
575        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
576        virtual void print( std::ostream & os, int indent = 0 ) const;
577};
578
579/// Represents a one constant
580class OneType : public Type {
581  public:
582        OneType();
583        OneType( Type::Qualifiers tq, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
584
585        virtual OneType *clone() const { return new OneType( *this ); }
586        virtual void accept( Visitor & v ) { v.visit( this ); }
587        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
588        virtual void print( std::ostream & os, int indent = 0 ) const;
589};
590
591std::ostream & operator<<( std::ostream & out, const Type * type );
592
593#endif // TYPE_H
594
595// Local Variables: //
596// tab-width: 4 //
597// mode: c++ //
598// compile-command: "make install" //
599// End: //
Note: See TracBrowser for help on using the repository browser.