Skip to content

[llvm] annotate new symbols for DLL export #148658

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 14, 2025
Merged

Conversation

andrurogerz
Copy link
Contributor

Purpose

This patch is one in a series of code-mods that annotate LLVM’s public interface for export. This patch annotates symbols that were added to LLVM in the last two weeks and were missed by previous code-mods. The annotations currently have no meaningful impact on the LLVM build; however, they are a prerequisite to support an LLVM Windows DLL (shared library) build.

Background

This effort is tracked in #109483. Additional context is provided in this discourse, and documentation for LLVM_ABI and related annotations is found in the LLVM repo here.

Overview

These changes were generated automatically using the Interface Definition Scanner (IDS) tool, followed formatting with git clang-format.

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

@llvmbot llvmbot added debuginfo HLSL HLSL Language Support llvm:ir labels Jul 14, 2025
@llvmbot
Copy link
Member

llvmbot commented Jul 14, 2025

@llvm/pr-subscribers-hlsl
@llvm/pr-subscribers-debuginfo

@llvm/pr-subscribers-llvm-ir

Author: Andrew Rogers (andrurogerz)

Changes

Purpose

This patch is one in a series of code-mods that annotate LLVM’s public interface for export. This patch annotates symbols that were added to LLVM in the last two weeks and were missed by previous code-mods. The annotations currently have no meaningful impact on the LLVM build; however, they are a prerequisite to support an LLVM Windows DLL (shared library) build.

Background

This effort is tracked in #109483. Additional context is provided in this discourse, and documentation for LLVM_ABI and related annotations is found in the LLVM repo here.

Overview

These changes were generated automatically using the Interface Definition Scanner (IDS) tool, followed formatting with git clang-format.

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

Full diff: https://github.com/llvm/llvm-project/pull/148658.diff

8 Files Affected:

  • (modified) llvm/include/llvm-c/DebugInfo.h (+6-5)
  • (modified) llvm/include/llvm/DWARFCFIChecker/DWARFCFIAnalysis.h (+5-3)
  • (modified) llvm/include/llvm/DWARFCFIChecker/DWARFCFIFunctionFrameAnalyzer.h (+2-1)
  • (modified) llvm/include/llvm/DWARFCFIChecker/DWARFCFIFunctionFrameStreamer.h (+2-1)
  • (modified) llvm/include/llvm/DWARFCFIChecker/DWARFCFIState.h (+3-2)
  • (modified) llvm/include/llvm/Frontend/HLSL/RootSignatureValidations.h (+18-17)
  • (modified) llvm/include/llvm/IR/RuntimeLibcalls.h (+1-1)
  • (modified) llvm/include/llvm/Target/RegisterTargetPassConfigCallback.h (+6-5)
diff --git a/llvm/include/llvm-c/DebugInfo.h b/llvm/include/llvm-c/DebugInfo.h
index 212c2e1c86a65..2ecd69a187d4d 100644
--- a/llvm/include/llvm-c/DebugInfo.h
+++ b/llvm/include/llvm-c/DebugInfo.h
@@ -700,7 +700,7 @@ LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateArrayType(
  * \param AlignInBits    Set alignment.
  * \param BaseTy         The base type of the set.
  */
-LLVMMetadataRef LLVMDIBuilderCreateSetType(
+LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateSetType(
     LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
     size_t NameLen, LLVMMetadataRef File, unsigned LineNumber,
     uint64_t SizeInBits, uint32_t AlignInBits, LLVMMetadataRef BaseTy);
@@ -722,7 +722,7 @@ LLVMMetadataRef LLVMDIBuilderCreateSetType(
  * \param Stride     Stride of the subrange.
  * \param Bias       Bias of the subrange.
  */
-LLVMMetadataRef LLVMDIBuilderCreateSubrangeType(
+LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateSubrangeType(
     LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
     size_t NameLen, unsigned LineNo, LLVMMetadataRef File, uint64_t SizeInBits,
     uint32_t AlignInBits, LLVMDIFlags Flags, LLVMMetadataRef BaseTy,
@@ -743,7 +743,7 @@ LLVMMetadataRef LLVMDIBuilderCreateSubrangeType(
  * \param Rank         Rank. (DIVariable, DIExpression or NULL)
  * \param BitStride    BitStride.
  */
-LLVMMetadataRef LLVMDIBuilderCreateDynamicArrayType(
+LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateDynamicArrayType(
     LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
     size_t NameLen, unsigned LineNo, LLVMMetadataRef File, uint64_t Size,
     uint32_t AlignInBits, LLVMMetadataRef Ty, LLVMMetadataRef *Subscripts,
@@ -756,8 +756,9 @@ LLVMMetadataRef LLVMDIBuilderCreateDynamicArrayType(
  *
  * @see DIBuilder::replaceArrays()
  */
-void LLVMReplaceArrays(LLVMDIBuilderRef Builder, LLVMMetadataRef *T,
-                       LLVMMetadataRef *Elements, unsigned NumElements);
+LLVM_C_ABI void LLVMReplaceArrays(LLVMDIBuilderRef Builder, LLVMMetadataRef *T,
+                                  LLVMMetadataRef *Elements,
+                                  unsigned NumElements);
 
 /**
  * Create debugging information entry for a vector type.
diff --git a/llvm/include/llvm/DWARFCFIChecker/DWARFCFIAnalysis.h b/llvm/include/llvm/DWARFCFIChecker/DWARFCFIAnalysis.h
index 3803dfd4ebd20..be1025e691561 100644
--- a/llvm/include/llvm/DWARFCFIChecker/DWARFCFIAnalysis.h
+++ b/llvm/include/llvm/DWARFCFIChecker/DWARFCFIAnalysis.h
@@ -38,6 +38,7 @@
 #include "llvm/MC/MCStreamer.h"
 #include "llvm/MC/MCSubtargetInfo.h"
 #include "llvm/MC/TargetRegistry.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -74,10 +75,11 @@ namespace llvm {
 /// checked, and in all other case(s), a warning is emitted.
 class DWARFCFIAnalysis {
 public:
-  DWARFCFIAnalysis(MCContext *Context, MCInstrInfo const &MCII, bool IsEH,
-                   ArrayRef<MCCFIInstruction> Prologue);
+  LLVM_ABI DWARFCFIAnalysis(MCContext *Context, MCInstrInfo const &MCII,
+                            bool IsEH, ArrayRef<MCCFIInstruction> Prologue);
 
-  void update(const MCInst &Inst, ArrayRef<MCCFIInstruction> Directives);
+  LLVM_ABI void update(const MCInst &Inst,
+                       ArrayRef<MCCFIInstruction> Directives);
 
 private:
   void checkRegDiff(const MCInst &Inst, DWARFRegNum Reg,
diff --git a/llvm/include/llvm/DWARFCFIChecker/DWARFCFIFunctionFrameAnalyzer.h b/llvm/include/llvm/DWARFCFIChecker/DWARFCFIFunctionFrameAnalyzer.h
index 70caceae563f1..03e93ded1f538 100644
--- a/llvm/include/llvm/DWARFCFIChecker/DWARFCFIFunctionFrameAnalyzer.h
+++ b/llvm/include/llvm/DWARFCFIChecker/DWARFCFIFunctionFrameAnalyzer.h
@@ -18,6 +18,7 @@
 #include "DWARFCFIFunctionFrameReceiver.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -27,7 +28,7 @@ namespace llvm {
 /// emitted through the `MCContext` instance to the constructor. If a frame
 /// finishes without being started or if all the frames are not finished before
 /// this classes is destructed, the program fails through an assertion.
-class CFIFunctionFrameAnalyzer : public CFIFunctionFrameReceiver {
+class LLVM_ABI CFIFunctionFrameAnalyzer : public CFIFunctionFrameReceiver {
 public:
   CFIFunctionFrameAnalyzer(MCContext &Context, const MCInstrInfo &MCII)
       : CFIFunctionFrameReceiver(Context), MCII(MCII) {}
diff --git a/llvm/include/llvm/DWARFCFIChecker/DWARFCFIFunctionFrameStreamer.h b/llvm/include/llvm/DWARFCFIChecker/DWARFCFIFunctionFrameStreamer.h
index 522010033f1a8..5a3cf4ab64a1f 100644
--- a/llvm/include/llvm/DWARFCFIChecker/DWARFCFIFunctionFrameStreamer.h
+++ b/llvm/include/llvm/DWARFCFIChecker/DWARFCFIFunctionFrameStreamer.h
@@ -20,6 +20,7 @@
 #include "llvm/MC/MCDwarf.h"
 #include "llvm/MC/MCInstrInfo.h"
 #include "llvm/MC/MCStreamer.h"
+#include "llvm/Support/Compiler.h"
 #include <memory>
 #include <optional>
 
@@ -30,7 +31,7 @@ namespace llvm {
 /// channels them to `CFIFunctionFrameReceiver`. A function frame is the machine
 /// instructions and CFI directives that are between `.cfi_startproc` and
 /// `.cfi_endproc` directives.
-class CFIFunctionFrameStreamer : public MCStreamer {
+class LLVM_ABI CFIFunctionFrameStreamer : public MCStreamer {
 public:
   CFIFunctionFrameStreamer(MCContext &Context,
                            std::unique_ptr<CFIFunctionFrameReceiver> Receiver)
diff --git a/llvm/include/llvm/DWARFCFIChecker/DWARFCFIState.h b/llvm/include/llvm/DWARFCFIChecker/DWARFCFIState.h
index 363f76a043bbd..57d2a4f827ae7 100644
--- a/llvm/include/llvm/DWARFCFIChecker/DWARFCFIState.h
+++ b/llvm/include/llvm/DWARFCFIChecker/DWARFCFIState.h
@@ -17,6 +17,7 @@
 #include "llvm/DebugInfo/DWARF/LowLevel/DWARFUnwindTable.h"
 #include "llvm/MC/MCContext.h"
 #include "llvm/MC/MCDwarf.h"
+#include "llvm/Support/Compiler.h"
 #include <optional>
 
 namespace llvm {
@@ -30,13 +31,13 @@ class DWARFCFIState {
 public:
   DWARFCFIState(MCContext *Context) : Context(Context), IsInitiated(false) {};
 
-  std::optional<dwarf::UnwindRow> getCurrentUnwindRow() const;
+  LLVM_ABI std::optional<dwarf::UnwindRow> getCurrentUnwindRow() const;
 
   /// This method updates the state by applying \p Directive to the current
   /// state. If the directive is not supported by the checker or any error
   /// happens while applying the CFI directive, a warning or error is reported
   /// to the user, and the directive is ignored, leaving the state unchanged.
-  void update(const MCCFIInstruction &Directive);
+  LLVM_ABI void update(const MCCFIInstruction &Directive);
 
 private:
   dwarf::CFIProgram convert(MCCFIInstruction Directive);
diff --git a/llvm/include/llvm/Frontend/HLSL/RootSignatureValidations.h b/llvm/include/llvm/Frontend/HLSL/RootSignatureValidations.h
index e9bdcee0d72df..f1e223da95241 100644
--- a/llvm/include/llvm/Frontend/HLSL/RootSignatureValidations.h
+++ b/llvm/include/llvm/Frontend/HLSL/RootSignatureValidations.h
@@ -16,6 +16,7 @@
 
 #include "llvm/ADT/IntervalMap.h"
 #include "llvm/Frontend/HLSL/HLSLRootSignature.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 namespace hlsl {
@@ -23,22 +24,22 @@ namespace rootsig {
 
 // Basic verification of RootElements
 
-bool verifyRootFlag(uint32_t Flags);
-bool verifyVersion(uint32_t Version);
-bool verifyRegisterValue(uint32_t RegisterValue);
-bool verifyRegisterSpace(uint32_t RegisterSpace);
-bool verifyRootDescriptorFlag(uint32_t Version, uint32_t FlagsVal);
-bool verifyRangeType(uint32_t Type);
-bool verifyDescriptorRangeFlag(uint32_t Version, uint32_t Type,
-                               uint32_t FlagsVal);
-bool verifyNumDescriptors(uint32_t NumDescriptors);
-bool verifySamplerFilter(uint32_t Value);
-bool verifyAddress(uint32_t Address);
-bool verifyMipLODBias(float MipLODBias);
-bool verifyMaxAnisotropy(uint32_t MaxAnisotropy);
-bool verifyComparisonFunc(uint32_t ComparisonFunc);
-bool verifyBorderColor(uint32_t BorderColor);
-bool verifyLOD(float LOD);
+LLVM_ABI bool verifyRootFlag(uint32_t Flags);
+LLVM_ABI bool verifyVersion(uint32_t Version);
+LLVM_ABI bool verifyRegisterValue(uint32_t RegisterValue);
+LLVM_ABI bool verifyRegisterSpace(uint32_t RegisterSpace);
+LLVM_ABI bool verifyRootDescriptorFlag(uint32_t Version, uint32_t FlagsVal);
+LLVM_ABI bool verifyRangeType(uint32_t Type);
+LLVM_ABI bool verifyDescriptorRangeFlag(uint32_t Version, uint32_t Type,
+                                        uint32_t FlagsVal);
+LLVM_ABI bool verifyNumDescriptors(uint32_t NumDescriptors);
+LLVM_ABI bool verifySamplerFilter(uint32_t Value);
+LLVM_ABI bool verifyAddress(uint32_t Address);
+LLVM_ABI bool verifyMipLODBias(float MipLODBias);
+LLVM_ABI bool verifyMaxAnisotropy(uint32_t MaxAnisotropy);
+LLVM_ABI bool verifyComparisonFunc(uint32_t ComparisonFunc);
+LLVM_ABI bool verifyBorderColor(uint32_t BorderColor);
+LLVM_ABI bool verifyLOD(float LOD);
 
 struct RangeInfo {
   const static uint32_t Unbounded = ~0u;
@@ -145,7 +146,7 @@ struct OverlappingRanges {
 ///      A: Insert the current RangeInfo into the corresponding Visibility
 ///   ResourceRange
 ///      B: Check for overlap with any overlapping Visibility ResourceRange
-llvm::SmallVector<OverlappingRanges>
+LLVM_ABI llvm::SmallVector<OverlappingRanges>
 findOverlappingRanges(ArrayRef<RangeInfo> Infos);
 
 } // namespace rootsig
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.h b/llvm/include/llvm/IR/RuntimeLibcalls.h
index 97a6389844439..162b0fa7d2e9b 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.h
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.h
@@ -147,7 +147,7 @@ struct RuntimeLibcallsInfo {
   LLVM_ABI static const char *const LibCallImplNames[RTLIB::NumLibcallImpls];
 
   /// Map from a concrete LibcallImpl implementation to its RTLIB::Libcall kind.
-  static const RTLIB::Libcall ImplToLibcall[RTLIB::NumLibcallImpls];
+  LLVM_ABI static const RTLIB::Libcall ImplToLibcall[RTLIB::NumLibcallImpls];
 
   static bool darwinHasSinCosStret(const Triple &TT) {
     if (!TT.isOSDarwin())
diff --git a/llvm/include/llvm/Target/RegisterTargetPassConfigCallback.h b/llvm/include/llvm/Target/RegisterTargetPassConfigCallback.h
index d7c9cb21e15d4..7020cef7cad7b 100644
--- a/llvm/include/llvm/Target/RegisterTargetPassConfigCallback.h
+++ b/llvm/include/llvm/Target/RegisterTargetPassConfigCallback.h
@@ -15,6 +15,7 @@
 #define LLVM_TARGET_REGISTERTARGETPASSCONFIGCALLBACK_H
 
 #include "TargetMachine.h"
+#include "llvm/Support/Compiler.h"
 
 namespace llvm {
 
@@ -25,13 +26,13 @@ class RegisterTargetPassConfigCallback {
 public:
   PassConfigCallback Callback;
 
-  explicit RegisterTargetPassConfigCallback(PassConfigCallback &&C);
-  ~RegisterTargetPassConfigCallback();
+  LLVM_ABI explicit RegisterTargetPassConfigCallback(PassConfigCallback &&C);
+  LLVM_ABI ~RegisterTargetPassConfigCallback();
 };
 
-void invokeGlobalTargetPassConfigCallbacks(TargetMachine &TM,
-                                           PassManagerBase &PM,
-                                           TargetPassConfig *PassConfig);
+LLVM_ABI void
+invokeGlobalTargetPassConfigCallbacks(TargetMachine &TM, PassManagerBase &PM,
+                                      TargetPassConfig *PassConfig);
 } // namespace llvm
 
 #endif // LLVM_TARGET_REGISTERTARGETPASSCONFIGCALLBACK_H

@andrurogerz
Copy link
Contributor Author

@compnerd @vgvassilev here's a quick one that annotates symbols added in the last few weeks.

Copy link
Contributor

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm!

@compnerd compnerd merged commit f5b6b89 into llvm:main Jul 14, 2025
14 checks passed
@andrurogerz andrurogerz deleted the llvm-dll-misc branch July 14, 2025 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debuginfo HLSL HLSL Language Support llvm:ir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants