Page MenuHomeFreeBSD

llvm-cov: also install as gcov (if GNU gcov is disabled)
ClosedPublic

Authored by emaste on Nov 9 2018, 3:34 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 30, 6:00 AM
Unknown Object (File)
Wed, Nov 27, 2:21 AM
Unknown Object (File)
Mon, Nov 25, 1:29 PM
Unknown Object (File)
Sun, Nov 24, 7:52 AM
Unknown Object (File)
Nov 20 2024, 4:55 AM
Unknown Object (File)
Nov 6 2024, 4:09 PM
Unknown Object (File)
Nov 5 2024, 6:24 AM
Unknown Object (File)
Nov 4 2024, 3:46 AM
Subscribers

Details

Summary

llvm-cov provides a gcov-compatible interface when invoked as gcov.

Sponsored by: The FreeBSD Foundation

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Note that WITH_LLVM_COV is default.

Following a trivial example e.g. http://www.network-theory.co.uk/docs/gccintro/gccintro_81.html:

% cc -Wall -fprofile-arcs -ftest-coverage cov.c
% ./a.out                                      
3 is divisible by 3
6 is divisible by 3
9 is divisible by 3
% gcov cov.c                                   
File 'cov.c'
Lines executed:85.71% of 7
cov.c:creating 'cov.c.gcov'

% cat cov.c.gcov
        -:    0:Source:cov.c
        -:    0:Graph:cov.gcno
        -:    0:Data:cov.gcda
        -:    0:Runs:2
        -:    0:Programs:1
        -:    1:#include <stdio.h>
        -:    2:
        -:    3:int
        -:    4:main (void)
        -:    5:{
        -:    6:  int i;
        -:    7:
       40:    8:  for (i = 1; i < 10; i++)
        -:    9:    {
       18:   10:      if (i % 3 == 0)
        6:   11:        printf ("%d is divisible by 3\n", i);
       18:   12:      if (i % 11 == 0)
    #####:   13:        printf ("%d is divisible by 11\n", i);
       18:   14:    }
        -:   15:
        2:   16:  return 0;
        -:   17:}
This revision is now accepted and ready to land.Nov 9 2018, 3:44 PM

As a subsequent change I plan to move llvm-profdata's build into the .if ${MK_LLVM_COV} != "no" block.

    Move llvm-profdata build into MK_LLVM_COV block
    
    llvm-profdata is used with llvm-cov for code coverage (although llvm-cov
    can also operate independently in a gcov-compatible mode).
    Although llvm-profdata can be used independently of llvm-cov it makes
    sense to group these under one option.

diff --git a/usr.bin/clang/Makefile b/usr.bin/clang/Makefile
index 9d081c0fdda8..2054657186bd 100644
--- a/usr.bin/clang/Makefile
+++ b/usr.bin/clang/Makefile
@@ -31,7 +31,6 @@ SUBDIR+=      llvm-modextract
 SUBDIR+=       llvm-nm
 SUBDIR+=       llvm-objcopy
 SUBDIR+=       llvm-pdbutil
-SUBDIR+=       llvm-profdata
 SUBDIR+=       llvm-rtdyld
 SUBDIR+=       llvm-symbolizer
 SUBDIR+=       llvm-xray
@@ -46,6 +45,7 @@ SUBDIR+=      lldb
 .endif
 .if ${MK_LLVM_COV} != "no"
 SUBDIR+=       llvm-cov
+SUBDIR+=       llvm-profdata
 .endif
 .endif # TOOLS_PREFIX
This revision was automatically updated to reflect the committed changes.