<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>