| 1028 | } |
| 1029 | |
| 1030 | bool Compiler::compile() { |
| 1031 | FileSystem* const fileSystem = FileSystem::getInstance(); |
| 1032 | std::string profile; |
| 1033 | Timer tmr; |
| 1034 | Timer tmrTotal; |
| 1035 | // Scan the libraries definition |
| 1036 | if (!parseLibrariesDef_()) return false; |
| 1037 | |
| 1038 | if (m_commandLineParser->profile()) { |
| 1039 | std::string msg = "Scan libraries took " + |
| 1040 | StringUtils::to_string(tmr.elapsed_rounded()) + "s\n"; |
| 1041 | std::cout << msg << std::endl; |
| 1042 | profile += msg; |
| 1043 | tmr.reset(); |
| 1044 | } |
| 1045 | |
| 1046 | // Preprocess |
| 1047 | ppinit_(); |
| 1048 | createMultiProcessPreProcessor_(); |
| 1049 | if (!compileFileSet_(CompileSourceFile::Preprocess, |
| 1050 | m_commandLineParser->fileunit(), m_compilers)) { |
| 1051 | return false; |
| 1052 | } |
| 1053 | // Single thread post Preprocess |
| 1054 | if (!compileFileSet_(CompileSourceFile::PostPreprocess, false, m_compilers)) { |
| 1055 | return false; |
| 1056 | } |
| 1057 | |
| 1058 | if (m_commandLineParser->profile()) { |
| 1059 | std::string msg = "Preprocessing took " + |
| 1060 | StringUtils::to_string(tmr.elapsed_rounded()) + "s\n"; |
| 1061 | std::cout << msg << std::endl; |
| 1062 | for (const CompileSourceFile* compiler : m_compilers) { |
| 1063 | msg += compiler->getPreprocessor()->getProfileInfo(); |
| 1064 | } |
| 1065 | std::cout << msg << std::endl; |
| 1066 | profile += msg; |
| 1067 | tmr.reset(); |
| 1068 | } |
| 1069 | |
| 1070 | // Parse |
| 1071 | bool parserInitialized = false; |
| 1072 | if (m_commandLineParser->parse() || m_commandLineParser->pythonListener() || |
| 1073 | m_commandLineParser->pythonEvalScriptPerFile() || |
| 1074 | m_commandLineParser->pythonEvalScript()) { |
| 1075 | parseinit_(); |
| 1076 | createFileList_(); |
| 1077 | createMultiProcessParser_(); |
| 1078 | parserInitialized = true; |
| 1079 | if (!compileFileSet_(CompileSourceFile::Parse, true, m_compilers)) { |
| 1080 | return false; // Small files and large file chunks |
| 1081 | } |
| 1082 | if (!compileFileSet_(CompileSourceFile::Parse, true, |
| 1083 | m_compilersParentFiles)) { |
| 1084 | return false; // Recombine chunks |
| 1085 | } |
| 1086 | } else { |
| 1087 | createFileList_(); |
no test coverage detected