| 763 | } |
| 764 | |
| 765 | bool Compiler::parseinit_() { |
| 766 | Precompiled* const prec = Precompiled::getSingleton(); |
| 767 | |
| 768 | // Single out the large files. |
| 769 | // Small files are going to be scheduled in multiple threads based on size. |
| 770 | // Large files are going to be compiled in a different batch in multithread |
| 771 | |
| 772 | if (!m_commandLineParser->fileunit()) { |
| 773 | DeleteContainerPointersAndClear(&m_symbolTables); |
| 774 | DeleteContainerPointersAndClear(&m_errorContainers); |
| 775 | } |
| 776 | |
| 777 | std::vector<CompileSourceFile*> tmp_compilers; |
| 778 | for (CompileSourceFile* const compiler : m_compilers) { |
| 779 | const uint32_t nbThreads = |
| 780 | prec->isFilePrecompiled(compiler->getPpOutputFileId(), |
| 781 | compiler->getSymbolTable()) |
| 782 | ? 0 |
| 783 | : m_commandLineParser->getNbMaxTreads(); |
| 784 | |
| 785 | const int32_t effectiveNbThreads = calculateEffectiveThreads(nbThreads); |
| 786 | |
| 787 | AnalyzeFile* const fileAnalyzer = new AnalyzeFile( |
| 788 | m_commandLineParser, m_design, compiler->getPpOutputFileId(), |
| 789 | compiler->getFileId(), effectiveNbThreads, m_text); |
| 790 | fileAnalyzer->analyze(); |
| 791 | compiler->setFileAnalyzer(fileAnalyzer); |
| 792 | if (fileAnalyzer->getSplitFiles().size() > 1) { |
| 793 | // Schedule parent |
| 794 | m_compilersParentFiles.push_back(compiler); |
| 795 | compiler->initParser(); |
| 796 | |
| 797 | if (!m_commandLineParser->fileunit()) { |
| 798 | SymbolTable* symbols = |
| 799 | m_commandLineParser->getSymbolTable()->CreateSnapshot(); |
| 800 | m_symbolTables.push_back(symbols); |
| 801 | compiler->setSymbolTable(symbols); |
| 802 | // fileContent->setSymbolTable(symbols); |
| 803 | ErrorContainer* errors = |
| 804 | new ErrorContainer(symbols, m_errors->getLogListener()); |
| 805 | m_errorContainers.push_back(errors); |
| 806 | errors->registerCmdLine(m_commandLineParser); |
| 807 | compiler->setErrorContainer(errors); |
| 808 | } |
| 809 | |
| 810 | compiler->getParser()->setFileContent(new FileContent( |
| 811 | compiler->getParser()->getFileId(0), |
| 812 | compiler->getParser()->getLibrary(), compiler->getSymbolTable(), |
| 813 | compiler->getErrorContainer(), nullptr, BadPathId)); |
| 814 | |
| 815 | int32_t j = 0; |
| 816 | for (const auto& ppId : fileAnalyzer->getSplitFiles()) { |
| 817 | SymbolTable* symbols = |
| 818 | m_commandLineParser->getSymbolTable()->CreateSnapshot(); |
| 819 | m_symbolTables.push_back(symbols); |
| 820 | CompileSourceFile* chunkCompiler = new CompileSourceFile( |
| 821 | compiler, ppId, fileAnalyzer->getLineOffsets()[j]); |
| 822 | // Schedule chunk |
nothing calls this directly
no test coverage detected