| 85 | } |
| 86 | |
| 87 | void UniqueIdChecker::setInterfaceId(Interface *iface, Annotation *interfaceId) |
| 88 | { |
| 89 | if (!interfaceId->hasValue() || interfaceId->getValueObject()->getType() != kIntegerValue) |
| 90 | { |
| 91 | throw semantic_error(format_string("@id() for interface %s() has no valid value\n", iface->getName().c_str())); |
| 92 | } |
| 93 | else |
| 94 | { |
| 95 | assert(nullptr != dynamic_cast<IntegerValue *>(interfaceId->getValueObject())); |
| 96 | uint32_t newIdValue = (uint32_t) dynamic_cast<IntegerValue *>(interfaceId->getValueObject())->getValue(); |
| 97 | if (newIdValue == 0 && 0 != iface->getName().compare("Common")) |
| 98 | { |
| 99 | throw semantic_error( |
| 100 | format_string("@id value for interface %s must be greater than zero", iface->getName().c_str())); |
| 101 | } |
| 102 | iface->setUniqueId(newIdValue); |
| 103 | for (unsigned int i = 0; i < m_usedInterfaceIds.size(); ++i) |
| 104 | { |
| 105 | if (0 == m_usedInterfaceIds[i].second.compare(iface->getName())) |
| 106 | { |
| 107 | m_usedInterfaceIds.erase(m_usedInterfaceIds.begin() + i); |
| 108 | break; |
| 109 | } |
| 110 | } |
| 111 | m_usedInterfaceIds.push_back(make_pair(newIdValue, iface->getName())); |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | void UniqueIdChecker::setFunctionId(Function *fn, Annotation *idAnnotation) |
| 116 | { |
nothing calls this directly
no test coverage detected