<div class="gmail_quote">On Tue, Sep 4, 2012 at 7:34 AM, Alexander Kornienko <span dir="ltr"><<a href="mailto:reviews@llvm-reviews.chandlerc.com" target="_blank">reviews@llvm-reviews.chandlerc.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> Articles, articles. I want to write my articles...<br>
<div class="im"><br>
Hi klimek,<br>
<br>
<a href="http://llvm-reviews.chandlerc.com/D35" target="_blank">http://llvm-reviews.chandlerc.com/D35</a><br>
<br>
CHANGE SINCE LAST DIFF<br>
</div> <a href="http://llvm-reviews.chandlerc.com/D35?vs=93&id=94#toc" target="_blank">http://llvm-reviews.chandlerc.com/D35?vs=93&id=94#toc</a><br>
<div class="im"><br>
Files:<br>
tools/clang/docs/HowToSetupToolingForLLVM.html<br>
<br>
Index: tools/clang/docs/HowToSetupToolingForLLVM.html<br>
===================================================================<br>
--- tools/clang/docs/HowToSetupToolingForLLVM.html<br>
+++ tools/clang/docs/HowToSetupToolingForLLVM.html<br>
</div>@@ -77,12 +77,37 @@<br>
<div class="im"> <p>If you're using vim, it's convenient to have clang-check integrated. Put this<br>
into your .vimrc:</p><br>
<pre><br>
- set makeprg=clang-check\ %<br>
- map <F5> :make<CR><CR><br>
-</pre><br>
-<br>
-<p>When editing C++ code, hit F5 to reparse the current buffer. The output will<br>
-go into the error window, which you can enable with <code>:cope</code>.</p><br>
</div>+function! ClangCheckImpl(cmd)<br>
<div class="im">+ echo "Running " . a:cmd<br></div></blockquote><div><br></div><div>Remove.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">
+ let l:output = system(a:cmd)<br>
</div><div class="im">+ cexpr l:output<br>
+ cwindow<br></div></blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">+ let w:quickfix_title = a:cmd<br>
</div><div class="im">+ if v:shell_error != 0<br>
</div>+ cc<br>
<div class="im">+ endif<br></div></blockquote><div><br></div><div>Replace all that with</div><div><br></div><div><div> let l:oldmakepgr = &makeprg</div><div> let &makeprg = a:cmd</div><div> silent make | cwindow</div>
<div><div> let &makeprg = l:oldmakepgr</div></div><div><br></div><div>(Gives you a warning when trying to compile a modified buffer too)</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class="im"></div></blockquote></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
+ let g:clang_check_last_cmd = a:cmd<br>
+endfunction<br>
+<br>
</div>+function! ClangCheck()<br>
<div class="im">+ let l:filename = expand('%')<br>
</div><div class="im">+ if l:filename =~ '\.\(cpp\|cxx\|cc\|c\)$'<br>
</div><div class="im">+ call ClangCheckImpl("clang-check " . l:filename)<br>
+ elseif exists("g:clang_check_last_cmd")<br>
+ call ClangCheckImpl(g:clang_check_last_cmd)<br>
+ else<br>
+ echo "Can't detect file's compilation arguments and no previous clang-check invocation!"<br>
+ endif<br>
+endfunction<br>
+<br>
</div>+nmap <silent> <F5> :call ClangCheck()<CR><CR><br>
+</pre><br>
+<br>
+<p>When editing a .cpp/.cxx/.cc/.c file, hit F5 to reparse the file. In case<br>
+the current file has a different extension (for example, .h), F5 will re-run<br>
+the last clang-check invocation made from this vim instance (if any). The<br>
+output will go into the error window, which is opened automatically when<br>
+clang-check finds errors, and can be re-opened with <code>:cope</code>.</p><br>
<div class="HOEnZb"><div class="h5"><br>
<p>Other <code>clang-check</code> options that can be useful when working with<br>
clang AST:</p><br>
</div></div><br>_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
<br></blockquote></div><br>