MCPcopy Create free account
hub / github.com/EmbeddedRPC/erpc / makeIdsUnique

Method makeIdsUnique

erpcgen/src/UniqueIdChecker.cpp:29–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27////////////////////////////////////////////////////////////////////////////////
28
29void UniqueIdChecker::makeIdsUnique(InterfaceDefinition &def)
30{
31 initUsedInterfaceIds(def.getGlobals().getSymbolsOfType(Symbol::symbol_type_t::kInterfaceSymbol));
32
33 for (auto it : def.getGlobals().getSymbolsOfType(Symbol::symbol_type_t::kInterfaceSymbol))
34 {
35 assert(nullptr != it);
36 Interface *interface = dynamic_cast<Interface *>(it);
37 assert(interface);
38 if (Annotation *interfaceId = interface->findAnnotation(ID_ANNOTATION, Annotation::program_lang_t::kAll))
39 {
40 setInterfaceId(interface, interfaceId);
41 }
42 initUsedFunctionIds(interface);
43 for (auto function : interface->getFunctions())
44 {
45 if (Annotation *functionId = function->findAnnotation(ID_ANNOTATION, Annotation::program_lang_t::kAll))
46 {
47 setFunctionId(function, functionId);
48 }
49 }
50 if (0 < m_usedFunctionIds.size())
51 {
52 checkDuplicateIds(m_usedFunctionIds, "function");
53 }
54 }
55 if (0 < m_usedInterfaceIds.size())
56 {
57 checkDuplicateIds(m_usedInterfaceIds, "interface");
58 }
59}
60
61void UniqueIdChecker::initUsedInterfaceIds(SymbolScope::symbol_vector_t ifaces)
62{

Callers 2

runMethod · 0.80
runMethod · 0.80

Calls 3

getSymbolsOfTypeMethod · 0.80
findAnnotationMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected