[cfe-dev] Code coverage on clang
Nick Lewycky
nlewycky at google.com
Mon Jul 8 13:44:26 PDT 2013
On 8 July 2013 00:24, mbm_kalpesh <mbm_kalpesh at yahoo.co.in> wrote:
> Hi,
> I know how to use GCOV and LCOV to get code coverage on GCC.
> But This time i need to use clang and get instrumented binaries and code
> coverage.
>
> Please help (not able to find much info yet). Tried using -fprofile-arcs
> and
> -ftest-coverage. code is compiling fine but giving link errors.
>
The profiling library in gcc is called "libgcov", but clang has its own
named "libprofile_rt" and you need to link against that. The --coverage
flag implies -lprofile_rt when linking, or you can pass -lprofile_rt
yourself.
The code for libprofile_rt is part of compiler-rt:
http://llvm.org/svn/llvm-project/compiler-rt/trunk/lib/profile/ . If you
don't have libprofile_rt, you'll need to build it.
Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130708/ec5f077e/attachment.html>
More information about the cfe-dev
mailing list