Changeset 32fc0d6
- Timestamp:
- Mar 21, 2022, 3:51:57 PM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
- Children:
- 7a486f4a
- Parents:
- 4390fb6
- Location:
- src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/CodeGenerator.cc
r4390fb6 r32fc0d6 197 197 if ( objectDecl->isDeleted && options.genC ) return; 198 198 199 // objectDecl->checkAssignedValue();200 /* Temporary add the enum check here; need a better location */201 // {202 // EnumInstType * enumTypePtr = dynamic_cast< EnumInstType *>(objectDecl->get_type());203 // if (enumTypePtr) {204 // EnumDecl * enumBase = enumTypePtr -> baseEnum;205 // if ( enumTypePtr && enumBase->base ) {206 // std::list< Declaration * > & enumMembers = enumBase->get_members();207 // auto in_enum = [&]( Declaration * enumMem ) -> bool {208 // ObjectDecl * obj = dynamic_cast< ObjectDecl* >( enumMem );209 // if ( mangleName( obj ) == mangleName( objectDecl ) ) {210 // return true;211 // }212 // return false;213 // };214 // if ( std::find_if( enumMembers.begin(), enumMembers.end(), in_enum ) == enumMembers.end() ) {215 // output<< "/* Cannot assign a Non-enum member value to a typed enum variable. */" ;216 // }217 218 // }219 // }220 221 // }222 223 199 // gcc allows an empty declarator (no name) for bit-fields and C states: 6.7.2.1 Structure and union specifiers, 224 200 // point 4, page 113: If the (bit field) value is zero, the declaration shall have no declarator. For anything … … 302 278 if (enumDecl->base && ! memb.empty() && 303 279 (dynamic_cast<BasicType *>(enumDecl->base) 304 && ! dynamic_cast<BasicType *>(enumDecl->base)->kind == BasicType::Kind::SignedInt)) {280 && !(dynamic_cast<BasicType *>(enumDecl->base)->kind == BasicType::Kind::SignedInt))) { 305 281 ObjectDecl * last = nullptr; 306 282 for ( std::list< Declaration* >::iterator i = memb.begin(); i != memb.end(); i++) { -
src/SynTree/Declaration.h
r4390fb6 r32fc0d6 119 119 public: 120 120 Type * type; 121 Initializer * init; // For Enum, the init is a pointer that contain the enum value; see Parser::TypeData::buildEnum121 Initializer * init; 122 122 Expression * bitfieldWidth; 123 123 … … 144 144 virtual void print( std::ostream & os, Indenter indent = {} ) const override; 145 145 virtual void printShort( std::ostream & os, Indenter indent = {} ) const override; 146 147 // TODO: Move to the right place 148 void checkAssignedValue() const; 146 149 }; 147 150
Note: See TracChangeset
for help on using the changeset viewer.