llvm-cov: Ignore missing .gcda files

When gcov is run without gcda data, it acts as if the counts are all
zero and labels the file as - to indicate that there was no data. We
should do the same.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200740 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Justin Bogner
2014-02-04 06:41:39 +00:00
parent f7d0d0798e
commit 9433c770f7
5 changed files with 112 additions and 7 deletions

View File

@@ -84,13 +84,18 @@ int main(int argc, char **argv) {
OwningPtr<MemoryBuffer> GCDA_Buff;
if (error_code ec = MemoryBuffer::getFileOrSTDIN(InputGCDA, GCDA_Buff)) {
errs() << InputGCDA << ": " << ec.message() << "\n";
return 1;
}
GCOVBuffer GCDA_GB(GCDA_Buff.get());
if (!GF.readGCDA(GCDA_GB)) {
errs() << "Invalid .gcda File!\n";
return 1;
if (ec != errc::no_such_file_or_directory) {
errs() << InputGCDA << ": " << ec.message() << "\n";
return 1;
}
// Clear the filename to make it clear we didn't read anything.
InputGCDA = "-";
} else {
GCOVBuffer GCDA_GB(GCDA_Buff.get());
if (!GF.readGCDA(GCDA_GB)) {
errs() << "Invalid .gcda File!\n";
return 1;
}
}
if (DumpGCOV)