Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Decl.hpp

    r93c10de r19a8c40  
    1010// Created On       : Thu May 9 10:00:00 2019
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Thu Nov 24  9:44:00 2022
    13 // Update Count     : 34
     12// Last Modified On : Thu May  5 12:09:00 2022
     13// Update Count     : 33
    1414//
    1515
     
    191191        ptr<Type> init;
    192192
     193        /// Data extracted from a type decl
     194        struct Data {
     195                Kind kind;
     196                bool isComplete;
     197
     198                Data() : kind( NUMBER_OF_KINDS ), isComplete( false ) {}
     199                Data( const TypeDecl * d ) : kind( d->kind ), isComplete( d->sized ) {}
     200                Data( Kind k, bool c ) : kind( k ), isComplete( c ) {}
     201                Data( const Data & d1, const Data & d2 )
     202                        : kind( d1.kind ), isComplete( d1.isComplete || d2.isComplete ) {}
     203
     204                bool operator==( const Data & o ) const { return kind == o.kind && isComplete == o.isComplete; }
     205                bool operator!=( const Data & o ) const { return !(*this == o); }
     206        };
     207
    193208        TypeDecl(
    194209                const CodeLocation & loc, const std::string & name, Storage::Classes storage,
     
    210225};
    211226
    212 /// Data extracted from a TypeDecl.
    213 struct TypeData {
    214         TypeDecl::Kind kind;
    215         bool isComplete;
    216 
    217         TypeData() : kind( TypeDecl::NUMBER_OF_KINDS ), isComplete( false ) {}
    218         TypeData( const TypeDecl * d ) : kind( d->kind ), isComplete( d->sized ) {}
    219         TypeData( TypeDecl::Kind k, bool c ) : kind( k ), isComplete( c ) {}
    220         TypeData( const TypeData & d1, const TypeData & d2 )
    221                 : kind( d1.kind ), isComplete( d1.isComplete || d2.isComplete ) {}
    222 
    223         bool operator==( const TypeData & o ) const { return kind == o.kind && isComplete == o.isComplete; }
    224         bool operator!=( const TypeData & o ) const { return !(*this == o); }
    225 };
    226 
    227 std::ostream & operator<< ( std::ostream &, const TypeData & );
     227std::ostream & operator<< ( std::ostream &, const TypeDecl::Data & );
    228228
    229229/// C-style typedef `typedef Foo Bar`
     
    315315        // enum (type_optional) Name {...}
    316316        ptr<Type> base; // if isTyped == true && base.get() == nullptr, it is a "void" type enum
    317         enum class EnumHiding { Visible, Hide } hide;
    318 
    319         EnumDecl( const CodeLocation& loc, const std::string& name, bool isTyped = false,
     317
     318        EnumDecl( const CodeLocation& loc, const std::string& name, bool isTyped = false,
    320319                std::vector<ptr<Attribute>>&& attrs = {}, Linkage::Spec linkage = Linkage::Cforall,
    321                 Type const * base = nullptr, EnumHiding hide = EnumHiding::Hide,
     320                Type const * base = nullptr,
    322321                std::unordered_map< std::string, long long > enumValues = std::unordered_map< std::string, long long >() )
    323         : AggregateDecl( loc, name, std::move(attrs), linkage ), isTyped(isTyped), base(base), hide(hide), enumValues(enumValues) {}
     322        : AggregateDecl( loc, name, std::move(attrs), linkage ), isTyped(isTyped), base(base), enumValues(enumValues) {}
    324323
    325324        /// gets the integer value for this enumerator, returning true iff value found
Note: See TracChangeset for help on using the changeset viewer.