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

    <tr>
        <th>Summary</th>
        <td>
            Adding `availability` attribute overrides visibility of symbols
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          var-const
      </td>
    </tr>
</table>

<pre>
    Symbols annotated with `__attribute__((availability))` always have default visibility, even if marked with `__attribute__((__visibility__("hidden")))` and compiled with `-fvisibility=hidden`. Self-contained repro (courtesy of @ldionne):
```cpp
// Compile with: clang++ -xc++ - -shared -o a.out -fvisibility=hidden -fvisibility-inlines-hidden
// Check symbols with: nm -omg a.out | c++filt | grep value
template <class T>
struct foo {
 __attribute__((__visibility__("hidden")))
 __attribute__((availability(macos,strict,introduced=10.13)))
    T value() const { return 0; }
};

int f(foo<int> x) {
    return x.value();
}
```

Running `nm` on the resulting binary shows it contains
```
a.out: 0000000000000408 (__TEXT,__text) weak external foo<int>::value() const
```
Annotating a symbol with availability should not affect its visibility.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJycVM2O6jgTfRpnUwoydkjCIos0dD_Ad3vx7ZATV4inHRvZFX7efmQIavrO1SwGWQLb1Dl1qk5ZxWiODrFhmze22WdqptGH5qxC3nsXKeu8vjW_blPnbQTlnCdFqOFiaARW8sNBEQXTzYSHAxM1E7U6K2NVZ6yhGxPbtEoOyl7ULcKozggaBzVbgrOJ5vm_HeAZHZgBJhW-_p3hcPiOXM7EaLRGx4RYKBdWp6H308nYF8R8eCGW-yWy5Cv4hXZIukkZhxoCnoIHJurez4Ew3sAPwAputfHOYeKQLeMtK_lj9adT2ooPJj5g9-C90zLZQm-VOzLxxsQb5Nf--QvyOKqAGnIPauVngj_m9-M0N84ahzFfcv_mHLH_gri068nsJsj9dFzgWbWDhX0w9rE_BjzBWdkZGW8Jp5NVhMDkrrcqRvhk8p3xNlKYe4LBe2DVG-Mt_Pfm_Dn4p3fqSfU-MrGLFExPTOyMo-D13KNmcr_mq7X8gQgAn4uMBLeFu4dTshCQ5uCAM_kGrNqnklV7JpMKxlvjCAYm6sF7JhMLk-9wTQiLUIAnwnX1QrAAPPCeLnhA_m92zrhjMpybkhe9AxoRAsbZUrrpjFPhBnH0lwiGYDFe_A3r3rXURv76KXgN92p_vv__k4nd4UB4pZTxBdUX4JUwOGXhVVFyq2z_UZ_f-NrHkKcM1WKlx-i8NidlPVsNzhOoYcCewFB8mehVphupt3KrMmzWVSFLUfKqysZG80rLbaeVFlu1Wau61jUvN7KShdyUhchMI7jY8IILwWUhq1U3lKLolcJtWQ-bXrKC46SMXVl7nlY-HDMT44zNWhbrzTqzqkMb7y-aEA4vcL9N7tvss9CkoLybjzFNsokUv2HIkMWm1Xpp3A87pufk6VfwZwzBaHyVnF6HZfSyOdhmJDrFVPP7bB4NjXO36v3ExEdiXL7yU_B_YXL3xz3PyMTHIuTciL8DAAD___LJxf8">