source: src/SynTree/Type.h@ 17af7d1

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 17af7d1 was ef42b143, checked in by Thierry Delisle <tdelisle@…>, 9 years ago

Implemented monitor keyword, and it works

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