Commit c049583
authored
[llvm] add LLVM_ABI_FRIEND macro for friend function decls (llvm#136595)
## Purpose
Introduce a new `LLVM_ABI_FRIEND` macro to `llvm/Support/Compiler.h` for
annotating `friend` function declarations for DLL export.
## Overview
1. Add a new `LLVM_ABI_FRIEND` macro, which behaves identically to the
existing `LLVM_ABI` macro on Windows and compiles to nothing on other
platforms.
2. Update existing documentation to describe proper usage of the
`LLVM_ABI_FRIEND` annotation.
## Background
* MSVC issues a warning when it encounters a `friend` function
declaration that does not match the DLL import/export annotation of the
original function.
* When compiling ELF and Mach-O shared libraries, `friend` function
declarations with visibility annotations produce compilation errors
(GCC) and warnings (Clang).
* Additional context on the effort to annotate LLVM's public interface
is in [this
discourse](https://discourse.llvm.org/t/psa-annotating-llvm-public-interface/85307).1 parent ab4e181 commit c049583
File tree
2 files changed
+17
-6
lines changed- llvm
- docs
- include/llvm/Support
2 files changed
+17
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
225 | | - | |
226 | | - | |
227 | | - | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
228 | 229 | | |
229 | 230 | | |
230 | 231 | | |
| |||
236 | 237 | | |
237 | 238 | | |
238 | 239 | | |
239 | | - | |
| 240 | + | |
240 | 241 | | |
241 | 242 | | |
242 | 243 | | |
243 | 244 | | |
244 | 245 | | |
245 | | - | |
246 | | - | |
| 246 | + | |
| 247 | + | |
247 | 248 | | |
248 | 249 | | |
249 | 250 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
170 | 175 | | |
171 | 176 | | |
172 | 177 | | |
| |||
183 | 188 | | |
184 | 189 | | |
185 | 190 | | |
| 191 | + | |
186 | 192 | | |
187 | 193 | | |
188 | 194 | | |
| |||
196 | 202 | | |
197 | 203 | | |
198 | 204 | | |
| 205 | + | |
199 | 206 | | |
200 | 207 | | |
201 | 208 | | |
202 | 209 | | |
| 210 | + | |
203 | 211 | | |
204 | 212 | | |
205 | 213 | | |
206 | 214 | | |
207 | 215 | | |
| 216 | + | |
208 | 217 | | |
209 | 218 | | |
210 | 219 | | |
211 | 220 | | |
212 | 221 | | |
213 | 222 | | |
| 223 | + | |
214 | 224 | | |
215 | 225 | | |
216 | 226 | | |
| |||
0 commit comments