summaryrefslogtreecommitdiff
path: root/lib/IR/GCOV.cpp
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2014-03-26 22:03:06 +0000
committerJustin Bogner <mail@justinbogner.com>2014-03-26 22:03:06 +0000
commit2a6873fdf3fa413cd7ef09b368fab64aa936d027 (patch)
tree8f4ce3706adbf461c1702131c289203bb8b0cf03 /lib/IR/GCOV.cpp
parent70ea745ec8b91327874c0f8166d8471e4c377f37 (diff)
downloadllvm-2a6873fdf3fa413cd7ef09b368fab64aa936d027.tar.gz
llvm-2a6873fdf3fa413cd7ef09b368fab64aa936d027.tar.bz2
llvm-2a6873fdf3fa413cd7ef09b368fab64aa936d027.tar.xz
llvm-cov: Handle functions with no line number
Functions may in an instrumented binary but not in the original source when they're inserted by the compiler or the runtime. These functions aren't meaningful to the user, so teach llvm-cov to skip over them instead of crashing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204863 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IR/GCOV.cpp')
-rw-r--r--lib/IR/GCOV.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/IR/GCOV.cpp b/lib/IR/GCOV.cpp
index dc9cb4b2a8..f69bdc4f8c 100644
--- a/lib/IR/GCOV.cpp
+++ b/lib/IR/GCOV.cpp
@@ -308,6 +308,11 @@ void GCOVFunction::dump() const {
/// collectLineCounts - Collect line counts. This must be used after
/// reading .gcno and .gcda files.
void GCOVFunction::collectLineCounts(FileInfo &FI) {
+ // If the line number is zero, this is a function that doesn't actually appear
+ // in the source file, so there isn't anything we can do with it.
+ if (LineNumber == 0)
+ return;
+
for (SmallVectorImpl<GCOVBlock *>::iterator I = Blocks.begin(),
E = Blocks.end(); I != E; ++I)
(*I)->collectLineCounts(FI);