[cfe-dev] Clang as a compiler-only tool

Dmitri Gribenko gribozavr at gmail.com
Mon Nov 19 04:13:01 PST 2012


On Mon, Nov 19, 2012 at 1:53 PM, Roman Divacky <rdivacky at freebsd.org> wrote:
> Ok, I made it emit an error like this:
>
> witten ~/llvm$ ./Release+Asserts/bin/clang -cc1 -analyze -analyzer-checker=alpha.cplusplus.VirtualCall -analyzer-store region tools/clang/test/Analysis/virtualcall.cpp
> error: action RunAnalysis not compiled in
>
>
> This happens to uncover a small bug though. We are emitting diagnostics in
> ExecuteCompilerInvocation.cpp which then gets warn about with -verify:
>
>
> witten ~/llvm$ ./Release+Asserts/bin/clang -cc1 -fsyntax-only -load /tmp/bah -plugin foobar -verify ~/hello.c
> error: 'error' diagnostics seen but not expected:
>   (frontend): unable to load plugin '/tmp/bah': '/tmp/bah: cannot open shared object file: No such file or directory'
>
> but thats a separate issue, just fwiw :)
>
>
> With the patch like that (#ifndef + emitting diagnostic), is it ok?

Much better now!

How will you pass this #define to the source file?  A special
./configure argument or just CXXFLAGS?  And what about the change to
exclude unneeded directories from compiling/linking?  And, of course,
will you be able to run regression tests with such a compiler?  (How
to exclude tests for functionality that was not built?)

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/



More information about the cfe-dev mailing list