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

    <tr>
        <th>Summary</th>
        <td>
            Refactor uses of `Cand->Function` in `SemaOverload.cpp`
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            good first issue,
            code-cleanup
      </td>
    </tr>

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

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

<pre>
    We use `Cand->Function` all over `SemaOverload.cpp` e.g. 

https://github.com/llvm/llvm-project/blob/main/clang/lib/Sema/SemaOverload.cpp#L12583-L12585

In some places it is safe to use without checking b/c in the calling function we checked it prior. It is hard to see that without carefully checking the call chain.

It seems like once we check `Cand->Function` we should pass it as a separate `FunctionDecl*` argument and assert on that argument or at minimum we should assert on `Cand->Function` in the called function.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUk81q3DAQx59GvgxrbPljdw8-pNkaAoVCe-h5LM_aamTJaKQNefsib5JNoCn0ooGZ4f-bLyGznixRJ5ovojllGMPsfMcznvVjNrjxuftFEJlAtMU92nEnqq99tCpoZ0VbABoD7kI-xX_Sgt8v5I3DMVfrmuKUTzmI4iSKu-s7h7CyqO6E7IXsJx3mOOTKLUL2xlxezW717jepIGQ_GDcI2S-orZC9MminlKSTMxFfzAewrL6VsjlUu8007_kPFtgtBKtBRQw6gGZgPBMEtzX6pMPsYgA1k3rUdoIEUqAthJlAoTHJeX6ZATzRNZPGpLV67XwOD5vqjH5MqkwEYcZwk0ZP52jM8w3yqg1qRm3zDxWHpLAwGP1I4KyiN-hnW3ki4NlFM8KKvDWJDAhMK3oM2zJf00-kjJB32y79FBeyAdCOgMzkAzh7Lf0t5jxggEVbvcTlHeiW_0lN7wZI49v88mzsqvFYHTGjrtzLsmgP9b7M5q4aJBI2zbGpsZTHompk2bT7UpZ125S1ynQnC1kX-7IpD1VdlXmtqraRw9jSsW0PQyvqghbUJk8XlTs_ZZo5Unc8HGuZGRzI8Hb4Uk7OjXDWntPiOJKQUsh7IaVyI-2UIbRxTc7mlPluu9AhTizqwmgOfCMEHQx1P-iMKjifDorBnf8xk7__myx60_33V9lKZyH7a4eXTv4JAAD__727QjM">