source: src/SynTree/Type.h@ ddfd945

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

move type FuncSpecifiers from DeclarationNode to Type

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