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

    <tr>
        <th>Summary</th>
        <td>
            [clang] All uses of getNoteDiagForInvalidRedeclaration are broken.
        </td>
    </tr>

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

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

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

<pre>
    Debugging a different issue, I found that SemaDecl.cpp's `getNoteDiagForInvalidRedeclaration` is used to get the dialog for 'previous definition'.  The diagnostic emitted is always done so without diagnostic arguments.

HOWEVER, one of the things it can return is `diag::note_previous_builtin_declaration`, which takes 2 inputs.

We likely need to refactor `getNoteDiagForInvalidRedeclaration` to return a partial diagnostic instead of the pair, and just emit that instead, PLUS make sure that everything it can result in has the correct number of arguments. There are a couple of places where the `PrevDiag` variable is re-used/re-assigned, so those probably need to be fixed as well.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMU8Fu4zYQ_Rr6MoggU7HkHHRI6zW6QNEudtvuMRiRI2limhTIod38fUE5QdJeugdbB868ee_NPEyJJ0_Uq91PanfYYJY5xJ4im_lE6GkzBPvSH2jI08R-AgTL40iRvACnlEnpn-EzjCF7CzKjwDc644GMq8yyKN0lUG09kfwWhA6M0zHEz_6Cju1XsmQcRhQOXrU1cIKcyIIEmEhAZgLL6MIEY4igdLdEunDICSyN7Hnt010F8MetdPIhCRugM4uQLYDorviSwAZPkAJcWeaQ5WMxximfyUuqVH1Q9ePt_5ffv3_669PXoq60hnGlIzP7KQELGPQQSXL0ZYpq64KomkfVPPog9PRG9WnI7IT907-1FtzrzGYGwRMl0MB-yf_h8J3A8YncC3i62RJpRCPFjB_1dG1aaSIsGIXRfRTPPgmhfdO3IMdCDb2F55xkdfK21tfK8vrl1z-_wRlPBClHuj3TheLLas-7Oym70gczphXdhBjJCPh8HiiWme_elxVGAiw_MCEvbjV9cWgowXV9LBiqrb9EuhTVRd4FI-PgqCwh0l05H6WPke5eD3vlmwLIHBLBEsOAwwc_B4KR_yYLmOBKzlUb2zf2oXnADfXbdr9r77d73W3mfq-3-n67x04_2G2LbbNru655qAfsbLPT3YZ7XeumbuvtttvVuqva0ZhG78eB9K7pmk7d13RGdpVzl3MV4rRZ89O3Td1uNw4HcmmNodaerm_h0iWVsS89d0OekrqvHSdJ7yjC4tb8God-UrsDPDpXgpSKgf9_JavnQwwn8tUmR9fPIksqp6yPSh8nljkPlQlnpY9l6OvnbonhmYwofVypJqWPq5R_AgAA__8ehXny">