diff --git a/src/source_clang.cc b/src/source_clang.cc index 7298c38..7dd2924 100644 --- a/src/source_clang.cc +++ b/src/source_clang.cc @@ -235,10 +235,11 @@ std::vector Source::ClangViewParse::get_compilation_commands() { #endif } arguments.emplace_back("-fretain-comments-from-system-headers"); - auto file_path_extension=file_path.extension(); - if(file_path_extension==".h" || //TODO: temporary fix for .h-files (parse as c++) - file_path_extension==".tcc") + + if(file_path.extension()==".h" || //TODO: temporary fix for .h-files (parse as c++) + (language && (language->get_id()=="cpp" || language->get_id()=="cpphdr"))) arguments.emplace_back("-xc++"); + if(language && (language->get_id()=="chdr" || language->get_id()=="cpphdr")) arguments.emplace_back("-Wno-pragma-once-outside-header");