Skip to content

Commit 05f3e24

Browse files
committed
Fix according to change requests.
1 parent 75d3220 commit 05f3e24

1 file changed

Lines changed: 8 additions & 12 deletions

File tree

plugins/cpp/parser/src/cppparser.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -748,20 +748,16 @@ bool CppParser::parseByJson(
748748

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

751-
std::vector<clang::tooling::CompileCommand> tempCompileCommands =
751+
std::vector<clang::tooling::CompileCommand> compileCommands =
752752
compDb->getAllCompileCommands();
753-
std::vector<clang::tooling::CompileCommand> compileCommands;
754753

755-
const std::vector<std::string> cppExts{
756-
".c", ".cc", ".cpp", ".cxx", ".o", ".so", ".a"};
757-
758-
std::copy_if(tempCompileCommands.begin(), tempCompileCommands.end(),
759-
std::back_inserter(compileCommands), [&](clang::tooling::CompileCommand c)
760-
{
761-
auto iter = std::find(cppExts.begin(), cppExts.end(),
762-
fs::extension(c.Filename));
763-
return iter != cppExts.end();
764-
});
754+
compileCommands.erase(
755+
std::remove_if(compileCommands.begin(), compileCommands.end(),
756+
[&](const clang::tooling::CompileCommand& c)
757+
{
758+
return !isSourceFile(c.Filename);
759+
}),
760+
compileCommands.end());
765761

766762
std::size_t numCompileCommands = compileCommands.size();
767763

0 commit comments

Comments
 (0)