From 2fe8f1cb46e1952b177a9872ddaddb779eb0859a Mon Sep 17 00:00:00 2001 From: eidheim Date: Wed, 28 Sep 2022 19:42:04 +0200 Subject: [PATCH] Fixed llvm 15 crash when trying to parse C header as C++ header in a C project --- src/compile_commands.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compile_commands.cpp b/src/compile_commands.cpp index b13494d..c9b1205 100644 --- a/src/compile_commands.cpp +++ b/src/compile_commands.cpp @@ -232,7 +232,7 @@ std::vector CompileCommands::get_arguments(const boost::filesystem: arguments.emplace_back("-finclude-default-header"); arguments.emplace_back("-Wno-gcc-compat"); } - else if(is_header) + else if(is_header && extension != ".h") // libclang crashes if it tries to parse .h files as C++ file in a C project arguments.emplace_back("-xc++"); if(!build_path.empty()) {