diff options
author | fenuks <fenuks@protonmail.com> | 2018-08-24 10:52:33 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2018-08-24 10:52:33 +0100 |
commit | 9d7c48038cbbc696fe2d1e9c4b2d9eff2dd726c3 (patch) | |
tree | d034973b8a46a11c883bfbd775298e5162e80c46 /autoload | |
parent | 08d141edfb9cacea2ddba347581e670f4a04caa7 (diff) | |
download | ale-9d7c48038cbbc696fe2d1e9c4b2d9eff2dd726c3.zip |
Add clazy as cpp linter
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/c.vim | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/autoload/ale/c.vim b/autoload/ale/c.vim index ae428692..5ec62011 100644 --- a/autoload/ale/c.vim +++ b/autoload/ale/c.vim @@ -8,6 +8,25 @@ let s:sep = has('win32') ? '\' : '/' " Set just so tests can override it. let g:__ale_c_project_filenames = ['.git/HEAD', 'configure', 'Makefile', 'CMakeLists.txt'] +function! ale#c#GetBuildDirectory(buffer) abort + " Don't include build directory for header files, as compile_commands.json + " files don't consider headers to be translation units, and provide no + " commands for compiling header files. + if expand('#' . a:buffer) =~# '\v\.(h|hpp)$' + return '' + endif + + let l:build_dir = ale#Var(a:buffer, 'c_build_dir') + + " c_build_dir has the priority if defined + if !empty(l:build_dir) + return l:build_dir + endif + + return ale#path#Dirname(ale#c#FindCompileCommands(a:buffer)) +endfunction + + function! ale#c#FindProjectRoot(buffer) abort for l:project_filename in g:__ale_c_project_filenames let l:full_path = ale#path#FindNearestFile(a:buffer, l:project_filename) |