2017-05-19 16:41:57 +00:00
|
|
|
" Author: Bang Lee <https://github.com/Qusic>
|
|
|
|
" Description: clang linter for objc files
|
|
|
|
|
|
|
|
" Set this option to change the Clang options for warnings for ObjC.
|
|
|
|
if !exists('g:ale_objc_clang_options')
|
|
|
|
let g:ale_objc_clang_options = '-std=c11 -Wall'
|
|
|
|
endif
|
|
|
|
|
|
|
|
function! ale_linters#objc#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 '
|
2020-08-28 18:50:36 +00:00
|
|
|
\ . '-iquote %s:h'
|
2017-05-19 16:41:57 +00:00
|
|
|
\ . ' ' . ale#Var(a:buffer, 'objc_clang_options') . ' -'
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
call ale#linter#Define('objc', {
|
|
|
|
\ 'name': 'clang',
|
|
|
|
\ 'output_stream': 'stderr',
|
|
|
|
\ 'executable': 'clang',
|
2019-02-22 18:05:04 +00:00
|
|
|
\ 'command': function('ale_linters#objc#clang#GetCommand'),
|
2018-07-30 19:09:43 +00:00
|
|
|
\ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes',
|
2017-05-19 16:41:57 +00:00
|
|
|
\})
|