Add support for clang for c

This commit is contained in:
mshr-h 2016-10-31 14:32:39 +09:00
parent 9028d1f132
commit e3a8829d67
3 changed files with 33 additions and 2 deletions

View File

@ -50,7 +50,7 @@ name. That seems to be the fairest way to arrange this table.
| Ansible | [ansible-lint](https://github.com/willthames/ansible-lint) |
| Bash | [-n flag](https://www.gnu.org/software/bash/manual/bash.html#index-set), [shellcheck](https://www.shellcheck.net/) |
| Bourne Shell | [-n flag](http://linux.die.net/man/1/sh), [shellcheck](https://www.shellcheck.net/) |
| C | [cppcheck](http://cppcheck.sourceforge.net), [gcc](https://gcc.gnu.org/)|
| C | [cppcheck](http://cppcheck.sourceforge.net), [gcc](https://gcc.gnu.org/), [clang](http://clang.llvm.org/)|
| C++ (filetype cpp) | [cppcheck] (http://cppcheck.sourceforge.net), [gcc](https://gcc.gnu.org/)|
| CoffeeScript | [coffee](http://coffeescript.org/), [coffeelint](https://www.npmjs.com/package/coffeelint) |
| CSS | [csslint](http://csslint.net/) |

20
ale_linters/c/clang.vim Normal file
View File

@ -0,0 +1,20 @@
" Author: Masahiro H https://github.com/mshr-h
" Description: clang linter for c files
" Set this option to change the Clang options for warnings for C.
if !exists('g:ale_c_clang_options')
" let g:ale_c_clang_options = '-Wall'
" let g:ale_c_clang_options = '-std=c99 -Wall'
" c11 compatible
let g:ale_c_clang_options = '-std=c11 -Wall'
endif
call ale#linter#Define('c', {
\ 'name': 'clang',
\ 'output_stream': 'stderr',
\ 'executable': 'clang',
\ 'command': 'clang -S -x c -fsyntax-only '
\ . g:ale_c_clang_options
\ . ' -',
\ 'callback': 'ale#handlers#HandleGCCFormat',
\})

View File

@ -55,7 +55,7 @@ The following languages and tools are supported.
* Ansible: 'ansible-lint'
* Bash: 'shell' (-n flag), 'shellcheck'
* Bourne Shell: 'shell' (-n flag), 'shellcheck'
* C: 'cppcheck', 'gcc'
* C: 'cppcheck', 'gcc', 'clang'
* C++ (filetype cpp): 'cppcheck', 'gcc'
* CoffeeScript: 'coffee', 'coffelint'
* CSS: 'csslint'
@ -561,6 +561,17 @@ g:ale_html_htmlhint_options *g:ale_html_htmlhint_options
This variable can be changed to modify flags given to HTMLHint.
-------------------------------------------------------------------------------
4.5. c-gcc *ale-linter-options-c-clang*
g:ale_c_clang_options *g:ale_c_clang_options*
Type: |String|
Default: `'-std=c11 -Wall'`
This variable can be change to modify flags given to clang.
===============================================================================
5. Commands/Keybinds *ale-commands*