diff options
author | Justin Bogner <mail@justinbogner.com> | 2014-02-04 06:41:39 +0000 |
---|---|---|
committer | Justin Bogner <mail@justinbogner.com> | 2014-02-04 06:41:39 +0000 |
commit | 93d1edbb7d2cf8fcbf00490e330b886018c8c267 (patch) | |
tree | ad3fd62cb493e3f5beb51fd7ad51cca14f35e69a /llvm/tools/llvm-cov/llvm-cov.cpp | |
parent | b5bff69ac6168b6e6bfb65fe31e9aeec2b327c15 (diff) | |
download | bcm5719-llvm-93d1edbb7d2cf8fcbf00490e330b886018c8c267.tar.gz bcm5719-llvm-93d1edbb7d2cf8fcbf00490e330b886018c8c267.zip |
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.
llvm-svn: 200740
Diffstat (limited to 'llvm/tools/llvm-cov/llvm-cov.cpp')
-rw-r--r-- | llvm/tools/llvm-cov/llvm-cov.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/llvm/tools/llvm-cov/llvm-cov.cpp b/llvm/tools/llvm-cov/llvm-cov.cpp index f5498916940..be8d1c90366 100644 --- a/llvm/tools/llvm-cov/llvm-cov.cpp +++ b/llvm/tools/llvm-cov/llvm-cov.cpp @@ -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) |