llvm-cov provides a gcov-compatible interface when invoked as gcov.
Sponsored by: The FreeBSD Foundation
Differential D17923
llvm-cov: also install as gcov (if GNU gcov is disabled) emaste on Nov 9 2018, 3:34 PM. Authored by Tags None Referenced Files
Subscribers
Details llvm-cov provides a gcov-compatible interface when invoked as gcov. Sponsored by: The FreeBSD Foundation
Diff Detail
Event TimelineComment Actions 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:} Comment Actions 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 |