source: src/SynTree/Type.h @ 43c89a7

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 43c89a7 was 43c89a7, checked in by Rob Schluntz <rschlunt@…>, 7 years ago

add hoistType flag (currently unused)

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