using code coverage with clang

Jeremy C. Reed reed at reedmedia.net
Mon Oct 6 19:48:37 UTC 2014


> I use the static analyzer (in the Computer Science meaning of the 
> term) from clang. F.ex.:
>
> scan-build34 -o /home/gowen/projects/gummy_project/Analyze make -j 2 
> -e -f Makefile
>
> Runs the clang34 static analyzer and outputs a html report. Perhaps it 
> can help you.

I have used it many times, but I don't know how it may be used to show 
run-time analysis of the code. (I tried again but don't see if the 
"static" analysis can do "dynamic" reporting.) It is useful, but not 
what I am looking for.

Is anyone doing code coverage analysis with clang (and maybe with lcov 
or llvm-cov) on FreeBSD 10?  Maybe some port should provide the 
libprofile_rt from llvm's compiler-rt?

I had tried clang34 and llvm34 but missing libprofile_rt.a.
I then tried clang-devel and llvm-devel which provide llvm-cov but don't 
have libprofile. It fails with

/usr/bin/ld: 
/usr/local/llvm-devel/bin/../lib/clang/3.6.0/lib/freebsd/libclang_r
t.profile-amd64.a: No such file: No such file or directory

Where can I find that?

By the way, http://www.freebsdports.info/ports/devel/llvm-devel.html
shows lib/libprofile_rt.a and lib/libprofile_rt.so which I don't have 
with clang-devel-3.6.r218451_1 and llvm-devel-3.6.r218451.

Any hints before I create a bug ticket?




More information about the freebsd-questions mailing list