Skip to content

Commit

Permalink
Revert "ignore lines that are marked as unreachable"
Browse files Browse the repository at this point in the history
This reverts commit ce8eb72.
  • Loading branch information
SimonKagstrom committed Jan 14, 2017
1 parent 7278c05 commit dc55572
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 43 deletions.
6 changes: 0 additions & 6 deletions src/configuration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ class Configuration : public IConfiguration
" --coveralls-id=id Travis CI job ID or secret repo_token for uploads to\n"
" Coveralls.io\n"
" --strip-path=path If not set, max common path will be stripped away.\n"
" --unreachable=pat Consider lines that match the pattern to be unreachable.\n"
"%s"
"\n"
"Examples:\n"
Expand Down Expand Up @@ -123,7 +122,6 @@ class Configuration : public IConfiguration
{"include-path", required_argument, 0, 'I'},
{"coveralls-id", required_argument, 0, 'T'},
{"strip-path", required_argument, 0, 'Z'},
{"unreachable", required_argument, 0, 'u'},
{"debug", required_argument, 0, 'D'},
{"debug-force-bash-stderr", no_argument, 0, 'd'},
{"bash-handle-sh-invocation", no_argument, 0, 's'},
Expand Down Expand Up @@ -313,9 +311,6 @@ class Configuration : public IConfiguration
case 'Z':
setKey("strip-path", std::string(optarg));
break;
case 'u':
setKey("unreachable", std::string(optarg));
break;
case 'x':
setKey("exclude-pattern", getCommaSeparatedList(std::string(optarg)));
break;
Expand Down Expand Up @@ -511,7 +506,6 @@ class Configuration : public IConfiguration
setKey("daemonize-on-first-process-exit", 0);
setKey("coveralls-id", "");
setKey("strip-path", "");
setKey("unreachable", "");
setKey("orig-path-prefix", "");
setKey("new-path-prefix", "");
setKey("running-mode", IConfiguration::MODE_COLLECT_AND_REPORT);
Expand Down
39 changes: 2 additions & 37 deletions src/reporter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <unordered_map>
#include <functional>
#include <map>
#include <fstream>

#include "swap-endian.hh"

Expand Down Expand Up @@ -47,7 +46,6 @@ class Reporter :
m_hashFilename = fileParser.getParserType() == "ELF";

m_dbFileName = IConfiguration::getInstance().keyAsString("target-directory") + "/coverage.db";
m_unreachablePattern = IConfiguration::getInstance().keyAsString("unreachable");
}

~Reporter()
Expand Down Expand Up @@ -312,23 +310,6 @@ class Reporter :

fp = new File(hash);

// Detect unreachable lines (if requested)
if (!m_unreachablePattern.empty()) {
std::ifstream in(file);
if (in.is_open()) {
std::string line;
unsigned lineNr=0;
while (getline(in,line)) {
++lineNr;
if (line.find(m_unreachablePattern)!=std::string::npos) {
Line *line = new Line(fp->getFileHash(), lineNr);
line->markUnreachable();
fp->addLine(lineNr, line);
}
}
}
}

m_files[file] = fp;
}

Expand Down Expand Up @@ -436,22 +417,8 @@ class Reporter :

Line(uint64_t fileHash, unsigned int lineNr) :
m_lineId((fileHash << 32ULL) | lineNr),
m_order(0), m_unreachable(false)
{
}

void markUnreachable()
m_order(0)
{
m_unreachable = true;
}

bool isUnreachable() const
{
if (!m_unreachable)
return false;

// The line is marked as unreachable, but perhaps it is reachable in reality
return !hits();
}

uint64_t getOrder() const
Expand Down Expand Up @@ -603,7 +570,6 @@ class Reporter :
AddrToHitsMap_t m_addrs;
uint64_t m_lineId;
uint64_t m_order;
bool m_unreachable;
};

class File
Expand Down Expand Up @@ -706,7 +672,7 @@ class Reporter :
if (lineNr >= m_lines.size())
return false;

return (m_lines[lineNr] != NULL) && (!m_lines[lineNr]->isUnreachable());
return m_lines[lineNr] != NULL;
}

private:
Expand Down Expand Up @@ -751,7 +717,6 @@ class Reporter :

bool m_unmarshallingDone;
std::string m_dbFileName;
std::string m_unreachablePattern;

uint64_t m_order;
};
Expand Down

0 comments on commit dc55572

Please sign in to comment.