| 64 | m_fileContent(nullptr) {} |
| 65 | |
| 66 | bool ParseLibraryDef::parseLibrariesDefinition() { |
| 67 | FileSystem* const fileSystem = FileSystem::getInstance(); |
| 68 | // Get .map files from command line |
| 69 | std::vector<PathId> libraryMapFiles = |
| 70 | m_commandLineParser->getLibraryMapFiles(); |
| 71 | if (libraryMapFiles.empty()) { |
| 72 | // or scan local dir |
| 73 | for (const PathId& wdId : m_commandLineParser->getWorkingDirs()) { |
| 74 | fileSystem->collect(wdId, ".map", m_symbolTable, libraryMapFiles); |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | // If "work" library is not yet declared from command line, create it |
| 79 | constexpr std::string_view workN = "work"; |
| 80 | m_librarySet->addLibrary(workN, m_symbolTable); |
| 81 | |
| 82 | // Config files are parsed using the library top rule |
| 83 | const PathIdVector& cfgFiles = m_commandLineParser->getConfigFiles(); |
| 84 | libraryMapFiles.insert(libraryMapFiles.end(), cfgFiles.begin(), |
| 85 | cfgFiles.end()); |
| 86 | |
| 87 | for (const PathId& fileId : libraryMapFiles) { |
| 88 | parseLibraryDefinition(fileId); |
| 89 | } |
| 90 | |
| 91 | for (const PathId& fileId : cfgFiles) { |
| 92 | // Register configuration files in "work" library |
| 93 | m_librarySet->getLibrary(fileId); |
| 94 | } |
| 95 | |
| 96 | for (const PathId& fileId : m_commandLineParser->getSourceFiles()) { |
| 97 | // Register files in "work" library |
| 98 | m_librarySet->getLibrary(fileId); |
| 99 | } |
| 100 | |
| 101 | m_librarySet->checkErrors(m_symbolTable, m_errors); |
| 102 | |
| 103 | if (m_commandLineParser->getDebugLibraryDef()) { |
| 104 | m_librarySet->report(std::cout) << std::endl; |
| 105 | } |
| 106 | return true; |
| 107 | } |
| 108 | |
| 109 | bool ParseLibraryDef::parseLibraryDefinition(PathId fileId, Library* lib) { |
| 110 | FileSystem* const fileSystem = FileSystem::getInstance(); |
no test coverage detected