diff options
author | Justin Bogner <mail@justinbogner.com> | 2014-03-26 22:03:06 +0000 |
---|---|---|
committer | Justin Bogner <mail@justinbogner.com> | 2014-03-26 22:03:06 +0000 |
commit | 95e0a7058194a50fa99dcc67e4721130ee94fbff (patch) | |
tree | e351473f928f806c03635f2858e8c33c95cc1770 /llvm/lib | |
parent | a773d086180050ae2694ce4d2e8e72f4ddff19cb (diff) | |
download | bcm5719-llvm-95e0a7058194a50fa99dcc67e4721130ee94fbff.tar.gz bcm5719-llvm-95e0a7058194a50fa99dcc67e4721130ee94fbff.zip |
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.
llvm-svn: 204863
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/IR/GCOV.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/IR/GCOV.cpp b/llvm/lib/IR/GCOV.cpp index dc9cb4b2a81..f69bdc4f8cc 100644 --- a/llvm/lib/IR/GCOV.cpp +++ b/llvm/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); |