summaryrefslogtreecommitdiff
path: root/ale_linters/c/clang.vim
diff options
context:
space:
mode:
authorroel0 <roel.postelmans@altran.com>2018-03-20 21:49:31 +0100
committerroel0 <roel.postelmans@altran.com>2018-03-20 21:49:31 +0100
commit18d0aeb1a0cca2b749c3d2232f853fcaddcdb56b (patch)
treea6462ea0e55dd59f12e247ce39fc35b1861895d7 /ale_linters/c/clang.vim
parent38953c46266706541569f6f89c19ef8af59d36f5 (diff)
downloadale-18d0aeb1a0cca2b749c3d2232f853fcaddcdb56b.zip
* Shell commands should by called async with the help of a command chain
* The makefile parser unit test should only test the cflag parser itself #1167
Diffstat (limited to 'ale_linters/c/clang.vim')
-rw-r--r--ale_linters/c/clang.vim14
1 files changed, 8 insertions, 6 deletions
diff --git a/ale_linters/c/clang.vim b/ale_linters/c/clang.vim
index 366cf2d2..01e92476 100644
--- a/ale_linters/c/clang.vim
+++ b/ale_linters/c/clang.vim
@@ -3,16 +3,15 @@
call ale#Set('c_clang_executable', 'clang')
call ale#Set('c_clang_options', '-std=c11 -Wall')
-call ale#Set('c_clang_parse_makefile', 0)
function! ale_linters#c#clang#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'c_clang_executable')
endfunction
-function! ale_linters#c#clang#GetCommand(buffer) abort
-let l:cflags = []
- if g:ale_c_clang_parse_makefile
- let l:cflags = join(ale#c#ParseMakefile(a:buffer), ' ')
+function! ale_linters#c#clang#GetCommand(buffer, output) abort
+ let l:cflags = []
+ if !empty(a:output)
+ let l:cflags = join(ale#c#ParseMakefile(a:buffer, join(a:output, '\n')), ' ')
endif
if empty(l:cflags)
let l:cflags = ale#c#IncludeOptions(ale#c#FindLocalHeaderPaths(a:buffer))
@@ -33,6 +32,9 @@ call ale#linter#Define('c', {
\ 'name': 'clang',
\ 'output_stream': 'stderr',
\ 'executable_callback': 'ale_linters#c#clang#GetExecutable',
-\ 'command_callback': 'ale_linters#c#clang#GetCommand',
+\ 'command_chain': [
+\ {'callback': 'ale#c#ParseMakefile', 'output_stream': 'stdout'},
+\ {'callback': 'ale_linters#c#clang#GetCommand'}
+\ ],
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
\})