Changeset e874605 for src/Validate/LinkReferenceToTypes.cpp
- Timestamp:
- Oct 28, 2022, 3:11:57 PM (22 months ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- 93d2219
- Parents:
- 77de429
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Validate/LinkReferenceToTypes.cpp
r77de429 re874605 185 185 decl = mut; 186 186 } 187 // visit the base 187 188 } else if ( auto ptr = decl->base.as<ast::PointerType>() ) { 188 189 if ( auto base = ptr->base.as<ast::TypeInstType>() ) { … … 203 204 204 205 // The following section 205 auto mut = ast::mutate( decl );206 std::vector<ast::ptr<ast::Decl>> buffer;207 for ( auto it = decl->members.begin(); it != decl->members.end(); ++it) {208 auto member = (*it).as<ast::ObjectDecl>();209 if ( member->enumInLine ) {210 auto targetEnum = symtab.lookupEnum( member->name );211 if ( targetEnum ) {212 for ( auto singleMamber : targetEnum->members ) {213 auto tm = singleMamber.as<ast::ObjectDecl>();214 auto t = new ast::ObjectDecl(215 member->location, // use the "inline" location216 tm->name,217 new ast::EnumInstType( decl, ast::CV::Const ),218 // Construct a new EnumInstType as the type219 tm->init,220 tm->storage,221 tm->linkage,222 tm->bitfieldWidth,223 {}, // enum member doesn't have attribute224 tm->funcSpec225 );226 t->importValue = true;227 buffer.push_back(t);228 }229 }230 } else {231 auto search_it = std::find_if( buffer.begin(), buffer.end(), [member](ast::ptr<ast::Decl> cur) {232 auto curAsObjDecl = cur.as<ast::ObjectDecl>();233 return (curAsObjDecl->importValue) && (curAsObjDecl->name == member->name);234 });235 if ( search_it != buffer.end() ) {236 buffer.erase( search_it ); // Found an import enum value that has the same name237 // override the imported value238 }239 buffer.push_back( *it );240 }241 }242 mut->members = buffer;243 decl = mut;244 206 245 207 ForwardEnumsType::iterator fwds = forwardEnums.find( decl->name );
Note: See TracChangeset
for help on using the changeset viewer.