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

    <tr>
        <th>Summary</th>
        <td>
            -Wunused-function, the alias attribute, and MicrosoftDemangle
        </td>
    </tr>

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

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

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

<pre>
    Clang supports the [`alias` attribute](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-alias-function-attribute) from GCC.
While primarily used for C projects on ELF platforms and possibly also windows-gnu, Clang accepts the `alias` attribute for windows-msvc targets as well.

This scenario is more like "the feature is generic, let's make it available for everyone" rather than "there are active users of this for windows-msvc".
After removing some false positive results from `rg '\(_?_?alias|::alias' -l | xargs grep -l windows`, there is nearly no test.
I recently added one in `clang/test/Sema/alias-unused-win.cpp`.

The `-Wunused-function` diagnostic does not know how to connect an alias target to an internal linkage declaration, so we will get a false positive.

```
static int f1() { return 42; } // cxx-warning{{unused function 'f1'}}
int g1() __attribute__((alias("?f1@@YAHXZ")));
```

This can be fixed if #88823 is available.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsVF2vozYQ_TWTlxERMcmFPOQhIaWt1H1pK23bl6vBDOBeYyPbJDf_vjKQ3e3dlUwif82cOed4yHvVGeYTHC5wuG5oCr11p0_k336nx6a2zeNUajId-mkcrQseQ88YT7-kpBV5eEmRQnCqngLD4Qqi6EMYPWRnEBWIqpNy25lpa10HorJGK8ONlX7ZAlGVdhisSarJyKCsSc7PaH7bh0GDyJRp-D2Z0yXt89jXpOKIrbMD_lyWW0ivkJ4_90ozjk4N5JR-4OS5wdY6LHF09l-WwaM1-NNvFY6aQmvd4JFMg6P1XtX6gaS9xbsyjb37pDMTiBIXIkhKHp88_IiEOdHz6uBvEgO5joNH8nh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