<div dir="ltr">(+ a few folks who've been involved in the reviews, etc)<br><br><div class="gmail_quote"><div dir="ltr">On Mon, Sep 24, 2018 at 12:34 PM Calixte Denizet via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Hi,</div><div><br></div><div>When making code coverage, there are some counters on closing braces.</div><div>In some case it's due to "return void" with a debugloc corresponding to '}' (see line 4) or due to cleanup stuff put at the end of a scope (see line 20, aaa's dtor is called).</div><div>Especially with c++, some "implicit" code (i.e. not written explicitly by the user) could be added at the beginning of a scope and at the end.<br></div><div>Here are two example of outputs produced by clang and gcc.</div><div><br></div><div>With clang 7:<br>-:Â Â Â 1:struct A {<br>-:Â Â Â 2:<br>1:Â Â Â 3:Â Â Â A() {}<br>-:Â Â Â 4:Â Â Â <br>-:Â Â Â 5:Â Â Â ~A() {<br>1:Â Â Â 6:Â Â Â }<br>-:Â Â Â 7:};<br>-:Â Â Â 8:<br>-:Â Â Â 9:void foo(int K) {<br>1:Â Â 10:}<br>-:Â Â 11:<br>-:Â Â 12:int main() {<br>1:Â Â 13:Â Â Â A aaa;<br>1:Â Â 14:Â Â Â int x = 1;<br>1:Â Â 15:Â Â Â foo(x);<br>1:Â Â 16:Â Â Â x = x + 2;<br>-:Â Â 17:<br>1:Â Â 18:Â Â Â return x;<br>1:Â Â 19:}<br></div><br><div>With gcc 8:<br>-:Â Â Â 1:struct A {<br>-:Â Â Â 2:<br>1:Â Â Â 3:Â Â Â A() {}<br>-:Â Â Â 4:Â Â Â <br>1:Â Â Â 5:Â Â Â ~A() {<br>1:Â Â Â 6:Â Â Â }<br>-:Â Â Â 7:};<br>-:Â Â Â 8:<br>1:Â Â Â 9:void foo(int K) {<br>1:Â Â 10:}<br>-:Â Â 11:<br>1:Â Â 12:int main() {<br>1:Â Â 13:Â Â Â A aaa;<br>1:Â Â 14:Â Â Â int x = 1;<br>1:Â Â 15:Â Â Â foo(x);<br>1:Â Â 16:Â Â Â x = x + 2;<br>-:Â Â 17:<br>1:Â Â 18:Â Â Â return x;<br>-:Â Â 19:}</div><div><br></div><div>So I'd like to have coverage for lines which contain only "explicit" code to have a clear information to give to different kinds of people (I spent myself some time to understand why I had coverage on line like "} // namespace foo").</div><div>So we could add an option in clang (no idea of the name right now) to allow user to have coverage for explicit code.</div><div>And so have this output:<br>-:Â Â Â 1:struct A {<br>-:Â Â Â 2:<br>1:Â Â Â 3:Â Â Â A() {}<br>-:Â Â Â 4:Â Â Â <br>1:Â Â Â 5:Â Â Â ~A() {<br>-:Â Â Â 6:Â Â Â }<br>-:Â Â Â 7:};<br>-:Â Â Â 8:<br>1:Â Â Â 9:void foo(int K) {<br>-:Â Â 10:}<br>-:Â Â 11:<br>1:Â Â 12:int main() {<br>1:Â Â 13:Â Â Â A aaa;<br>1:Â Â 14:Â Â Â int x = 1;<br>1:Â Â 15:Â Â Â foo(x);<br>1:Â Â 16:Â Â Â x = x + 2;<br>-:Â Â 17:<br>1:Â Â 18:Â Â Â return x;<br>-:Â Â 19:}<br></div><div><br></div><div>Calixte<br></div></div></div></div></div></div>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div></div>