clang and code coverage?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

clang and code coverage?

Sean McBride
Hi all,

Is there any way to measure code coverage when using clang?

The gcov docs say: "gcov works only on code compiled with GCC."  Is this
true of code built by clang?  Or does clang's "GCC compatibility" design
goal extend to this situation?  If not, does/will the llvm project
include a replacement for gcov?

I'd like to be able to generate something not unlike what clang's own
webpage shows of clang's tests:

<http://test.minormatter.com/~ddunbar/clang-cov/>

Cheers,

--
____________________________________________________________
Sean McBride, B. Eng                 [hidden email]
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: clang and code coverage?

Douglas Gregor

On Aug 16, 2010, at 9:50 AM, Sean McBride wrote:

> Hi all,
>
> Is there any way to measure code coverage when using clang?
>
> The gcov docs say: "gcov works only on code compiled with GCC."  Is this
> true of code built by clang?  Or does clang's "GCC compatibility" design
> goal extend to this situation?  If not, does/will the llvm project
> include a replacement for gcov?


Neither Clang nor LLVM have the ability to generate coverage code for gcov. I do not know of any replacements in the works.

        - Doug
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: clang and code coverage?

Christopher Jefferson
In reply to this post by Sean McBride

On 16 Aug 2010, at 17:50, Sean McBride wrote:

> Hi all,
>
> Is there any way to measure code coverage when using clang?

I have used callgrind, which comes with valgrind, to do code coverage with gcc. While I haven't tried it with clang, it makes use of debugging information so I assume it would work.

Chris

>
> The gcov docs say: "gcov works only on code compiled with GCC."  Is this
> true of code built by clang?  Or does clang's "GCC compatibility" design
> goal extend to this situation?  If not, does/will the llvm project
> include a replacement for gcov?
>
> I'd like to be able to generate something not unlike what clang's own
> webpage shows of clang's tests:
>
> <http://test.minormatter.com/~ddunbar/clang-cov/>
>
> Cheers,
>
> --
> ____________________________________________________________
> Sean McBride, B. Eng                 [hidden email]
> Rogue Research                        www.rogue-research.com
> Mac Software Developer              Montréal, Québec, Canada
>
>
>
> _______________________________________________
> cfe-dev mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: clang and code coverage?

Shawn Erickson
In reply to this post by Douglas Gregor
On Mon, Aug 16, 2010 at 10:19 AM, Douglas Gregor <[hidden email]> wrote:
>
> On Aug 16, 2010, at 9:50 AM, Sean McBride wrote:
>
>> Hi all,
>>
>> Is there any way to measure code coverage when using clang?
>>
>
> Neither Clang nor LLVM have the ability to generate coverage code for gcov. I do not know of any replacements in the works.

This was something I was starting to seriously think about working on
in support of clang/llvm. At a high-level was thinking of focusing on
tracking function call coverage and branch coverage, not so much
source line code coverage. Wasn't thinking about attempting to
leverage gcov for this.

The problem is getting enough time to get my head around clang/llvm to
get this rolling.

-Shawn
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: clang and code coverage?

Sean McBride
In reply to this post by Douglas Gregor
On Mon, 16 Aug 2010 10:19:04 -0700, Douglas Gregor said:

>> Is there any way to measure code coverage when using clang?
>>
>> The gcov docs say: "gcov works only on code compiled with GCC."  Is this
>> true of code built by clang?  Or does clang's "GCC compatibility" design
>> goal extend to this situation?  If not, does/will the llvm project
>> include a replacement for gcov?
>
>Neither Clang nor LLVM have the ability to generate coverage code for
>gcov. I do not know of any replacements in the works.

Thanks Doug for your reply.

Is there a bug for this?  I searched but could not find one.  I filed
<rdar://problem/8107317> after WWDC10 but I'd like to have a bug in the
public llvm.org database too.

As more and more Objective-C features _require_ clang[1], Mac developers
will be forced to choose between these nice new features and being able
to measure code coverage.  I'm not looking forward to that choice. :(

[1] <http://www.mcubedsw.com/blog/index.php/site/comments/new_objective-
c_features/>

Cheers,

--
____________________________________________________________
Sean McBride, B. Eng                 [hidden email]
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: clang and code coverage?

Douglas Gregor

On Aug 30, 2010, at 12:27 PM, Sean McBride wrote:

> On Mon, 16 Aug 2010 10:19:04 -0700, Douglas Gregor said:
>
>>> Is there any way to measure code coverage when using clang?
>>>
>>> The gcov docs say: "gcov works only on code compiled with GCC."  Is this
>>> true of code built by clang?  Or does clang's "GCC compatibility" design
>>> goal extend to this situation?  If not, does/will the llvm project
>>> include a replacement for gcov?
>>
>> Neither Clang nor LLVM have the ability to generate coverage code for
>> gcov. I do not know of any replacements in the works.
>
> Thanks Doug for your reply.
>
> Is there a bug for this?  I searched but could not find one.  I filed
> <rdar://problem/8107317> after WWDC10 but I'd like to have a bug in the
> public llvm.org database too.

I don't see a bug in Bugzilla for it.

> As more and more Objective-C features _require_ clang[1], Mac developers
> will be forced to choose between these nice new features and being able
> to measure code coverage.  I'm not looking forward to that choice. :(


The Radar is a way to prod Apple toward implementing this feature, but anyone can do it: implementing gcov-style coverage should be relatively easy in Clang.

        - Doug
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: clang and code coverage?

Sean McBride
On Mon, 30 Aug 2010 13:16:48 -0700, Douglas Gregor said:

>I don't see a bug in Bugzilla for it.

<http://llvm.org/bugs/show_bug.cgi?id=8030>

Cheers,

--
____________________________________________________________
Sean McBride, B. Eng                 [hidden email]
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev