[llvm] [llvm] add LLVM_FRIEND_ABI macro for friend function decls (PR #136595)

Andrew Rogers via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 21 16:22:45 PDT 2025


andrurogerz wrote:

> BTW, would it be possible to spell that as `LLVM_ABI_FRIEND`

Sure, I will do that.

> I don't understand the reason for `LLVM_ABI_EXPORT`, we should be able to use `LLVM_ABI` for that no?

I can't find any instances of `LLVM_ABI_EXPORT` in the source tree. I was initially hesitant to remove it because of the comment in this file, but I never encountered a need for it. I'll go ahead remove it.

> The TEMPLATE_ABI and LLVM_EXPORT_TEMPLATE would be nice to merge somehow if possible.

They can't be merged. We may be able to get rid of `LLVM_EXPORT_TEMPLATE` and just use `LLVM_ABI` in its place. I will take another look at that one.. However, we do need an "import only" macro for `extern` template instance declarations because MSVC warns when you decorate any `extern` declaration for export with `__declspec(dllexport)` (`dllimport` is fine). That's what `LLVM_TEMPLATE_ABI` is used for. We *could* rename it `LLVM_ABI_IMPORT`, but since the only case I found it required is for extern template instance declarations, I suppose its current name makes sense.

For the most part, people will just need to know `LLVM_ABI` and everything else is fairly special-case.

https://github.com/llvm/llvm-project/pull/136595


More information about the llvm-commits mailing list