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 | 9433c770f7cd72882fa33edf3b53dd62a23abc21 (patch) | |
tree | 577aabed381b36bd14b1b0fdd7d7e40ac9c2dab2 /tools/llvm-cov/llvm-cov.cpp | |
parent | f7d0d0798ea06dfc2629cd458a273197b6bb73e1 (diff) | |
download | llvm-9433c770f7cd72882fa33edf3b53dd62a23abc21.tar.gz llvm-9433c770f7cd72882fa33edf3b53dd62a23abc21.tar.bz2 llvm-9433c770f7cd72882fa33edf3b53dd62a23abc21.tar.xz |
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
Diffstat (limited to 'tools/llvm-cov/llvm-cov.cpp')
-rw-r--r-- | tools/llvm-cov/llvm-cov.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/tools/llvm-cov/llvm-cov.cpp b/tools/llvm-cov/llvm-cov.cpp index f549891694..be8d1c9036 100644 --- a/tools/llvm-cov/llvm-cov.cpp +++ b/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) |