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

    <tr>
        <th>Summary</th>
        <td>
            Unify getPrototypeLoc functions in InlayHints.cpp and SemaCodeComplete.cpp
        </td>
    </tr>

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

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

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

<pre>
    We have two almost-identical utility functions, [`getPrototypeLoc()`](https://searchfox.org/llvm/rev/269c29ae67e54bd3243535a7c58d0f30d1eb9036/clang-tools-extra/clangd/InlayHints.cpp#345) in `clang-tools-extra/clangd/InlayHints.cpp` and [`GetPrototypeLoc()`](https://searchfox.org/llvm/rev/269c29ae67e54bd3243535a7c58d0f30d1eb9036/clang/lib/Sema/SemaCodeComplete.cpp#6289) in `clang/lib/Sema/SemaCodeComplete.cpp`.

To avoid code duplication and divergence in behaviour, we should unify them.

I think `HeuristicResolver` is a good place for a common implementation, as it fits the profile of what these functions are doing (trying to recover a `FunctionProtoTypeLoc` from a call expression on a best-effort  basis).
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzEU02PpDYQ_TXmUuqWu_hoOHCYzIrMSjlEyUY5G7sAJ8aFbMNM__vIrV5NZpRDcsoJZCi_j3pPxWhnT9SL-geB-GLn5ZnXVXlDoRKIov5SqD0tHPqP34qRza3_nWBRB0F6ZVBu5ZhO1pBPVisHe7LOphtMu9fJso8CnyHjNHKm9HPgxOm20U-sBbYCO9FIUX8R2C4pbVGUTwIHgUMkFfQy8duZwyxwcO5YBQ6BDoEDNp3GTlFzpboaTYlVWZe1uuq6NXIqpbnQ2MmyEThop_x8SswunugtBfX9zAgcvnqnbi_Wp3jW2yawLKtaYAfWg2jkfxltJChvHjp__L905nk7Chx-pVU9Hs9s6JnXzVGih8oG2-6TzH812cizkE9CPn1jUAdbA5oNgdk3Z7XKy76bYOxBYSavKSOMtKjD8h5yDl4J4sK7M7B7O90gLbQ-7vwKabH-z8zohfZgY7L6F4rsDgrZXhtBwcxsYHNKE0wcQIHmdWUPNrNcyac7i4ykItgEk00xg8AWeLKOgCd4XVTKZ5HeMwoqEBi2fgaBbQq3_JYYAmk-KAOJRg6Pv--7_fbYbSNhCrxmKso5oLctUIzZiuwGjBTTiaaJQwIYVbRRYHcuTF-aruxUQf3lWnXYXsq6Kpa-oq6aVNnqsiynrlXKTKNElEhjp9trW9geJdaykVd5xe5SnZu6rK7XqW2nuqqpbUQlaVXWnXOQcqYKG-NO_aUqsZKFUyO5-Oj99zDf-x76PHEa9zmKSjobU3y_I9nkqP_tvrNPLf6bidbDx1rc4_BPUSr24PqPRZhtWvbxrHl9b8Gd0Rb4D9JJ4HBXEgUODzFHj38FAAD__11ikWc">