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

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

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    Hi,I'm using Clang libtooling to develop a tool which can insert a `printf` statement behind every statement to trace the project. For example:
```c
int main(){
int a=1000;
}
```
Insert a `printf` statement
```c
int main(){
int a=1000;
printf("int a=1000;");
}
```
So I need to obtain the source code location of the AST node and i have used ```Stmt->getLocEnd()``` to solve this problem.However, this method doesn't work when the ```callExpre``` defined in the macro.
for example:
i use ```ParenExpr ->getLocStart()``` to get the source location,however ```ParenExpr ->getLocStart().isFileID()``` is false so it isn't ```isRewritable```
here's the source code
```
jas_image_setclrspc(dec->image, JAS_CLRSPC_SRGB);
```
head file
```
#define jas_image_setclrspc(image, clrspc) \
        ((image)->clrspc_ = (clrspc))
```
ast structure
```
ParenExpr 0x5572db3e2f20 </home/insertGithubProject/jasper-version-1.900.1/jasper-version-1.900.1/src/libjasper/include/jasper/jas_image.h:351:2, col:30> 'jas_clrspc_t':'int'
  | | | `-BinaryOperator 0x5572db3e2ef8 <col:3, col:29> 'jas_clrspc_t':'int' '='
  | | |   |-MemberExpr 0x5572db3e2d70 <col:3, col:12> 'jas_clrspc_t':'int' lvalue ->clrspc_ 0x5572db382bc0
  | | |   | `-ImplicitCastExpr 0x5572db3e2d58 <col:3, col:9> 'jas_image_t *' <LValueToRValue>
  | | |   |   `-ParenExpr 0x5572db3e2d38 <col:3, col:9> 'jas_image_t *' lvalue
  | | |   | `-MemberExpr 0x5572db3e2d00 </home/insertGithubProject/jasper-version-1.900.1_backup/jasper-version-1.900.1/src/libjasper/jpc/jpc_dec.c:153:23, col:28> 'jas_image_t *' lvalue ->image 0x5572db3bd640
  | | |   | `-ImplicitCastExpr 0x5572db3e2ce8 <col:23> 'jpc_dec_t *' <LValueToRValue>
 | | |   |         `-DeclRefExpr 0x5572db3e2cc0 <col:23> 'jpc_dec_t *' lvalue Var 0x5572db3e2968 'dec' 'jpc_dec_t *'
```
Due to the fact that the function call statements in the source code are parsed as actual operations nodes when this function is defined in the macro, the ast structure is not a ```callExpr``` but a ```binaryOperation```, resulting in the inability to obtain the ```Rewritable``` source location .could you please give me some suggestions to get the souce location of the statement in source code,thank you!
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykV91y2rASfhpxswMjZLDhggsCoc2Znjmd0OktI0trrFSWPJJMmrc_I5v_Om06zRBA0mq__WP3M_de7Q3igkwfyHQ94E0orVu8KBwySukgt_Jt8VkRtnoiLKug8crsYaW52YNWebBWx41gQeIBta2BQ9yE11KJEgQ3oIxHF4ADSWntlAkFSSn4wANWaALkWCojAQ_o3q62g4XguEAIJULt7AuKMIKNdYA_eVVrJMmS0DWhS5LS7iW6tTIBKq4MYTPC5iR7uGxzkqzHlFKSHDdJtr5T0i2ffm_0vwMflUZJdi_AWLz-JxO3Fp7AIMoYKpsHrkwbK28bJxCElQjaCh6UNWCL9my5_QYmHnAjQUHJDwiNRwln3dtQhSFJHvcYvljxaOTRmdN5BPNWH2JelI-JyTVWo8_2NSaQsFW3X2EorQRp0RvCsgCv1v2A1xI7Gy-R41o__qwdXgAkFsqghKM7FRfOjjqXi57sq-jAReFX7tBEjXDxYhu4Cz1-7DFcR-wULMJWZefOh9WOlN8ojU_rexTloeDaRwxQAdQxGmcB5Z_x1anAc413-S3RIWGZv09qbzG8cL9TFd_jzmMQ2vlaEDaTKKK57UFMzX-W293qy_P262q3ff70cFNl9-BcQqF0PxphSZcl6Mc9A5525kCmq-NdOm-DdBKaRws7uR2QZA2Ezc7X4qvPAO4D-OAaERrXb-IlYfTndJoxmSfICka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