Skip to content

Commit 452436b

Browse files
committed
skip unknown input files in compile_commands
1 parent f64f698 commit 452436b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

source/AST/AbsoluteCompilationDatabase.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@
2727
namespace clang {
2828
namespace mrdox {
2929

30+
static
31+
bool
32+
isCXXSrcFile(
33+
std::string_view filename)
34+
{
35+
return driver::types::isCXX(
36+
driver::types::lookupTypeForExtension(
37+
llvm::sys::path::extension(filename).drop_front()));
38+
}
39+
3040
template<typename... Opts>
3141
static
3242
bool
@@ -219,6 +229,10 @@ AbsoluteCompilationDatabase(
219229
cmd.Filename = static_cast<std::string>(temp);
220230
}
221231

232+
// non-C++ input file; skip
233+
if(! isCXXSrcFile(cmd.Filename))
234+
continue;
235+
222236
std::size_t i = AllCommands_.size();
223237
auto result = IndexByFile_.try_emplace(cmd.Filename, i);
224238
AllCommands_.emplace_back(std::move(cmd));

0 commit comments

Comments
 (0)