summaryrefslogtreecommitdiff
path: root/ale_linters/objcpp/clang.vim
blob: 35a40c6f302c0ddf07ff01a173b3ea0899f8251b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
" Author: Bang Lee <https://github.com/Qusic>
" Description: clang linter for objcpp files

" Set this option to change the Clang options for warnings for ObjCPP.
if !exists('g:ale_objcpp_clang_options')
    let g:ale_objcpp_clang_options = '-std=c++14 -Wall'
endif

function! ale_linters#objcpp#clang#GetCommand(buffer) abort
    " -iquote with the directory the file is in makes #include work for
    "  headers in the same directory.
    return 'clang++ -S -x objective-c++ -fsyntax-only '
    \   . '-iquote %s:h'
    \   . ' ' . ale#Var(a:buffer, 'objcpp_clang_options') . ' -'
endfunction

call ale#linter#Define('objcpp', {
\   'name': 'clang',
\   'output_stream': 'stderr',
\   'executable': 'clang++',
\   'command': function('ale_linters#objcpp#clang#GetCommand'),
\   'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes',
\})