Create file list after preprocessing Signed-off-by: Alain <alainmarcel@yahoo.com>
diff --git a/src/SourceCompile/Compiler.cpp b/src/SourceCompile/Compiler.cpp index f965a4c..9a5d4de 100644 --- a/src/SourceCompile/Compiler.cpp +++ b/src/SourceCompile/Compiler.cpp
@@ -47,6 +47,8 @@ #include <mutex> #include <thread> #include <vector> +#include <iostream> +#include <fstream> using namespace SURELOG; Compiler::Compiler(CommandLineParser* commandLineParser, ErrorContainer* errors, @@ -229,12 +231,38 @@ return true; } +bool Compiler::createFileList_() +{ + if (m_commandLineParser->writePpOutput() || + (m_commandLineParser->writePpOutputFileId() != 0)) { + SymbolTable* symbolTable = getSymbolTable(); + const std::string& directory = + symbolTable->getSymbol(m_commandLineParser->getFullCompileDir()); + std::ofstream ofs; + std::string fileList = directory + "/file.lst"; + ofs.open(fileList); + if (ofs.good()) { + unsigned int size = m_compilers.size(); + for (unsigned int i = 0; i < size; i++) { + std::string fileName = m_compilers[i]->getSymbolTable()->getSymbol( + m_compilers[i]->getPpOutputFileId()); + fileName = StringUtils::replaceAll(fileName, "//", "/"); + ofs << fileName << std::flush << std::endl; + } + ofs.close(); + } else { + std::cout << "Could not create filelist: " << fileList << std::endl; + } + } +} + + bool Compiler::parseinit_() { Precompiled* prec = Precompiled::getSingleton(); // Single out the large files. // Small files are going to be scheduled in multiple threads based on size. // Large files are going to be compiled in a different batch in multithread - + if (!m_commandLineParser->fileunit()) { unsigned int size = m_symbolTables.size(); for (unsigned int i = 0; i < size; i++) { @@ -564,7 +592,7 @@ profile += msg; tmr.reset(); } - + createFileList_(); // Parse bool parserInitialized = false; if (m_commandLineParser->parse() || m_commandLineParser->pythonListener() ||
diff --git a/src/SourceCompile/Compiler.h b/src/SourceCompile/Compiler.h index 80c182b..3e3cbd8 100644 --- a/src/SourceCompile/Compiler.h +++ b/src/SourceCompile/Compiler.h
@@ -74,6 +74,7 @@ bool parseLibrariesDef_(); bool ppinit_(); + bool createFileList_(); bool parseinit_(); bool pythoninit_(); bool compileFileSet_(CompileSourceFile::Action action, bool allowMultithread,