[all-commits] [llvm/llvm-project] c04958: [llvm] add LLVM_ABI_FRIEND macro for friend functi...

Andrew Rogers via All-commits all-commits at lists.llvm.org
Tue Apr 22 09:49:39 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c04958381e90c32381ddabf1552d17c63cdd060b
      https://github.com/llvm/llvm-project/commit/c04958381e90c32381ddabf1552d17c63cdd060b
  Author: Andrew Rogers <andrurogerz at gmail.com>
  Date:   2025-04-22 (Tue, 22 Apr 2025)

  Changed paths:
    M llvm/docs/InterfaceExportAnnotations.rst
    M llvm/include/llvm/Support/Compiler.h

  Log Message:
  -----------
  [llvm] add LLVM_ABI_FRIEND macro for friend function decls (#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).



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list