From 13cc256e404620c1de0cbcc4e43ce1e2dbbc4898 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 2 Dec 2012 13:20:44 +0000 Subject: Vendor import of clang release_32 branch r168974 (effectively, 3.2 RC2): http://llvm.org/svn/llvm-project/cfe/branches/release_32@168974 --- docs/HowToSetupToolingForLLVM.html | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) (limited to 'docs/HowToSetupToolingForLLVM.html') diff --git a/docs/HowToSetupToolingForLLVM.html b/docs/HowToSetupToolingForLLVM.html index 493c8820fc4f..022ed9ce9cb3 100644 --- a/docs/HowToSetupToolingForLLVM.html +++ b/docs/HowToSetupToolingForLLVM.html @@ -77,12 +77,38 @@ $PATH. Try to run it on any .cpp file inside the LLVM source tree:

If you're using vim, it's convenient to have clang-check integrated. Put this into your .vimrc:

-  set makeprg=clang-check\ %
-  map <F5> :make<CR><CR>
+function! ClangCheckImpl(cmd)
+  if &autowrite | wall | endif
+  echo "Running " . a:cmd . " ..."
+  let l:output = system(a:cmd)
+  cexpr l:output
+  cwindow
+  let w:quickfix_title = a:cmd
+  if v:shell_error != 0
+    cc
+  endif
+  let g:clang_check_last_cmd = a:cmd
+endfunction
+
+function! ClangCheck()
+  let l:filename = expand('%')
+  if l:filename =~ '\.\(cpp\|cxx\|cc\|c\)$'
+    call ClangCheckImpl("clang-check " . l:filename)
+  elseif exists("g:clang_check_last_cmd")
+    call ClangCheckImpl(g:clang_check_last_cmd)
+  else
+    echo "Can't detect file's compilation arguments and no previous clang-check invocation!"
+  endif
+endfunction
+
+nmap <silent> <F5> :call ClangCheck()<CR><CR>
 
-

When editing C++ code, hit F5 to reparse the current buffer. The output will -go into the error window, which you can enable with :cope.

+

When editing a .cpp/.cxx/.cc/.c file, hit F5 to reparse the file. In case +the current file has a different extension (for example, .h), F5 will re-run +the last clang-check invocation made from this vim instance (if any). The +output will go into the error window, which is opened automatically when +clang-check finds errors, and can be re-opened with :cope.

Other clang-check options that can be useful when working with clang AST:

-- cgit v1.3