<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/58594>58594</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            use Stmt->getSourceRange() function to get  the source code location corresponding to the AST node
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          jie-2000
      </td>
    </tr>
</table>

<pre>
    i am using clang plugin to develop a tool which can insert a 'printf' statemente behind every statement to trace the project.for example:
```
int main(){
int a=1000;
if(a==1000){
a=999;}
}
```
insert a 'printf' statemente
```
int main(){
int a=1000;
printf("int a=1000;");
if(a==1000){
a=999;
printf("a=999;");}
}
```
i use the structure of the 'printFunctionName' in the clang'example to realize.
i need to get the complete source code location corresponding to the ASTnode so that i can insert the 'printf' statement in the right location.however i found i can't use the Stmt->getSourceRange() function to get the complete location range for some Specific type statement.for example,BinaryOperator,UnaryOperator.
```
a=1000;
```
```
| | | |-BinaryOperator 0x565356502960 <line:13:3, col:5> 'int' '='
| | | | |-DeclRefExpr 0x565356502918 <col:3> 'int' lvalue Var 0x565356502880 'a' 'int'
| | | | `-IntegerLiteral 0x565356502940 <col:5> 'int' 1000
```
In fact, these characters occupy 5 columns in the source code file, but only 3 columns are recognized.
```
a++;
```
```
-UnaryOperator 0x5653565029b0 <line:14:9, col:10> 'int' postfix '++'
| | | | `-DeclRefExpr 0x565356502988 <col:9> 'int' lvalue Var 0x565356502880 'a' 'int'
```
this is three chars for 3 column.but clang think it is 2 column.
do you have some idea to solve this problem?and coud you pleas give me some advices to better recognize the location for a complete sentence end with ';'?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJylVduOozgQ_RryYiUyJpDwwENfpqWRVrvS9M6-G1OAZ42NbJPu7NdvGUIS0t1z0UiBUHZdz6myS1MdC0l4RwYndUOE4vju1dBITbwhFRxAmZ5w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