Added builddir option to clang-tidy to point to json folder (#688)

Detect compille_commands.json files for clang-tidy
This commit is contained in:
Gagbo
2017-06-24 13:38:16 +02:00
committed by w0rp
parent 026c4f304e
commit e98560a349
9 changed files with 99 additions and 5 deletions

24
autoload/ale/c.vim Normal file
View File

@@ -0,0 +1,24 @@
" Author: gagbo <gagbobada@gmail.com>
" Description: Functions for integrating with C-family linters.
let g:ale_c_build_dir_names = get(g:, 'ale_c_build_dir_names', [
\ 'build',
\ 'bin',
\])
" Given a buffer number, find the build subdirectory with compile commands
" The subdirectory is returned without the trailing /
function! ale#c#FindCompileCommands(buffer) abort
for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h'))
for l:dirname in ale#Var(a:buffer, 'c_build_dir_names')
let l:c_build_dir = l:path . '/' . l:dirname
if filereadable(l:c_build_dir . '/compile_commands.json')
return l:c_build_dir
endif
endfor
endfor
return ''
endfunction