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

Method getOutputName

erpcgen/src/Generator.cpp:572–607  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

570}
571
572string Generator::getOutputName(Symbol *symbol, bool check)
573{
574 string annName;
575 uint32_t line;
576 Annotation *ann = findAnnotation(symbol, NAME_ANNOTATION);
577 if (ann)
578 {
579 annName = ann->getValueObject()->toString();
580 if (annName.empty())
581 {
582 throw semantic_error(format_string("Missing value for annotation named @%s on line '%d'", NAME_ANNOTATION,
583 ann->getLocation().m_firstLine));
584 }
585 Log::warning(
586 "line %d: Be careful when @%s annotation is used. This can cause compile issue. See documentation.\n",
587 ann->getLocation().m_firstLine, NAME_ANNOTATION);
588 line = ann->getLocation().m_firstLine;
589 }
590 else
591 {
592 annName = symbol->getName();
593 line = symbol->getFirstLine();
594 }
595
596 if (check)
597 {
598 auto it = reserverdWords.find(annName);
599 if (it != reserverdWords.end())
600 {
601 throw semantic_error(format_string(
602 "line %d: Wrong symbol name '%s'. Cannot use program language reserved words.", line, annName.c_str()));
603 }
604 }
605
606 return annName;
607}
608
609Annotation::program_lang_t Generator::getAnnotationLang()
610{

Callers

nothing calls this directly

Calls 8

semantic_errorClass · 0.85
format_stringFunction · 0.85
getValueObjectMethod · 0.80
toStringMethod · 0.45
emptyMethod · 0.45
getNameMethod · 0.45
getFirstLineMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected