| 457 | } |
| 458 | |
| 459 | bool Module::addAnnotation ( AnnotationPtr ptr, bool canFail ) { |
| 460 | auto key = hash64z(ptr->name.c_str()); |
| 461 | auto it = handleTypes.find(key); |
| 462 | if ( it!=handleTypes.end() && it->second==ptr ) { |
| 463 | ptr->seal(this); |
| 464 | return true; |
| 465 | } |
| 466 | if ( it==handleTypes.end() ) { |
| 467 | ptr->seal(this); |
| 468 | handleTypes[key] = ptr; |
| 469 | return true; |
| 470 | } else { |
| 471 | if ( !canFail ) { |
| 472 | DAS_FATAL_ERROR("can't add duplicate annotation %s to module %s\n", ptr->name.c_str(), name.c_str() ); |
| 473 | } |
| 474 | return false; |
| 475 | } |
| 476 | } |
| 477 | |
| 478 | bool Module::addTypeInfoMacro ( TypeInfoMacro * ptr, bool canFail ) { |
| 479 | if ( typeInfoMacros.insert(make_pair(ptr->name, unique_ptr<TypeInfoMacro>(ptr))).second ) { |
no test coverage detected