| 2793 | } |
| 2794 | |
| 2795 | void DesignElaboration::createFileList_() { |
| 2796 | CommandLineParser* cmdLine = |
| 2797 | m_compileDesign->getCompiler()->getCommandLineParser(); |
| 2798 | if (!(cmdLine->writePpOutput() || cmdLine->writePpOutputFileId())) { |
| 2799 | return; |
| 2800 | } |
| 2801 | |
| 2802 | FileSystem* const fileSystem = FileSystem::getInstance(); |
| 2803 | |
| 2804 | Design* design = m_compileDesign->getCompiler()->getDesign(); |
| 2805 | std::queue<ModuleInstance*> queue; |
| 2806 | PathIdSet filePathIds; |
| 2807 | for (const auto& pack : design->getPackageDefinitions()) { |
| 2808 | if (!pack.second->getFileContents().empty()) { |
| 2809 | if (pack.second->getFileContents()[0] != nullptr) |
| 2810 | filePathIds.emplace(pack.second->getFileContents()[0]->getFileId()); |
| 2811 | } |
| 2812 | } |
| 2813 | |
| 2814 | for (auto instance : design->getTopLevelModuleInstances()) { |
| 2815 | queue.push(instance); |
| 2816 | } |
| 2817 | |
| 2818 | while (!queue.empty()) { |
| 2819 | ModuleInstance* current = queue.front(); |
| 2820 | DesignComponent* def = current->getDefinition(); |
| 2821 | queue.pop(); |
| 2822 | if (current == nullptr) continue; |
| 2823 | for (ModuleInstance* sub : current->getAllSubInstances()) { |
| 2824 | queue.push(sub); |
| 2825 | } |
| 2826 | const FileContent* fC = current->getFileContent(); |
| 2827 | if (fC) { |
| 2828 | filePathIds.emplace(fC->getFileId()); |
| 2829 | } |
| 2830 | if (def) { |
| 2831 | for (auto f : def->getFileContents()) { |
| 2832 | if (f) { |
| 2833 | filePathIds.emplace(f->getFileId()); |
| 2834 | } |
| 2835 | } |
| 2836 | } |
| 2837 | } |
| 2838 | |
| 2839 | PathId fileId = fileSystem->getChild( |
| 2840 | cmdLine->getCompileDirId(), "file_elab.lst", cmdLine->getSymbolTable()); |
| 2841 | std::ostream& ofs = fileSystem->openForWrite(fileId); |
| 2842 | if (ofs.good()) { |
| 2843 | const Compiler::PPFileMap& ppFileName = |
| 2844 | m_compileDesign->getCompiler()->getPPFileMap(); |
| 2845 | for (const auto& fileId : filePathIds) { |
| 2846 | auto itr = ppFileName.find(fileId); |
| 2847 | if (itr != ppFileName.end()) { |
| 2848 | for (const auto& fId : itr->second) { |
| 2849 | ofs << fileSystem->toPath(fId) << std::flush << std::endl; |
| 2850 | } |
| 2851 | } |
| 2852 | } |
nothing calls this directly
no test coverage detected