[GCC-XML] Source line references

David Coppit david at coppit.org
Fri Aug 4 14:55:47 EDT 2006


Assuming that Daniel J. Lauk's function body code gets integrated into
gccxml soon, will it be possible to associate nodes in the AST with
specific line numbers in the original source?

What I want to do is modify coverage reported by gcov so that if the
contents of a conditional are not covered, then the conditional is not
marked as covered. For example, consider the following gcov output:

         -:    0:Source:hello.cc
         -:    0:Graph:hello.gcno
         -:    0:Data:hello.gcda
         -:    0:Runs:1
         -:    0:Programs:1
         1:    1:int main(int argc, char *argv) {
         1:    2:  int x = 2;
         1:    3:  if (argc==2)
     #####:    4:    x=3;
         1:    5:  return x;
         -:    6:}

I'd like to mark line 3 as "uncovered". To do so, I would need to traverse
the AST, check the coverage for all children of "if" nodes, and adjust the
coverage for the "if" lines as necessary.

But none of that will work if the AST doesn't have line number information
for each AST node. Does (will) it?

Thanks,
David

_____________________________________________________________________
David Coppit                           david at coppit.org
The College of William and Mary        http://coppit.org/

Single sanction punishment doesn't work for presidents or cheaters.
http://www.coppit.org/blog/archives/119



More information about the gccxml mailing list