source: src/SynTree/Type.h @ ebb5ed9

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since ebb5ed9 was dd020c0, checked in by Peter A. Buhr <pabuhr@…>, 7 years ago

first attempt to create function specifiers

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