Merge pull request #2191 from davidvandebunte/fixCompDbDir

bugfix: c.vim: Pull build directory from compilation database
This commit is contained in:
w0rp
2019-01-10 18:59:13 +00:00
committed by GitHub
2 changed files with 7 additions and 8 deletions

View File

@@ -223,14 +223,14 @@ function! s:GetLookupFromCompileCommandsFile(compile_commands_file) abort
return l:empty
endfunction
function! ale#c#ParseCompileCommandsFlags(buffer, dir, file_lookup, dir_lookup) abort
function! ale#c#ParseCompileCommandsFlags(buffer, file_lookup, dir_lookup) abort
" Search for an exact file match first.
let l:basename = tolower(expand('#' . a:buffer . ':t'))
let l:file_list = get(a:file_lookup, l:basename, [])
for l:item in l:file_list
if bufnr(l:item.file) is a:buffer
return ale#c#ParseCFlags(a:dir, l:item.command)
return ale#c#ParseCFlags(l:item.directory, l:item.command)
endif
endfor
@@ -242,7 +242,7 @@ function! ale#c#ParseCompileCommandsFlags(buffer, dir, file_lookup, dir_lookup)
for l:item in l:dir_list
if ale#path#Simplify(fnamemodify(l:item.file, ':h')) is? l:dir
return ale#c#ParseCFlags(a:dir, l:item.command)
return ale#c#ParseCFlags(l:item.directory, l:item.command)
endif
endfor
@@ -250,12 +250,11 @@ function! ale#c#ParseCompileCommandsFlags(buffer, dir, file_lookup, dir_lookup)
endfunction
function! ale#c#FlagsFromCompileCommands(buffer, compile_commands_file) abort
let l:dir = ale#path#Dirname(a:compile_commands_file)
let l:lookups = s:GetLookupFromCompileCommandsFile(a:compile_commands_file)
let l:file_lookup = l:lookups[0]
let l:dir_lookup = l:lookups[1]
return ale#c#ParseCompileCommandsFlags(a:buffer, l:dir, l:file_lookup, l:dir_lookup)
return ale#c#ParseCompileCommandsFlags(a:buffer, l:file_lookup, l:dir_lookup)
endfunction
function! ale#c#GetCFlags(buffer, output) abort