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

    <tr>
        <th>Summary</th>
        <td>
            [Clang] NoReturn attr drops previous AttributedTypes
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

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

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

<pre>
    ``` c
__attribute__((preserve_most))
__attribute__((noreturn))
void f();
```

The type produced by `GetTypeForDeclarator` is a FunctionProtoType with
 the right ExtInfo. The problem is a AnnotatedType for the calling convention is no present in the type. That means it's impossible to find the attribute responsible
for the ExtInfo value, reducing the expressivity of diagnosis.

Another issue it seems it breaks an expected invariant of `handleFunctionTypeAttr`(Calling Convention
attribute should always produce an AttributedType).
It is possible to specify contradicting calling conventions as long as there
a noreturn between them. Only the last calling convention attribute is taken into account, while the other ones are silently ignored.

The culprit is `FunctionTypeUnwrapper::wrap` in `SemaType.cpp`

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxslM-O4zYMxp9GuRAbKHL-HnzwzjTFXtqi3QJtLwNaZmx1ZcmQaGfz9gWVycyiu4ABJ9BH8uOPtDBn1weiWu0-qt3zCmceYqoXven--vufVRu7W632-v6AVbp5eUHm5NqZ6eVFmaMyxylRprTQyxgzK3OS54fCEBPxnMKbZomug0s5PKnqo9LNWzH5rZvPAwHfJoIpxW621EF7A7XXPxN_vk10jumZrMeEHJM4dBkQznOw7GL4LUWOIoOr40HpBnggSK4fGH76yp_CJa5BKkwptp7Ge3QTQmRk6krkJaYSZdF7F3qwMSwUJLuoQ4TSfGBwoejErCRFhpEwZHCszCGDG6eYs2s9AUe4uNAV-RsiSJSnGIpC6eZR9tUmLOhnUuYJEnWzFSNySl-lenaL4xvEC3QO-xCzy-s7vSZEHiiBy3kmcAyZaBRL0CbCLxkwSA6yTB24sGByGFgyqb0eMHSeHiwFRsMskJU5Pr3SeHqjoXTz3kse4uw7QH_FW36MToo1D0mBq8xJjH5iQfktnjyRdZebwOaEnbNc0H83ggyYwcfQy1s6FXQIjzWDlvhKVAYzruHX4G8Fm8fMPxroewMuA-MXCuACR0Br4xxY8F8HJxYHgjvZGCgDJoLsPAX2N3C9lO_W7_trZz8lV5pUe_0t0D_DNeE0UVJVo6pG_pQlDiL8g0YU0dpO0_17WHV11Z2qE66o3hyqaq8PB1Othtq2utrhXlfHw9Za3OBJH9qNthfc22pbVStXG222G6MPZrM1ulof28tRX_YH0x13u6M9qa2mEZ1fe7-M65j6VdmZerM56dN-5bEln8slYYz1GHpljNwXqZaAD-3cZ7XV3mXO7ynYsS83y1OJ2D3DL_H3-2QENXQpTrIetLg45_8tR17NydcD85SFjjkrc-4dD3O7tnFU5ixlXl8fphT_JcvKnIvtrMz51flSm_8CAAD__1Xjq4g">