Not able to print correct line numbers for then part of if statement,


I am playing around a bit of with clang and have hit a problem. For a Clang input with if statement, I am trying to obtain line number of beginning of Then statement and then print it out. But I am not able to make sense of the output. Can you please help. In a nutshell I am trying to get presumed loc from sourceloc of Then statement. For the following input, its printing 6 and 12 instead of 4 and 8.

Detailed description can be found at

My code (250 lines, but important stuff is between lines 100 and 105) is at

My input is

1 #include <stdio.h>

2 int func (int abc, int xyz) {

3     if (abc-1)
4     {
5         printf ("1\n");
6     }

7      if (abc-2)
8     {
9         printf ("2\n");

10 }


12 return 0;

13 }

Please let me know if you need any additional information. Compilation instructions are in the stackoverflow link.
Thanks very much

I've posted an answer on stackoverflow.

Got it. Thanks very much.