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

    <tr>
        <th>Summary</th>
        <td>
            ms_abi attribute causes getTypeLoc.IgnoreParens().getAs<FunctionTypeLoc>() to return invalid FunctionTypeLoc
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          souragc
      </td>
    </tr>
</table>

<pre>
    When running a tool that traverses the AST and does some operations on the Decl is used with a program that has `__attribute__((ms_abi))`, it causes the below snippet to return an invalid `FunctionTypeLoc`.

```cpp
FunctionDecl *FD = cast<FunctionDecl>(D);
TypeSourceInfo *TS = FD->getTypeSourceInfo();
FunctionTypeLoc FTL = TS->getTypeLoc().IgnoreParens().getAs<FunctionTypeLoc>();
```

The source code is just a one-line file as follows:

```c
int* __attribute__((ms_abi)) a(void) {}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyck0tr6zwQhn_NeDMkyFIu9sKLtK6h0MUHCXzLIMsTW0WRjC4J_fcHO02bUw4cOCB8kfTMvK9mJEPQvSWqYP0E6zqTKQ7OV8ElL3uVta77qP4fyKJP1mrbo8TonME4yIjRywv5QAHjQLjbH1DaDjtHAYM7E7qRvIza2YDOzntqUgZ1wBSow6uOA0ocveu9PN9CDjIgbNjxKGP0uk2RjkfgBfDiHI6y1cDLaWwY8GfUEZVM9_wtGXfFYPU4UsTo0FNM3qK0qO1FGt1NkZtk1STp8DHSm1OwYUtgNbDd53PDbkON423mDszSge-aGkHUqGSIIJ4fV0G8AC_qSZ94usFTlr1LXtGrPbkJP-xnvKkXIF56ir_vmK1-4z_EYnN4m-nD_oGeXMzY8rW3ztN_0pMNn1M9xV140HkHZqmPqb6MP57GYSAMszhUrqOpcu8pRJToLC2MtoQnbQhlwJMzxl0DiN2fj_P2r20EvsO_lBcl8OLidDd9w_YJtvWPcFlXia4UpcyoyrcsL3JWrrbZUBWia0mJnOe0oZwXm_IkVi2txKkrVbdmma444yLnbM3zfL3aLlWRb9qTYFLlXbktFKwYnaU2S2Mu56XzfaZDSFRtV2u-zoxsyYT5tnBu6YrzInA-XR5fTcyiTX2AFTM6xPAdJepoqLrZxC_79wb-ruW_VPGh2--t_mNrlryphhjHuUK8Ad70Og6pXSp3Bt5MMj9fi9G7d1IReDObC8Cb2fyvAAAA__-dAk_Z">