| 70 | // commented out as it is a work in progress |
| 71 | |
| 72 | bool UhdmChecker::registerFile(const FileContent* fC, |
| 73 | std::set<std::string_view>& moduleNames) { |
| 74 | const VObject& current = fC->Object(NodeId(fC->getSize() - 2)); |
| 75 | NodeId id = current.m_child; |
| 76 | PathId fileId = fC->getFileId(); |
| 77 | if (!id) id = current.m_sibling; |
| 78 | if (!id) return false; |
| 79 | std::stack<NodeId> stack; |
| 80 | stack.push(id); |
| 81 | |
| 82 | FileNodeCoverMap::iterator fileItr = fileNodeCoverMap.find(fC); |
| 83 | if (fileItr == fileNodeCoverMap.end()) { |
| 84 | RangesMap uhdmCover; |
| 85 | fileNodeCoverMap.emplace(fC, uhdmCover); |
| 86 | fileItr = fileNodeCoverMap.find(fC); |
| 87 | } |
| 88 | RangesMap& uhdmCover = (*fileItr).second; |
| 89 | bool skipModule = false; |
| 90 | NodeId endModuleNode; |
| 91 | while (!stack.empty()) { |
| 92 | id = stack.top(); |
| 93 | stack.pop(); |
| 94 | const VObject& current = fC->Object(id); |
| 95 | bool skip = false; |
| 96 | VObjectType type = current.m_type; |
| 97 | if (type == VObjectType::paEND) skip = true; |
| 98 | |
| 99 | // Skip macro expansion which resides in another file (header) |
| 100 | PathId fid = fC->getFileId(id); |
| 101 | if (fid != fileId) { |
| 102 | if (current.m_sibling) stack.push(current.m_sibling); |
| 103 | continue; |
| 104 | } |
| 105 | |
| 106 | if (type == VObjectType::paModule_declaration) { |
| 107 | NodeId stId = fC->sl_collect(id, VObjectType::slStringConst, |
| 108 | VObjectType::paAttr_spec); |
| 109 | if (stId) { |
| 110 | std::string name = |
| 111 | StrCat(fC->getLibrary()->getName(), "@", fC->SymName(stId)); |
| 112 | if (moduleNames.find(name) == moduleNames.end()) { |
| 113 | skipModule = true; |
| 114 | } |
| 115 | } |
| 116 | endModuleNode = fC->Parent(id); |
| 117 | endModuleNode = fC->Sibling(endModuleNode); |
| 118 | } |
| 119 | if (type == VObjectType::paDescription || type == VObjectType::paENDCASE || |
| 120 | type == VObjectType::paENDTASK || type == VObjectType::paENDFUNCTION || |
| 121 | type == VObjectType::paENDMODULE || |
| 122 | type == VObjectType::paENDINTERFACE || |
| 123 | type == VObjectType::paENDPACKAGE || |
| 124 | type == VObjectType::paENDCLOCKING || type == VObjectType::paENDCLASS || |
| 125 | type == VObjectType::paENDGENERATE || |
| 126 | type == VObjectType::paENDCONFIG || |
| 127 | type == VObjectType::paEndcelldefine_directive || |
| 128 | type == VObjectType::paENDGROUP || |
| 129 | type == VObjectType::paENDPRIMITIVE || |
nothing calls this directly
no test coverage detected