diff options
Diffstat (limited to 'Source/CTest/cmParseGTMCoverage.cxx')
-rw-r--r-- | Source/CTest/cmParseGTMCoverage.cxx | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/Source/CTest/cmParseGTMCoverage.cxx b/Source/CTest/cmParseGTMCoverage.cxx index 528d0db..be10c2e 100644 --- a/Source/CTest/cmParseGTMCoverage.cxx +++ b/Source/CTest/cmParseGTMCoverage.cxx @@ -106,7 +106,19 @@ bool cmParseGTMCoverage::ReadMCovFile(const char* file) { cmCTestCoverageHandlerContainer::SingleFileCoverageVector& coverageVector = this->Coverage.TotalCoverage[filepath]; - coverageVector[lineoffset + linenumber] += count; + // This section accounts for lines that were previously marked + // as non-executable code (-1), if the parser comes back with + // a non-zero count, increase the count by 1 to push the line + // into the executable code set in addtion to the count found. + if(coverageVector[lineoffset + linenumber] == -1 && + count > 0) + { + coverageVector[lineoffset + linenumber] += count+1; + } + else + { + coverageVector[lineoffset + linenumber] += count; + } lastoffset = lineoffset; } } @@ -141,7 +153,7 @@ bool cmParseGTMCoverage::FindFunctionInMumpsFile(std::string const& filepath, if(pos == 0) { char nextchar = line[function.size()]; - if(nextchar == ' ' || nextchar == '(') + if(nextchar == ' ' || nextchar == '('|| nextchar == '\t') { lineoffset = linenum; return true; @@ -182,7 +194,7 @@ bool cmParseGTMCoverage::ParseMCOVLine(std::string const& line, // ( file , entry ) = "number_executed:timing_info" // ^COVERAGE("%RSEL","init",8,"FOR_LOOP",1)=1 // ( file , entry, line, IGNORE ) =number_executed - std::vector<cmStdString> args; + std::vector<std::string> args; std::string::size_type pos = line.find('(', 0); // if no ( is found, then return line has no coverage if(pos == std::string::npos) @@ -261,7 +273,11 @@ bool cmParseGTMCoverage::ParseMCOVLine(std::string const& line, // ^COVERAGE("%RSEL","SRC"), the line offset is 0 if(args.size() == 2) { - linenumber = 0; + // To avoid double counting of line 0 of each entry point, + // Don't count the lines that do not give an explicit line + // number. + routine=""; + function=""; } else { |