summaryrefslogtreecommitdiff
path: root/ale_linters/cpp
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2018-07-29 19:24:19 +0100
committerw0rp <devw0rp@gmail.com>2018-07-29 19:24:27 +0100
commitac4bac8ea4c5a8d520041ad509e10af454fcfce4 (patch)
tree87a57a03149b62116b8e1b6fa96117e5e3186626 /ale_linters/cpp
parenta7b8cb4fe32b43dbeeadc8cb94f378b4e2112723 (diff)
downloadale-ac4bac8ea4c5a8d520041ad509e10af454fcfce4.zip
Add support for parsing compile_commands.json files for C compilers
Diffstat (limited to 'ale_linters/cpp')
-rw-r--r--ale_linters/cpp/clang.vim8
-rw-r--r--ale_linters/cpp/clangcheck.vim2
-rw-r--r--ale_linters/cpp/clangtidy.vim2
-rw-r--r--ale_linters/cpp/gcc.vim8
4 files changed, 10 insertions, 10 deletions
diff --git a/ale_linters/cpp/clang.vim b/ale_linters/cpp/clang.vim
index e8d96187..4f3c5b6f 100644
--- a/ale_linters/cpp/clang.vim
+++ b/ale_linters/cpp/clang.vim
@@ -14,10 +14,10 @@ function! ale_linters#cpp#clang#GetCommand(buffer, output) abort
" -iquote with the directory the file is in makes #include work for
" headers in the same directory.
return ale#Escape(ale_linters#cpp#clang#GetExecutable(a:buffer))
- \ . ' -S -x c++ -fsyntax-only '
- \ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) . ' '
- \ . l:cflags
- \ . ale#Var(a:buffer, 'cpp_clang_options') . ' -'
+ \ . ' -S -x c++ -fsyntax-only'
+ \ . ' -iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
+ \ . ale#Pad(l:cflags)
+ \ . ale#Pad(ale#Var(a:buffer, 'cpp_clang_options')) . ' -'
endfunction
call ale#linter#Define('cpp', {
diff --git a/ale_linters/cpp/clangcheck.vim b/ale_linters/cpp/clangcheck.vim
index a109d5d3..687991bd 100644
--- a/ale_linters/cpp/clangcheck.vim
+++ b/ale_linters/cpp/clangcheck.vim
@@ -16,7 +16,7 @@ function! ale_linters#cpp#clangcheck#GetCommand(buffer) abort
let l:build_dir = ale#Var(a:buffer, 'c_build_dir')
if empty(l:build_dir)
- let l:build_dir = ale#c#FindCompileCommands(a:buffer)
+ let l:build_dir = ale#path#Dirname(ale#c#FindCompileCommands(a:buffer))
endif
" The extra arguments in the command are used to prevent .plist files from
diff --git a/ale_linters/cpp/clangtidy.vim b/ale_linters/cpp/clangtidy.vim
index 1d5fb77a..d683327f 100644
--- a/ale_linters/cpp/clangtidy.vim
+++ b/ale_linters/cpp/clangtidy.vim
@@ -29,7 +29,7 @@ function! s:GetBuildDirectory(buffer) abort
return l:build_dir
endif
- return ale#c#FindCompileCommands(a:buffer)
+ return ale#path#Dirname(ale#c#FindCompileCommands(a:buffer))
endfunction
function! ale_linters#cpp#clangtidy#GetCommand(buffer) abort
diff --git a/ale_linters/cpp/gcc.vim b/ale_linters/cpp/gcc.vim
index a663eaa3..242e389e 100644
--- a/ale_linters/cpp/gcc.vim
+++ b/ale_linters/cpp/gcc.vim
@@ -14,10 +14,10 @@ function! ale_linters#cpp#gcc#GetCommand(buffer, output) abort
" -iquote with the directory the file is in makes #include work for
" headers in the same directory.
return ale#Escape(ale_linters#cpp#gcc#GetExecutable(a:buffer))
- \ . ' -S -x c++ -fsyntax-only '
- \ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) . ' '
- \ . l:cflags
- \ . ale#Var(a:buffer, 'cpp_gcc_options') . ' -'
+ \ . ' -S -x c++ -fsyntax-only'
+ \ . ' -iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
+ \ . ale#Pad(l:cflags)
+ \ . ale#Pad(ale#Var(a:buffer, 'cpp_gcc_options')) . ' -'
endfunction
call ale#linter#Define('cpp', {