[llvm] [llvm] annotate interfaces in llvm/Support for DLL export (PR #136014)

Andrew Rogers via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 23 08:13:02 PDT 2025


andrurogerz wrote:

@nikic thank you for taking a look, I appreciate the questions and feedback.

> For example, are there ever cases where we don't want to add LLVM_ABI on classes with virtual methods?

I think it will be sufficient to have a simple "annotate at the class level for any class with a virtual method" rule. However, I have not found this to always be necessary in practice-- I think it depends on whether or not parts of the class or its children are implemented outside the class declarations. But simplicity should win here, and having a simple rule to follow would be better and (I think) simple enough to automate in IDS. I will get a definitive answer on this one, update the documentation to clarify, and attempt to update IDS to automate it.

> Though I can't say I really get under which circumstances we need LLVM_ABI on the class for non-virtual cases. E.g. why do we need it on StringSaver?

It should not be necessary on classes without virtual methods, and what you're seeing here are mistakes. There are a few classes where I elevated the annotation unnecessarily like `StringSaver`, `InitLLVM`, and `InitializeCOMRAII`. The key here is that class-level annotation is harmless, but we should avoid it in general so we don't blow past the 64K DLL export method limit. I will definitely fix the instances I find, though. Thank you for flagging it.

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


More information about the llvm-commits mailing list