<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 1 June 2014 22:50, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<div class="">On Fri, Apr 18, 2014 at 4:32 PM, Nick Lewycky <<a href="mailto:nicholas@mxc.ca">nicholas@mxc.ca</a>> wrote:<br>
> Author: nicholas<br>
> Date: Fri Apr 18 18:32:28 2014<br>
> New Revision: 206671<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=206671&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=206671&view=rev</a><br>
> Log:<br>
> Check whether functions have any lines associated before emitting coverage info for them. This isn't just a size/time saving, gcov may crash on these.<br>
<br>
</div>:( lack of test coverage.<br>
<div class=""><br>
><br>
> Modified:<br>
>     llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp<br>
><br>
> Modified: llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp?rev=206671&r1=206670&r2=206671&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp?rev=206671&r1=206670&r2=206671&view=diff</a><br>


> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp Fri Apr 18 18:32:28 2014<br>
> @@ -449,6 +449,21 @@ bool GCOVProfiler::runOnModule(Module &M<br>
>    return false;<br>
>  }<br>
><br>
> +static bool functionHasLines(Function *F) {<br>
> +  // Check whether this function actually has any source lines. Not only<br>
> +  // do these waste space, they also can crash gcov.<br>
> +  for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) {<br>
> +    for (BasicBlock::iterator I = BB->begin(), IE = BB->end();<br>
> +         I != IE; ++I) {<br>
> +      const DebugLoc &Loc = I->getDebugLoc();<br>
> +      if (Loc.isUnknown()) continue;<br>
> +      if (Loc.getLine() != 0)<br>
<br>
</div>Well, at least this condition isn't covered - asserting that<br>
Loc.getLine() != 0 just before the condition never asserts in make<br>
check-llvm...<br></blockquote><div><br></div><div>Fixed in r210239. :)</div><div><br></div></div><br></div></div>