2017-10-10 09:13:09 +00:00
|
|
|
" Author: rhysd <https://rhysd.github.io>
|
|
|
|
" Description: Support for checking LLVM IR with llc
|
|
|
|
|
|
|
|
call ale#Set('llvm_llc_executable', 'llc')
|
|
|
|
|
|
|
|
function! ale_linters#llvm#llc#HandleErrors(buffer, lines) abort
|
|
|
|
" Handle '{path}: {file}:{line}:{col}: error: {message}' format
|
|
|
|
let l:pattern = '\v^[a-zA-Z]?:?[^:]+: [^:]+:(\d+):(\d+): (.+)$'
|
|
|
|
|
2018-08-02 22:44:12 +00:00
|
|
|
return map(ale#util#GetMatches(a:lines, l:pattern), "{
|
2017-10-10 09:13:09 +00:00
|
|
|
\ 'lnum': str2nr(v:val[1]),
|
|
|
|
\ 'col': str2nr(v:val[2]),
|
|
|
|
\ 'text': v:val[3],
|
|
|
|
\ 'type': 'E',
|
|
|
|
\}")
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
call ale#linter#Define('llvm', {
|
|
|
|
\ 'name': 'llc',
|
2018-08-02 22:44:12 +00:00
|
|
|
\ 'executable_callback': ale#VarFunc('llvm_llc_executable'),
|
2017-10-10 09:13:09 +00:00
|
|
|
\ 'output_stream': 'stderr',
|
2018-08-02 22:44:12 +00:00
|
|
|
\ 'command_callback': {-> '%e -filetype=null -o=' . g:ale#util#nul_file},
|
2017-10-10 09:13:09 +00:00
|
|
|
\ 'callback': 'ale_linters#llvm#llc#HandleErrors',
|
|
|
|
\})
|