source: src/SynTree/Type.h@ e04b636

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

Implemented and tested coroutine keyword

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