From 7aa6bebe9c6417437dbe6a1973ed1104001cfa98 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Fri, 1 May 2015 02:43:16 +0000 Subject: [PATCH] Merging r232443: ------------------------------------------------------------------------ r232443 | mail | 2015-03-16 20:18:51 -0400 (Mon, 16 Mar 2015) | 4 lines llvm-cov: Warn instead of error if a .gcda has arcs from an exit block Patch by Vanderson M. Rosario. Thanks! ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_36@236304 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/IR/GCOV.cpp | 4 +++- .../llvm-cov/Inputs/test_exit_block_arcs.gcda | Bin 0 -> 124 bytes .../llvm-cov/Inputs/test_exit_block_arcs.gcno | Bin 0 -> 216 bytes test/tools/llvm-cov/llvm-cov.test | 4 ++++ 4 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 test/tools/llvm-cov/Inputs/test_exit_block_arcs.gcda create mode 100644 test/tools/llvm-cov/Inputs/test_exit_block_arcs.gcno diff --git a/lib/IR/GCOV.cpp b/lib/IR/GCOV.cpp index 245c500cf62..88e0cd094ec 100644 --- a/lib/IR/GCOV.cpp +++ b/lib/IR/GCOV.cpp @@ -263,10 +263,12 @@ bool GCOVFunction::readGCDA(GCOVBuffer &Buff, GCOV::GCOVVersion Version) { // 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) { diff --git a/test/tools/llvm-cov/Inputs/test_exit_block_arcs.gcda b/test/tools/llvm-cov/Inputs/test_exit_block_arcs.gcda new file mode 100644 index 0000000000000000000000000000000000000000..3ca483d1f466f66fc5752db1491af4486eaad342 GIT binary patch literal 124 zcmYdHNlw=?GB8=X^e`&}0|O(70D(6*WB)S&>D6&slXCKt zv*Qzsl8g0{fto-H7#tay!89`A3>O2L1pyE-5FersB&1 | FileCheck %s -check-prefix=EXIT_BLOCK_ARCS +EXIT_BLOCK_ARCS: (main) has arcs from exit block. + XFAIL: powerpc64-, s390x, mips-, mips64-, sparc