summaryrefslogtreecommitdiff
path: root/ale_linters/cpp/clangtidy.vim
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2020-08-10 02:33:50 +0100
committerw0rp <devw0rp@gmail.com>2020-08-10 02:33:50 +0100
commitd3f410b6f723603bb3bcd121758868deae37ba94 (patch)
tree33c7b78a587c356a6e659713d4431abb063ce1bb /ale_linters/cpp/clangtidy.vim
parent2237f9b4623f0fc5c6b4b70e47171a94b6a30bd4 (diff)
downloadale-d3f410b6f723603bb3bcd121758868deae37ba94.zip
Fix #1608 - Treat .h as C++ files for C++ clang-tidy
Diffstat (limited to 'ale_linters/cpp/clangtidy.vim')
-rw-r--r--ale_linters/cpp/clangtidy.vim5
1 files changed, 5 insertions, 0 deletions
diff --git a/ale_linters/cpp/clangtidy.vim b/ale_linters/cpp/clangtidy.vim
index 191b7b07..5e062d86 100644
--- a/ale_linters/cpp/clangtidy.vim
+++ b/ale_linters/cpp/clangtidy.vim
@@ -25,6 +25,11 @@ function! ale_linters#cpp#clangtidy#GetCommand(buffer, output) abort
let l:options .= !empty(l:options) ? ale#Pad(l:cflags) : l:cflags
endif
+ " Tell clang-tidy a .h header with a C++ filetype in Vim is a C++ file.
+ if expand('#' . a:buffer) =~# '\.h$'
+ let l:options .= !empty(l:options) ? ' -x c++' : '-x c++'
+ endif
+
" Get the options to pass directly to clang-tidy
let l:extra_options = ale#Var(a:buffer, 'cpp_clangtidy_extra_options')