From 05f3e24c74dc3f96d9da85fdaf186f94554af6ff Mon Sep 17 00:00:00 2001 From: intjftw Date: Wed, 16 Feb 2022 12:55:18 +0100 Subject: [PATCH] Fix according to change requests. --- plugins/cpp/parser/src/cppparser.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/plugins/cpp/parser/src/cppparser.cpp b/plugins/cpp/parser/src/cppparser.cpp index 5e2060d5c..3730cbdcc 100644 --- a/plugins/cpp/parser/src/cppparser.cpp +++ b/plugins/cpp/parser/src/cppparser.cpp @@ -748,20 +748,16 @@ bool CppParser::parseByJson( //--- Read the compilation commands compile database ---// - std::vector tempCompileCommands = + std::vector compileCommands = compDb->getAllCompileCommands(); - std::vector compileCommands; - const std::vector cppExts{ - ".c", ".cc", ".cpp", ".cxx", ".o", ".so", ".a"}; - - std::copy_if(tempCompileCommands.begin(), tempCompileCommands.end(), - std::back_inserter(compileCommands), [&](clang::tooling::CompileCommand c) - { - auto iter = std::find(cppExts.begin(), cppExts.end(), - fs::extension(c.Filename)); - return iter != cppExts.end(); - }); + compileCommands.erase( + std::remove_if(compileCommands.begin(), compileCommands.end(), + [&](const clang::tooling::CompileCommand& c) + { + return !isSourceFile(c.Filename); + }), + compileCommands.end()); std::size_t numCompileCommands = compileCommands.size();