Merge pull request #1256 from jonatanolofsson/master

Fix #1255: Move extra clang-check args to before user options
This commit is contained in:
w0rp 2018-01-12 12:09:30 +00:00 committed by w0rp
parent 2381b7afe8
commit 80e973a29e
2 changed files with 6 additions and 5 deletions

View File

@ -24,9 +24,9 @@ function! ale_linters#cpp#clangcheck#GetCommand(buffer) abort
" detected. " detected.
return ale#Escape(ale_linters#cpp#clangcheck#GetExecutable(a:buffer)) return ale#Escape(ale_linters#cpp#clangcheck#GetExecutable(a:buffer))
\ . ' -analyze %s' \ . ' -analyze %s'
\ . (empty(l:build_dir) ? ' -extra-arg -Xclang -extra-arg -analyzer-output=text' : '')
\ . (!empty(l:user_options) ? ' ' . l:user_options : '') \ . (!empty(l:user_options) ? ' ' . l:user_options : '')
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '') \ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
\ . (empty(l:build_dir) ? ' -extra-arg -Xanalyzer -extra-arg -analyzer-output=text' : '')
endfunction endfunction
call ale#linter#Define('cpp', { call ale#linter#Define('cpp', {

View File

@ -28,7 +28,7 @@ Execute(The executable should be used in the command):
AssertEqual AssertEqual
\ ale#Escape('clang-check') \ ale#Escape('clang-check')
\ . ' -analyze %s' \ . ' -analyze %s'
\ . ' -extra-arg -Xanalyzer -extra-arg -analyzer-output=text', \ . ' -extra-arg -Xclang -extra-arg -analyzer-output=text',
\ ale_linters#cpp#clangcheck#GetCommand(bufnr('')) \ ale_linters#cpp#clangcheck#GetCommand(bufnr(''))
let b:ale_cpp_clangcheck_executable = 'foobar' let b:ale_cpp_clangcheck_executable = 'foobar'
@ -38,7 +38,7 @@ Execute(The executable should be used in the command):
AssertEqual AssertEqual
\ ale#Escape('foobar') \ ale#Escape('foobar')
\ . ' -analyze %s' \ . ' -analyze %s'
\ . ' -extra-arg -Xanalyzer -extra-arg -analyzer-output=text', \ . ' -extra-arg -Xclang -extra-arg -analyzer-output=text',
\ ale_linters#cpp#clangcheck#GetCommand(bufnr('')) \ ale_linters#cpp#clangcheck#GetCommand(bufnr(''))
Execute(The options should be configurable): Execute(The options should be configurable):
@ -46,8 +46,9 @@ Execute(The options should be configurable):
AssertEqual AssertEqual
\ ale#Escape('clang-check') \ ale#Escape('clang-check')
\ . ' -analyze %s --something' \ . ' -analyze %s'
\ . ' -extra-arg -Xanalyzer -extra-arg -analyzer-output=text', \ . ' -extra-arg -Xclang -extra-arg -analyzer-output=text'
\ . ' --something',
\ ale_linters#cpp#clangcheck#GetCommand(bufnr('')) \ ale_linters#cpp#clangcheck#GetCommand(bufnr(''))
Execute(The build directory should be used when set): Execute(The build directory should be used when set):