Skip to content

Commit

Permalink
Fix according to change requests.
Browse files Browse the repository at this point in the history
  • Loading branch information
intjftw committed Feb 16, 2022
1 parent 75d3220 commit 05f3e24
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions plugins/cpp/parser/src/cppparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -748,20 +748,16 @@ bool CppParser::parseByJson(

//--- Read the compilation commands compile database ---//

std::vector<clang::tooling::CompileCommand> tempCompileCommands =
std::vector<clang::tooling::CompileCommand> compileCommands =
compDb->getAllCompileCommands();
std::vector<clang::tooling::CompileCommand> compileCommands;

const std::vector<std::string> 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();

Expand Down

0 comments on commit 05f3e24

Please sign in to comment.