Merge pull request #3551 from fenuks/bugfix-3506
Fix clang-tidy ignoring compile-commands.json
This commit is contained in:
commit
33f2f8ddcd
2 changed files with 6 additions and 5 deletions
|
@ -23,11 +23,13 @@ function! ale_linters#cpp#clangtidy#GetCommand(buffer, output) abort
|
||||||
let l:options = ale#Var(a:buffer, 'cpp_clangtidy_options')
|
let l:options = ale#Var(a:buffer, 'cpp_clangtidy_options')
|
||||||
let l:cflags = ale#c#GetCFlags(a:buffer, a:output)
|
let l:cflags = ale#c#GetCFlags(a:buffer, a:output)
|
||||||
let l:options .= !empty(l:options) ? ale#Pad(l:cflags) : l:cflags
|
let l:options .= !empty(l:options) ? ale#Pad(l:cflags) : l:cflags
|
||||||
endif
|
|
||||||
|
|
||||||
" Tell clang-tidy a .h header with a C++ filetype in Vim is a C++ file.
|
" Tell clang-tidy a .h header with a C++ filetype in Vim is a C++ file
|
||||||
if expand('#' . a:buffer) =~# '\.h$'
|
" only when compile-commands.json file is not there. Adding these
|
||||||
let l:options .= !empty(l:options) ? ' -x c++' : '-x c++'
|
" flags makes clang-tidy completely ignore compile commmands.
|
||||||
|
if expand('#' . a:buffer) =~# '\.h$'
|
||||||
|
let l:options .= !empty(l:options) ? ' -x c++' : '-x c++'
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Get the options to pass directly to clang-tidy
|
" Get the options to pass directly to clang-tidy
|
||||||
|
|
|
@ -68,7 +68,6 @@ Execute(The build directory should be used for header files):
|
||||||
\ ale#Escape('clang-tidy')
|
\ ale#Escape('clang-tidy')
|
||||||
\ . ' -checks=' . ale#Escape('*') . ' %s'
|
\ . ' -checks=' . ale#Escape('*') . ' %s'
|
||||||
\ . ' -p ' . ale#Escape('/foo/bar')
|
\ . ' -p ' . ale#Escape('/foo/bar')
|
||||||
\ . ' -- -x c++'
|
|
||||||
|
|
||||||
call ale#test#SetFilename('test.hpp')
|
call ale#test#SetFilename('test.hpp')
|
||||||
|
|
||||||
|
|
Reference in a new issue