summaryrefslogtreecommitdiff
path: root/ale_linters
diff options
context:
space:
mode:
authorw0rp <w0rp@users.noreply.github.com>2017-05-20 13:39:09 +0100
committerGitHub <noreply@github.com>2017-05-20 13:39:09 +0100
commit04e0dda17ab81e99784acf283b5b5e4c8790bf6d (patch)
tree48411bfe0c9647502b390c8d944afa447d685a0b /ale_linters
parent65fbf1cdff316090f404bb65f8c8a54a00551650 (diff)
parentaf6470c8d02067a1d6ec346ac6e277c86224b9e5 (diff)
downloadale-04e0dda17ab81e99784acf283b5b5e4c8790bf6d.zip
Merge pull request #568 from Qusic/master
Add clang for objc and objcpp
Diffstat (limited to 'ale_linters')
-rw-r--r--ale_linters/objc/clang.vim23
-rw-r--r--ale_linters/objcpp/clang.vim23
2 files changed, 46 insertions, 0 deletions
diff --git a/ale_linters/objc/clang.vim b/ale_linters/objc/clang.vim
new file mode 100644
index 00000000..f4725a0e
--- /dev/null
+++ b/ale_linters/objc/clang.vim
@@ -0,0 +1,23 @@
+" Author: Bang Lee <https://github.com/Qusic>
+" Description: clang linter for objc files
+
+" Set this option to change the Clang options for warnings for ObjC.
+if !exists('g:ale_objc_clang_options')
+ let g:ale_objc_clang_options = '-std=c11 -Wall'
+endif
+
+function! ale_linters#objc#clang#GetCommand(buffer) abort
+ " -iquote with the directory the file is in makes #include work for
+ " headers in the same directory.
+ return 'clang -S -x objective-c -fsyntax-only '
+ \ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
+ \ . ' ' . ale#Var(a:buffer, 'objc_clang_options') . ' -'
+endfunction
+
+call ale#linter#Define('objc', {
+\ 'name': 'clang',
+\ 'output_stream': 'stderr',
+\ 'executable': 'clang',
+\ 'command_callback': 'ale_linters#objc#clang#GetCommand',
+\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
+\})
diff --git a/ale_linters/objcpp/clang.vim b/ale_linters/objcpp/clang.vim
new file mode 100644
index 00000000..0e9cefe9
--- /dev/null
+++ b/ale_linters/objcpp/clang.vim
@@ -0,0 +1,23 @@
+" Author: Bang Lee <https://github.com/Qusic>
+" Description: clang linter for objcpp files
+
+" Set this option to change the Clang options for warnings for ObjCPP.
+if !exists('g:ale_objcpp_clang_options')
+ let g:ale_objcpp_clang_options = '-std=c++14 -Wall'
+endif
+
+function! ale_linters#objcpp#clang#GetCommand(buffer) abort
+ " -iquote with the directory the file is in makes #include work for
+ " headers in the same directory.
+ return 'clang++ -S -x objective-c++ -fsyntax-only '
+ \ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
+ \ . ' ' . ale#Var(a:buffer, 'objcpp_clang_options') . ' -'
+endfunction
+
+call ale#linter#Define('objcpp', {
+\ 'name': 'clang',
+\ 'output_stream': 'stderr',
+\ 'executable': 'clang++',
+\ 'command_callback': 'ale_linters#objcpp#clang#GetCommand',
+\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
+\})