[llvm] r281076 - [llvm-cov] Remove some asserts in the html renderer (NFC)

Vedant Kumar via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 9 11:44:40 PDT 2016


Author: vedantk
Date: Fri Sep  9 13:44:40 2016
New Revision: 281076

URL: http://llvm.org/viewvc/llvm-project?rev=281076&view=rev
Log:
[llvm-cov] Remove some asserts in the html renderer (NFC)

These asserts are making tests fragile. The renderer does not enter an
invalid state when they fail, however, it may spit out a garbled
coverage report because the source text no longer matches the provided
coverage mapping.

Another follow-up to r281072.

Modified:
    llvm/trunk/tools/llvm-cov/SourceCoverageViewHTML.cpp

Modified: llvm/trunk/tools/llvm-cov/SourceCoverageViewHTML.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/SourceCoverageViewHTML.cpp?rev=281076&r1=281075&r2=281076&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/SourceCoverageViewHTML.cpp (original)
+++ llvm/trunk/tools/llvm-cov/SourceCoverageViewHTML.cpp Fri Sep  9 13:44:40 2016
@@ -473,21 +473,17 @@ void SourceCoverageViewHTML::renderLine(
 
   unsigned LCol = 1;
   auto Snip = [&](unsigned Start, unsigned Len) {
-    assert(Start + Len <= Line.size() && "Snippet extends past the EOL");
     Snippets.push_back(Line.substr(Start, Len));
     LCol += Len;
   };
 
   Snip(LCol - 1, Segments.empty() ? 0 : (Segments.front()->Col - 1));
 
-  for (unsigned I = 1, E = Segments.size(); I < E; ++I) {
-    assert(LCol == Segments[I - 1]->Col && "Snippet start position is wrong");
+  for (unsigned I = 1, E = Segments.size(); I < E; ++I)
     Snip(LCol - 1, Segments[I]->Col - LCol);
-  }
 
   // |Line| + 1 is needed to avoid underflow when, e.g |Line| = 0 and LCol = 1.
   Snip(LCol - 1, Line.size() + 1 - LCol);
-  assert(LCol == Line.size() + 1 && "Final snippet doesn't reach the EOL");
 
   // 2. Escape all of the snippets.
 




More information about the llvm-commits mailing list