source: src/SynTree/Type.h@ 6f95000

ADT aaron-thesis arm-eh ast-experimental cleanup-dtors deferred_resn demangler enum forall-pointer-decay jacob/cs343-translation jenkins-sandbox new-ast new-ast-unique-expr new-env no_list persistent-indexer pthread-emulation qualifiedEnum resolv-new with_gc
Last change on this file since 6f95000 was 6f95000, checked in by Peter A. Buhr <pabuhr@…>, 9 years ago

more cleanup for bit-field type usage and create struct forward for typedef

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