[all-commits] [llvm/llvm-project] 058056: [llvm] annotate interfaces in llvm-c for DLL expor...

Andrew Rogers via All-commits all-commits at lists.llvm.org
Tue Jul 8 08:50:44 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 058056329982db13d513bc05d3c98f6558418242
      https://github.com/llvm/llvm-project/commit/058056329982db13d513bc05d3c98f6558418242
  Author: Andrew Rogers <andrurogerz at gmail.com>
  Date:   2025-07-08 (Tue, 08 Jul 2025)

  Changed paths:
    M llvm/CMakeLists.txt
    M llvm/include/llvm-c/Analysis.h
    M llvm/include/llvm-c/BitReader.h
    M llvm/include/llvm-c/BitWriter.h
    M llvm/include/llvm-c/Comdat.h
    M llvm/include/llvm-c/Core.h
    M llvm/include/llvm-c/DebugInfo.h
    M llvm/include/llvm-c/Disassembler.h
    M llvm/include/llvm-c/Error.h
    M llvm/include/llvm-c/ErrorHandling.h
    M llvm/include/llvm-c/ExecutionEngine.h
    M llvm/include/llvm-c/IRReader.h
    M llvm/include/llvm-c/LLJIT.h
    M llvm/include/llvm-c/LLJITUtils.h
    M llvm/include/llvm-c/Linker.h
    M llvm/include/llvm-c/Object.h
    M llvm/include/llvm-c/Orc.h
    M llvm/include/llvm-c/OrcEE.h
    M llvm/include/llvm-c/Remarks.h
    M llvm/include/llvm-c/Support.h
    M llvm/include/llvm-c/Target.h
    M llvm/include/llvm-c/TargetMachine.h
    M llvm/include/llvm-c/Transforms/PassBuilder.h
    A llvm/include/llvm-c/Visibility.h
    M llvm/include/llvm-c/blake3.h
    M llvm/include/llvm/Config/llvm-config.h.cmake
    M llvm/include/llvm/Support/Compiler.h
    M llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
    M llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp
    M llvm/lib/Target/X86/MCA/X86CustomBehaviour.cpp
    M llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp
    M llvm/lib/Target/X86/TargetInfo/X86TargetInfo.cpp
    M llvm/lib/Target/X86/X86AsmPrinter.cpp
    M llvm/lib/Target/X86/X86TargetMachine.cpp

  Log Message:
  -----------
  [llvm] annotate interfaces in llvm-c for DLL export (#141701)

## Purpose

This patch is one in a series of code-mods that annotate LLVM’s public
interface for export. This patch annotates the `llvm-c` interface with a
new `LLVM_C_ABI` annotation, which behaves like the `LLVM_ABI`. This
annotation currently has no meaningful impact on the LLVM build;
however, it is a prerequisite to support an LLVM Windows DLL (shared
library) build.

## Overview

1. Add a new `llvm-c/Visibility.h` header file that defines a new
`LLVM_C_ABI` macro. The macro resolves to the proper DLL export/import
annotation on Windows and a "default" visibility annotation elsewhere.
2. Add a new `LLVM_ENABLE_LLVM_C_EXPORT_ANNOTATIONS` `#cmakedefine` that
is used to gate the definition of `LLVM_C_ABI`.
3. Remove the existing `LLVM_C_ABI` definition from
`llvm/Support/Compiler.h`. Update the small number of `LLVM_C_ABI`
references to get it from the new `llvm-c/Visibility.h` header.
4. Code-mod annotate the public `llvm-c` interface using the [Interface
Definition Scanner (IDS)](https://github.com/compnerd/ids) tool.
5. Format the changes with `clang-format`.

## Background

This effort is tracked in #109483. Additional context is provided in
[this
discourse](https://discourse.llvm.org/t/psa-annotating-llvm-public-interface/85307),
and documentation for `LLVM_ABI` and related annotations is found in the
LLVM repo
[here](https://github.com/llvm/llvm-project/blob/main/llvm/docs/InterfaceExportAnnotations.rst).

## Validation

Local builds and tests to validate cross-platform compatibility. This
included llvm, clang, and lldb on the following configurations:

- Windows with MSVC
- Windows with Clang
- Linux with GCC
- Linux with Clang
- Darwin with Clang



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