Changeset f135b50 for src/AST/Decl.hpp


Ignore:
Timestamp:
Feb 28, 2022, 3:41:44 AM (2 years ago)
Author:
JiadaL <j82liang@…>
Branches:
ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
Children:
786c438
Parents:
a8ef59e
Message:

The compiler is now trying to pass the value of enum const to code gen; but it won't work cause we must be able to evaluate the const_expr in compiler time. It is not currently passed as a Expression but won't be able to evaluate at compile time

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Decl.hpp

    ra8ef59e rf135b50  
    302302class EnumDecl final : public AggregateDecl {
    303303public:
     304        Type * base;
     305
    304306        EnumDecl( const CodeLocation& loc, const std::string& name,
    305                 std::vector<ptr<Attribute>>&& attrs = {}, Linkage::Spec linkage = Linkage::Cforall )
    306         : AggregateDecl( loc, name, std::move(attrs), linkage ), enumValues() {}
     307                std::vector<ptr<Attribute>>&& attrs = {}, Linkage::Spec linkage = Linkage::Cforall, Type * base = nullptr,
     308                 std::unordered_map< std::string, long long > enumValues = std::unordered_map< std::string, long long >() )
     309        : AggregateDecl( loc, name, std::move(attrs), linkage ), base(base), enumValues(enumValues) {}
    307310
    308311        /// gets the integer value for this enumerator, returning true iff value found
     312        // Maybe it is not used in producing the enum value
    309313        bool valueOf( const Decl * enumerator, long long& value ) const;
    310314
Note: See TracChangeset for help on using the changeset viewer.