[PATCH] D49853: [gcov] Display the hit counter for the line of a function definition

calixte via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 13 04:51:40 PDT 2018


calixte updated this revision to Diff 160332.
calixte added a comment.

Fix formatting.


Repository:
  rL LLVM

https://reviews.llvm.org/D49853

Files:
  lib/Transforms/Instrumentation/GCOVProfiling.cpp


Index: lib/Transforms/Instrumentation/GCOVProfiling.cpp
===================================================================
--- lib/Transforms/Instrumentation/GCOVProfiling.cpp
+++ lib/Transforms/Instrumentation/GCOVProfiling.cpp
@@ -583,6 +583,12 @@
                                                 Options.ExitBlockBeforeBody));
       GCOVFunction &Func = *Funcs.back();
 
+      // Add the function line number to the lines of the entry block
+      // to have a counter for the function definition.
+      Func.getBlock(&F.getEntryBlock())
+          .getFile(SP->getFilename())
+          .addLine(SP->getLine());
+
       for (auto &BB : F) {
         GCOVBlock &Block = Func.getBlock(&BB);
         TerminatorInst *TI = BB.getTerminator();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49853.160332.patch
Type: text/x-patch
Size: 748 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180813/ef569005/attachment.bin>


More information about the llvm-commits mailing list