@@ -69,10 +69,6 @@ void ProjectBuildDatabase::initObjects(const nlohmann::json &compileCommandsJson
6969 fs::path jsonFile = compileCommand.at (" file" ).get <std::string>();
7070 fs::path sourceFile = Paths::getCCJsonFileFullPath (jsonFile, directory);
7171
72- if (!Paths::isSourceFile (sourceFile)){
73- continue ;
74- }
75-
7672 std::vector<std::string> jsonArguments;
7773 if (compileCommand.contains (" command" )) {
7874 std::string command = compileCommand.at (" command" );
@@ -87,6 +83,13 @@ void ProjectBuildDatabase::initObjects(const nlohmann::json &compileCommandsJson
8783 objectInfo->command = utbot::CompileCommand (jsonArguments, directory, sourceFile);
8884 objectInfo->command .removeWerror ();
8985 fs::path outputFile = objectInfo->getOutputFile ();
86+
87+ if (!Paths::isSourceFile (sourceFile)) {
88+ LOG_S (INFO) << " Skip non C/C++ file: \" " << sourceFile << " \" " ;
89+ ignoredOutput.insert (outputFile);
90+ continue ;
91+ }
92+
9093 fs::path kleeFilePathTemplate = Paths::createNewDirForFile (sourceFile, projectContext.projectPath ,
9194 Paths::getUTBotFiles (projectContext));
9295 fs::path kleeFile = Paths::addSuffix (kleeFilePathTemplate, " _klee" );
@@ -171,7 +174,7 @@ void ProjectBuildDatabase::initInfo(const nlohmann::json &linkCommandsJson) {
171174 for (nlohmann::json const &jsonFile: linkCommand.at (" files" )) {
172175 auto filename = jsonFile.get <std::string>();
173176 fs::path currentFile = Paths::getCCJsonFileFullPath (filename, command.getDirectory ());
174- if (Paths::skipFile (currentFile)){
177+ if (ignoredOutput. count (currentFile)) {
175178 continue ;
176179 }
177180 targetInfo->addFile (currentFile);
@@ -180,8 +183,8 @@ void ProjectBuildDatabase::initInfo(const nlohmann::json &linkCommandsJson) {
180183 !CollectionUtils::containsKey (objectFileInfos,
181184 relative (currentFile, directory))) {
182185 throw CompilationDatabaseException (
183- " compile_commands.json doesn't contain a command for object file " +
184- currentFile.string ());
186+ " compile_commands.json doesn't contain a command for object file " +
187+ currentFile.string ());
185188 }
186189 if (CollectionUtils::containsKey (objectFileInfos, currentFile)) {
187190 objectFileInfos[currentFile]->linkUnit = output;
0 commit comments