[llvm] r232443 - llvm-cov: Warn instead of error if a .gcda has arcs from an exit block

Justin Bogner mail at justinbogner.com
Mon Mar 16 17:18:51 PDT 2015


Author: bogner
Date: Mon Mar 16 19:18:51 2015
New Revision: 232443

URL: http://llvm.org/viewvc/llvm-project?rev=232443&view=rev
Log:
llvm-cov: Warn instead of error if a .gcda has arcs from an exit block

Patch by Vanderson M. Rosario. Thanks!

Added:
    llvm/trunk/test/tools/llvm-cov/Inputs/test_exit_block_arcs.gcda
    llvm/trunk/test/tools/llvm-cov/Inputs/test_exit_block_arcs.gcno
Modified:
    llvm/trunk/lib/IR/GCOV.cpp
    llvm/trunk/test/tools/llvm-cov/llvm-cov.test

Modified: llvm/trunk/lib/IR/GCOV.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/GCOV.cpp?rev=232443&r1=232442&r2=232443&view=diff
==============================================================================
--- llvm/trunk/lib/IR/GCOV.cpp (original)
+++ llvm/trunk/lib/IR/GCOV.cpp Mon Mar 16 19:18:51 2015
@@ -302,10 +302,12 @@ bool GCOVFunction::readGCDA(GCOVBuffer &
   // required to combine the edge counts that are contained in the GCDA file.
   for (uint32_t BlockNo = 0; Count > 0; ++BlockNo) {
     // The last block is always reserved for exit block
-    if (BlockNo >= Blocks.size() - 1) {
+    if (BlockNo >= Blocks.size()) {
       errs() << "Unexpected number of edges (in " << Name << ").\n";
       return false;
     }
+    if (BlockNo == Blocks.size() - 1)
+      errs() << "(" << Name << ") has arcs from exit block.\n";
     GCOVBlock &Block = *Blocks[BlockNo];
     for (size_t EdgeNo = 0, End = Block.getNumDstEdges(); EdgeNo < End;
          ++EdgeNo) {

Added: llvm/trunk/test/tools/llvm-cov/Inputs/test_exit_block_arcs.gcda
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-cov/Inputs/test_exit_block_arcs.gcda?rev=232443&view=auto
==============================================================================
Binary files llvm/trunk/test/tools/llvm-cov/Inputs/test_exit_block_arcs.gcda (added) and llvm/trunk/test/tools/llvm-cov/Inputs/test_exit_block_arcs.gcda Mon Mar 16 19:18:51 2015 differ

Added: llvm/trunk/test/tools/llvm-cov/Inputs/test_exit_block_arcs.gcno
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-cov/Inputs/test_exit_block_arcs.gcno?rev=232443&view=auto
==============================================================================
Binary files llvm/trunk/test/tools/llvm-cov/Inputs/test_exit_block_arcs.gcno (added) and llvm/trunk/test/tools/llvm-cov/Inputs/test_exit_block_arcs.gcno Mon Mar 16 19:18:51 2015 differ

Modified: llvm/trunk/test/tools/llvm-cov/llvm-cov.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-cov/llvm-cov.test?rev=232443&r1=232442&r2=232443&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-cov/llvm-cov.test (original)
+++ llvm/trunk/test/tools/llvm-cov/llvm-cov.test Mon Mar 16 19:18:51 2015
@@ -111,4 +111,8 @@ RUN: llvm-cov test.c -gcda=test_file_che
 # Bad function checksum on gcda
 RUN: llvm-cov test.c -gcda=test_func_checksum_fail.gcda
 
+# Has arcs from exit blocks
+RUN: llvm-cov test_exit_block_arcs.c 2>&1 | FileCheck %s -check-prefix=EXIT_BLOCK_ARCS
+EXIT_BLOCK_ARCS: (main) has arcs from exit block.
+
 XFAIL: powerpc64-, s390x, mips-, mips64-, sparc





More information about the llvm-commits mailing list