summaryrefslogtreecommitdiff
path: root/ale_linters/cpp/cc.vim
diff options
context:
space:
mode:
Diffstat (limited to 'ale_linters/cpp/cc.vim')
-rw-r--r--ale_linters/cpp/cc.vim5
1 files changed, 4 insertions, 1 deletions
diff --git a/ale_linters/cpp/cc.vim b/ale_linters/cpp/cc.vim
index ffb8f068..f8021531 100644
--- a/ale_linters/cpp/cc.vim
+++ b/ale_linters/cpp/cc.vim
@@ -3,6 +3,7 @@
call ale#Set('cpp_cc_executable', '<auto>')
call ale#Set('cpp_cc_options', '-std=c++14 -Wall')
+call ale#Set('cpp_cc_header_exts', ['h', 'hpp'])
function! ale_linters#cpp#cc#GetExecutable(buffer) abort
let l:executable = ale#Var(a:buffer, 'cpp_cc_executable')
@@ -22,6 +23,8 @@ endfunction
function! ale_linters#cpp#cc#GetCommand(buffer, output) abort
let l:cflags = ale#c#GetCFlags(a:buffer, a:output)
let l:ale_flags = ale#Var(a:buffer, 'cpp_cc_options')
+ let l:header_exts = ale#Var(a:buffer, 'cpp_cc_header_exts')
+ let l:lang_flag = ale#c#GetLanguageFlag(a:buffer, l:header_exts, 'c++')
if l:cflags =~# '-std='
let l:ale_flags = substitute(
@@ -36,7 +39,7 @@ function! ale_linters#cpp#cc#GetCommand(buffer, output) abort
"
" `-o /dev/null` or `-o null` is needed to catch all errors,
" -fsyntax-only doesn't catch everything.
- return '%e -S -x c++'
+ return '%e -S -x ' . l:lang_flag
\ . ' -o ' . g:ale#util#nul_file
\ . ' -iquote %s:h'
\ . ale#Pad(l:cflags)