diff options
author | w0rp <devw0rp@gmail.com> | 2019-05-20 23:50:38 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2019-05-20 23:50:38 +0100 |
commit | 26e5948617e4aad8612bfb0ac958a5f483898716 (patch) | |
tree | fbca4d948d1d0de8e2a56fcfc7ca59abd8597988 /autoload | |
parent | 42f5e8c62c68f0e5684280d2c0903cb110d9a72a (diff) | |
download | ale-26e5948617e4aad8612bfb0ac958a5f483898716.zip |
Close #2516 - Handle problems with inlined functions
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/handlers/gcc.vim | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/autoload/ale/handlers/gcc.vim b/autoload/ale/handlers/gcc.vim index 72d639da..ec16b977 100644 --- a/autoload/ale/handlers/gcc.vim +++ b/autoload/ale/handlers/gcc.vim @@ -11,6 +11,7 @@ let s:pragma_error = '#pragma once in main file' " <stdin>:10:27: error: invalid operands to binary - (have ‘int’ and ‘char *’) " -:189:7: note: $/${} is unnecessary on arithmetic variables. [SC2004] let s:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+)?:? ([^:]+): (.+)$' +let s:inline_pattern = '\v inlined from .* at \<stdin\>:(\d+):(\d+):$' function! s:IsHeaderFile(filename) abort return a:filename =~? '\v\.(h|hpp)$' @@ -25,6 +26,28 @@ function! s:RemoveUnicodeQuotes(text) abort return l:text endfunction +function! s:ParseInlinedFunctionProblems(buffer, lines) abort + let l:output = [] + let l:pos_match = [] + + for l:line in a:lines + let l:match = matchlist(l:line, s:pattern) + + if !empty(l:match) && !empty(l:pos_match) + call add(l:output, { + \ 'lnum': str2nr(l:pos_match[1]), + \ 'col': str2nr(l:pos_match[2]), + \ 'type': (l:match[4] is# 'error' || l:match[4] is# 'fatal error') ? 'E' : 'W', + \ 'text': s:RemoveUnicodeQuotes(l:match[5]), + \}) + endif + + let l:pos_match = matchlist(l:line, s:inline_pattern) + endfor + + return l:output +endfunction + " Report problems inside of header files just for gcc and clang function! s:ParseProblemsInHeaders(buffer, lines) abort let l:output = [] @@ -129,6 +152,7 @@ endfunction function! ale#handlers#gcc#HandleGCCFormatWithIncludes(buffer, lines) abort let l:output = ale#handlers#gcc#HandleGCCFormat(a:buffer, a:lines) + call extend(l:output, s:ParseInlinedFunctionProblems(a:buffer, a:lines)) call extend(l:output, s:ParseProblemsInHeaders(a:buffer, a:lines)) return l:output |