[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
Thu Oct 11 01:55:35 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL344228: [gcov] Display the hit counter for the line of a function definition (authored by calixte, committed by ).

Repository:
  rL LLVM

https://reviews.llvm.org/D49853

Files:
  llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp


Index: llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp
+++ llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp
@@ -570,6 +570,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(&EntryBlock)
+          .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.169170.patch
Type: text/x-patch
Size: 774 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181011/1649a830/attachment.bin>


More information about the llvm-commits mailing list