-
Notifications
You must be signed in to change notification settings - Fork 14.7k
[llvm] annotate recently added interfaces for DLL export #150101
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
Conversation
@llvm/pr-subscribers-backend-directx @llvm/pr-subscribers-llvm-binary-utilities Author: Andrew Rogers (andrurogerz) ChangesPurposeThis patch is one in a series of code-mods that annotate LLVM’s public interface for export. This patch annotates symbols that were recently added to LLVM without proper annotations. 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. BackgroundThis effort is tracked in #109483. Additional context is provided in this discourse, and documentation for OverviewThe bulk of these changes were generated automatically using the Interface Definition Scanner (IDS) tool, followed formatting with The following manual adjustments were also applied after running IDS:
ValidationLocal builds and tests to validate cross-platform compatibility. This included llvm, clang, and lldb on the following configurations:
Full diff: https://github.com/llvm/llvm-project/pull/150101.diff 12 Files Affected:
diff --git a/llvm/include/llvm/Analysis/IR2Vec.h b/llvm/include/llvm/Analysis/IR2Vec.h
index d87457cac7642..7e700907b7471 100644
--- a/llvm/include/llvm/Analysis/IR2Vec.h
+++ b/llvm/include/llvm/Analysis/IR2Vec.h
@@ -164,37 +164,37 @@ class Vocabulary {
public:
Vocabulary() = default;
- Vocabulary(VocabVector &&Vocab);
+ LLVM_ABI Vocabulary(VocabVector &&Vocab);
- bool isValid() const;
- unsigned getDimension() const;
- size_t size() const;
+ LLVM_ABI bool isValid() const;
+ LLVM_ABI unsigned getDimension() const;
+ LLVM_ABI size_t size() const;
static size_t expectedSize() {
return MaxOpcodes + MaxTypeIDs + MaxOperandKinds;
}
/// Helper function to get vocabulary key for a given Opcode
- static StringRef getVocabKeyForOpcode(unsigned Opcode);
+ LLVM_ABI static StringRef getVocabKeyForOpcode(unsigned Opcode);
/// Helper function to get vocabulary key for a given TypeID
- static StringRef getVocabKeyForTypeID(Type::TypeID TypeID);
+ LLVM_ABI static StringRef getVocabKeyForTypeID(Type::TypeID TypeID);
/// Helper function to get vocabulary key for a given OperandKind
- static StringRef getVocabKeyForOperandKind(OperandKind Kind);
+ LLVM_ABI static StringRef getVocabKeyForOperandKind(OperandKind Kind);
/// Helper function to classify an operand into OperandKind
- static OperandKind getOperandKind(const Value *Op);
+ LLVM_ABI static OperandKind getOperandKind(const Value *Op);
/// Helpers to return the IDs of a given Opcode, TypeID, or OperandKind
- static unsigned getNumericID(unsigned Opcode);
- static unsigned getNumericID(Type::TypeID TypeID);
- static unsigned getNumericID(const Value *Op);
+ LLVM_ABI static unsigned getNumericID(unsigned Opcode);
+ LLVM_ABI static unsigned getNumericID(Type::TypeID TypeID);
+ LLVM_ABI static unsigned getNumericID(const Value *Op);
/// Accessors to get the embedding for a given entity.
- const ir2vec::Embedding &operator[](unsigned Opcode) const;
- const ir2vec::Embedding &operator[](Type::TypeID TypeId) const;
- const ir2vec::Embedding &operator[](const Value *Arg) const;
+ LLVM_ABI const ir2vec::Embedding &operator[](unsigned Opcode) const;
+ LLVM_ABI const ir2vec::Embedding &operator[](Type::TypeID TypeId) const;
+ LLVM_ABI const ir2vec::Embedding &operator[](const Value *Arg) const;
/// Const Iterator type aliases
using const_iterator = VocabVector::const_iterator;
@@ -221,13 +221,13 @@ class Vocabulary {
/// Returns the string key for a given index position in the vocabulary.
/// This is useful for debugging or printing the vocabulary. Do not use this
/// for embedding generation as string based lookups are inefficient.
- static StringRef getStringKey(unsigned Pos);
+ LLVM_ABI static StringRef getStringKey(unsigned Pos);
/// Create a dummy vocabulary for testing purposes.
- static VocabVector createDummyVocabForTest(unsigned Dim = 1);
+ LLVM_ABI static VocabVector createDummyVocabForTest(unsigned Dim = 1);
- bool invalidate(Module &M, const PreservedAnalyses &PA,
- ModuleAnalysisManager::Invalidator &Inv) const;
+ LLVM_ABI bool invalidate(Module &M, const PreservedAnalyses &PA,
+ ModuleAnalysisManager::Invalidator &Inv) const;
};
/// Embedder provides the interface to generate embeddings (vector
diff --git a/llvm/include/llvm/BinaryFormat/SFrame.h b/llvm/include/llvm/BinaryFormat/SFrame.h
index 98dbe38fb2bc4..6e8f6f9f48e42 100644
--- a/llvm/include/llvm/BinaryFormat/SFrame.h
+++ b/llvm/include/llvm/BinaryFormat/SFrame.h
@@ -17,6 +17,7 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/BitmaskEnum.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/DataTypes.h"
#include "llvm/Support/Endian.h"
@@ -163,9 +164,9 @@ template <endianness E> using FrameRowEntryAddr1 = FrameRowEntry<uint8_t, E>;
template <endianness E> using FrameRowEntryAddr2 = FrameRowEntry<uint16_t, E>;
template <endianness E> using FrameRowEntryAddr4 = FrameRowEntry<uint32_t, E>;
-ArrayRef<EnumEntry<Version>> getVersions();
-ArrayRef<EnumEntry<Flags>> getFlags();
-ArrayRef<EnumEntry<ABI>> getABIs();
+LLVM_ABI ArrayRef<EnumEntry<Version>> getVersions();
+LLVM_ABI ArrayRef<EnumEntry<Flags>> getFlags();
+LLVM_ABI ArrayRef<EnumEntry<ABI>> getABIs();
} // namespace sframe
} // namespace llvm
diff --git a/llvm/include/llvm/CodeGen/MachineFunctionAnalysis.h b/llvm/include/llvm/CodeGen/MachineFunctionAnalysis.h
index 1d954cf60c68c..1982ac68d61ae 100644
--- a/llvm/include/llvm/CodeGen/MachineFunctionAnalysis.h
+++ b/llvm/include/llvm/CodeGen/MachineFunctionAnalysis.h
@@ -48,7 +48,7 @@ class MachineFunctionAnalysis
class FreeMachineFunctionPass : public PassInfoMixin<FreeMachineFunctionPass> {
public:
- PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
+ LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
};
} // namespace llvm
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/EPCIndirectionUtils.h b/llvm/include/llvm/ExecutionEngine/Orc/EPCIndirectionUtils.h
index 2834331b21f20..b865e0205b672 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/EPCIndirectionUtils.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/EPCIndirectionUtils.h
@@ -17,6 +17,7 @@
#include "llvm/ExecutionEngine/JITLink/JITLinkMemoryManager.h"
#include "llvm/ExecutionEngine/Orc/IndirectionUtils.h"
#include "llvm/ExecutionEngine/Orc/LazyReexports.h"
+#include "llvm/Support/Compiler.h"
#include <mutex>
@@ -33,7 +34,7 @@ class EPCIndirectionUtils {
public:
/// ABI support base class. Used to write resolver, stub, and trampoline
/// blocks.
- class ABISupport {
+ class LLVM_ABI ABISupport {
protected:
ABISupport(unsigned PointerSize, unsigned TrampolineSize, unsigned StubSize,
unsigned StubToPointerMaxDisplacement, unsigned ResolverCodeSize)
@@ -81,7 +82,7 @@ class EPCIndirectionUtils {
CreateWithABI(ExecutorProcessControl &EPC);
/// Create based on the ExecutorProcessControl triple.
- static Expected<std::unique_ptr<EPCIndirectionUtils>>
+ LLVM_ABI static Expected<std::unique_ptr<EPCIndirectionUtils>>
Create(ExecutorProcessControl &EPC);
/// Create based on the ExecutorProcessControl triple.
@@ -98,27 +99,27 @@ class EPCIndirectionUtils {
/// Release memory for resources held by this instance. This *must* be called
/// prior to destruction of the class.
- Error cleanup();
+ LLVM_ABI Error cleanup();
/// Write resolver code to the executor process and return its address.
/// This must be called before any call to createTrampolinePool or
/// createLazyCallThroughManager.
- Expected<ExecutorAddr> writeResolverBlock(ExecutorAddr ReentryFnAddr,
- ExecutorAddr ReentryCtxAddr);
+ LLVM_ABI Expected<ExecutorAddr>
+ writeResolverBlock(ExecutorAddr ReentryFnAddr, ExecutorAddr ReentryCtxAddr);
/// Returns the address of the Resolver block. Returns zero if the
/// writeResolverBlock method has not previously been called.
ExecutorAddr getResolverBlockAddress() const { return ResolverBlockAddr; }
/// Create an IndirectStubsManager for the executor process.
- std::unique_ptr<IndirectStubsManager> createIndirectStubsManager();
+ LLVM_ABI std::unique_ptr<IndirectStubsManager> createIndirectStubsManager();
/// Create a TrampolinePool for the executor process.
- TrampolinePool &getTrampolinePool();
+ LLVM_ABI TrampolinePool &getTrampolinePool();
/// Create a LazyCallThroughManager.
/// This function should only be called once.
- LazyCallThroughManager &
+ LLVM_ABI LazyCallThroughManager &
createLazyCallThroughManager(ExecutionSession &ES,
ExecutorAddr ErrorHandlerAddr);
@@ -170,7 +171,7 @@ class EPCIndirectionUtils {
/// called.
///
/// This function is experimental and likely subject to revision.
-Error setUpInProcessLCTMReentryViaEPCIU(EPCIndirectionUtils &EPCIU);
+LLVM_ABI Error setUpInProcessLCTMReentryViaEPCIU(EPCIndirectionUtils &EPCIU);
namespace detail {
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/SpeculateAnalyses.h b/llvm/include/llvm/ExecutionEngine/Orc/SpeculateAnalyses.h
index c92719e9f5296..a9f5c45f8b116 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/SpeculateAnalyses.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/SpeculateAnalyses.h
@@ -16,6 +16,7 @@
#include "llvm/Analysis/BranchProbabilityInfo.h"
#include "llvm/ExecutionEngine/Orc/Core.h"
#include "llvm/ExecutionEngine/Orc/Speculation.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
@@ -24,8 +25,8 @@ namespace orc {
// Provides common code.
class SpeculateQuery {
protected:
- void findCalles(const BasicBlock *, DenseSet<StringRef> &);
- bool isStraightLine(const Function &F);
+ LLVM_ABI void findCalles(const BasicBlock *, DenseSet<StringRef> &);
+ LLVM_ABI bool isStraightLine(const Function &F);
public:
using ResultTy = std::optional<DenseMap<StringRef, DenseSet<StringRef>>>;
@@ -37,7 +38,7 @@ class BlockFreqQuery : public SpeculateQuery {
public:
// Find likely next executables based on IR Block Frequency
- ResultTy operator()(Function &F);
+ LLVM_ABI ResultTy operator()(Function &F);
};
// This Query generates a sequence of basic blocks which follows the order of
@@ -73,7 +74,7 @@ class SequenceBBQuery : public SpeculateQuery {
VisitedBlocksInfoTy &);
public:
- ResultTy operator()(Function &F);
+ LLVM_ABI ResultTy operator()(Function &F);
};
} // namespace orc
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.h b/llvm/include/llvm/IR/RuntimeLibcalls.h
index 89ad4e5bc6ca4..eb882c48270cf 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.h
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.h
@@ -134,7 +134,7 @@ struct RuntimeLibcallsInfo {
/// Check if this is valid libcall for the current module, otherwise
/// RTLIB::Unsupported.
- RTLIB::LibcallImpl getSupportedLibcallImpl(StringRef FuncName) const;
+ LLVM_ABI RTLIB::LibcallImpl getSupportedLibcallImpl(StringRef FuncName) const;
private:
static const RTLIB::LibcallImpl
diff --git a/llvm/include/llvm/MC/MCAssembler.h b/llvm/include/llvm/MC/MCAssembler.h
index 467ad4eabd3b0..4853701847cba 100644
--- a/llvm/include/llvm/MC/MCAssembler.h
+++ b/llvm/include/llvm/MC/MCAssembler.h
@@ -209,7 +209,7 @@ class MCAssembler {
LLVM_ABI bool registerSection(MCSection &Section);
LLVM_ABI bool registerSymbol(const MCSymbol &Symbol);
- void addRelocDirective(RelocDirective RD);
+ LLVM_ABI void addRelocDirective(RelocDirective RD);
LLVM_ABI void reportError(SMLoc L, const Twine &Msg) const;
// Record pending errors during layout iteration, as they may go away once the
diff --git a/llvm/include/llvm/MC/MCSection.h b/llvm/include/llvm/MC/MCSection.h
index 87a83497c1920..f03545ce1ea54 100644
--- a/llvm/include/llvm/MC/MCSection.h
+++ b/llvm/include/llvm/MC/MCSection.h
@@ -378,7 +378,7 @@ class MCFragment {
.slice(ContentStart, ContentEnd - ContentStart);
}
- void setVarContents(ArrayRef<char> Contents);
+ LLVM_ABI void setVarContents(ArrayRef<char> Contents);
void clearVarContents() { setVarContents({}); }
MutableArrayRef<char> getVarContents() {
return MutableArrayRef(getParent()->ContentStorage)
@@ -411,7 +411,7 @@ class MCFragment {
// Source fixup offsets are relative to the variable part's start.
// Stored fixup offsets are relative to the fixed part's start.
- void setVarFixups(ArrayRef<MCFixup> Fixups);
+ LLVM_ABI void setVarFixups(ArrayRef<MCFixup> Fixups);
void clearVarFixups() { setVarFixups({}); }
MutableArrayRef<MCFixup> getVarFixups() {
return MutableArrayRef(getParent()->FixupStorage)
diff --git a/llvm/include/llvm/Object/SFrameParser.h b/llvm/include/llvm/Object/SFrameParser.h
index cf4fe20e84431..e595bedcc3561 100644
--- a/llvm/include/llvm/Object/SFrameParser.h
+++ b/llvm/include/llvm/Object/SFrameParser.h
@@ -11,6 +11,7 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/BinaryFormat/SFrame.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Error.h"
#include <cstdint>
@@ -39,8 +40,8 @@ template <endianness E> class SFrameParser {
: Data(Data), Header(Header) {}
};
-extern template class SFrameParser<endianness::big>;
-extern template class SFrameParser<endianness::little>;
+extern template class LLVM_TEMPLATE_ABI SFrameParser<endianness::big>;
+extern template class LLVM_TEMPLATE_ABI SFrameParser<endianness::little>;
} // end namespace object
} // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Scalar/Reassociate.h b/llvm/include/llvm/Transforms/Scalar/Reassociate.h
index a5d137661e11e..749f6ee34346d 100644
--- a/llvm/include/llvm/Transforms/Scalar/Reassociate.h
+++ b/llvm/include/llvm/Transforms/Scalar/Reassociate.h
@@ -28,6 +28,7 @@
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/PassManager.h"
#include "llvm/IR/ValueHandle.h"
+#include "llvm/Support/Compiler.h"
#include <deque>
namespace llvm {
@@ -96,7 +97,7 @@ class ReassociatePass : public PassInfoMixin<ReassociatePass> {
bool MadeChange;
public:
- PreservedAnalyses run(Function &F, FunctionAnalysisManager &);
+ LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &);
private:
void BuildRankMap(Function &F, ReversePostOrderTraversal<Function *> &RPOT);
diff --git a/llvm/include/llvm/Transforms/Utils/Mem2Reg.h b/llvm/include/llvm/Transforms/Utils/Mem2Reg.h
index 76c1c2c5bffec..d0006bf162f25 100644
--- a/llvm/include/llvm/Transforms/Utils/Mem2Reg.h
+++ b/llvm/include/llvm/Transforms/Utils/Mem2Reg.h
@@ -15,6 +15,7 @@
#define LLVM_TRANSFORMS_UTILS_MEM2REG_H
#include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
@@ -22,7 +23,7 @@ class Function;
class PromotePass : public PassInfoMixin<PromotePass> {
public:
- PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+ LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
};
} // end namespace llvm
diff --git a/llvm/lib/Object/SFrameParser.cpp b/llvm/lib/Object/SFrameParser.cpp
index 2d74d1d6b3827..6f0037c547c51 100644
--- a/llvm/lib/Object/SFrameParser.cpp
+++ b/llvm/lib/Object/SFrameParser.cpp
@@ -51,5 +51,6 @@ Expected<SFrameParser<E>> SFrameParser<E>::create(ArrayRef<uint8_t> Contents) {
return SFrameParser(Contents, *Header);
}
-template class llvm::object::SFrameParser<endianness::big>;
-template class llvm::object::SFrameParser<endianness::little>;
+template class LLVM_EXPORT_TEMPLATE llvm::object::SFrameParser<endianness::big>;
+template class LLVM_EXPORT_TEMPLATE
+ llvm::object::SFrameParser<endianness::little>;
|
@llvm/pr-subscribers-llvm-transforms Author: Andrew Rogers (andrurogerz) ChangesPurposeThis patch is one in a series of code-mods that annotate LLVM’s public interface for export. This patch annotates symbols that were recently added to LLVM without proper annotations. 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. BackgroundThis effort is tracked in #109483. Additional context is provided in this discourse, and documentation for OverviewThe bulk of these changes were generated automatically using the Interface Definition Scanner (IDS) tool, followed formatting with The following manual adjustments were also applied after running IDS:
ValidationLocal builds and tests to validate cross-platform compatibility. This included llvm, clang, and lldb on the following configurations:
Full diff: https://github.com/llvm/llvm-project/pull/150101.diff 12 Files Affected:
diff --git a/llvm/include/llvm/Analysis/IR2Vec.h b/llvm/include/llvm/Analysis/IR2Vec.h
index d87457cac7642..7e700907b7471 100644
--- a/llvm/include/llvm/Analysis/IR2Vec.h
+++ b/llvm/include/llvm/Analysis/IR2Vec.h
@@ -164,37 +164,37 @@ class Vocabulary {
public:
Vocabulary() = default;
- Vocabulary(VocabVector &&Vocab);
+ LLVM_ABI Vocabulary(VocabVector &&Vocab);
- bool isValid() const;
- unsigned getDimension() const;
- size_t size() const;
+ LLVM_ABI bool isValid() const;
+ LLVM_ABI unsigned getDimension() const;
+ LLVM_ABI size_t size() const;
static size_t expectedSize() {
return MaxOpcodes + MaxTypeIDs + MaxOperandKinds;
}
/// Helper function to get vocabulary key for a given Opcode
- static StringRef getVocabKeyForOpcode(unsigned Opcode);
+ LLVM_ABI static StringRef getVocabKeyForOpcode(unsigned Opcode);
/// Helper function to get vocabulary key for a given TypeID
- static StringRef getVocabKeyForTypeID(Type::TypeID TypeID);
+ LLVM_ABI static StringRef getVocabKeyForTypeID(Type::TypeID TypeID);
/// Helper function to get vocabulary key for a given OperandKind
- static StringRef getVocabKeyForOperandKind(OperandKind Kind);
+ LLVM_ABI static StringRef getVocabKeyForOperandKind(OperandKind Kind);
/// Helper function to classify an operand into OperandKind
- static OperandKind getOperandKind(const Value *Op);
+ LLVM_ABI static OperandKind getOperandKind(const Value *Op);
/// Helpers to return the IDs of a given Opcode, TypeID, or OperandKind
- static unsigned getNumericID(unsigned Opcode);
- static unsigned getNumericID(Type::TypeID TypeID);
- static unsigned getNumericID(const Value *Op);
+ LLVM_ABI static unsigned getNumericID(unsigned Opcode);
+ LLVM_ABI static unsigned getNumericID(Type::TypeID TypeID);
+ LLVM_ABI static unsigned getNumericID(const Value *Op);
/// Accessors to get the embedding for a given entity.
- const ir2vec::Embedding &operator[](unsigned Opcode) const;
- const ir2vec::Embedding &operator[](Type::TypeID TypeId) const;
- const ir2vec::Embedding &operator[](const Value *Arg) const;
+ LLVM_ABI const ir2vec::Embedding &operator[](unsigned Opcode) const;
+ LLVM_ABI const ir2vec::Embedding &operator[](Type::TypeID TypeId) const;
+ LLVM_ABI const ir2vec::Embedding &operator[](const Value *Arg) const;
/// Const Iterator type aliases
using const_iterator = VocabVector::const_iterator;
@@ -221,13 +221,13 @@ class Vocabulary {
/// Returns the string key for a given index position in the vocabulary.
/// This is useful for debugging or printing the vocabulary. Do not use this
/// for embedding generation as string based lookups are inefficient.
- static StringRef getStringKey(unsigned Pos);
+ LLVM_ABI static StringRef getStringKey(unsigned Pos);
/// Create a dummy vocabulary for testing purposes.
- static VocabVector createDummyVocabForTest(unsigned Dim = 1);
+ LLVM_ABI static VocabVector createDummyVocabForTest(unsigned Dim = 1);
- bool invalidate(Module &M, const PreservedAnalyses &PA,
- ModuleAnalysisManager::Invalidator &Inv) const;
+ LLVM_ABI bool invalidate(Module &M, const PreservedAnalyses &PA,
+ ModuleAnalysisManager::Invalidator &Inv) const;
};
/// Embedder provides the interface to generate embeddings (vector
diff --git a/llvm/include/llvm/BinaryFormat/SFrame.h b/llvm/include/llvm/BinaryFormat/SFrame.h
index 98dbe38fb2bc4..6e8f6f9f48e42 100644
--- a/llvm/include/llvm/BinaryFormat/SFrame.h
+++ b/llvm/include/llvm/BinaryFormat/SFrame.h
@@ -17,6 +17,7 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/BitmaskEnum.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/DataTypes.h"
#include "llvm/Support/Endian.h"
@@ -163,9 +164,9 @@ template <endianness E> using FrameRowEntryAddr1 = FrameRowEntry<uint8_t, E>;
template <endianness E> using FrameRowEntryAddr2 = FrameRowEntry<uint16_t, E>;
template <endianness E> using FrameRowEntryAddr4 = FrameRowEntry<uint32_t, E>;
-ArrayRef<EnumEntry<Version>> getVersions();
-ArrayRef<EnumEntry<Flags>> getFlags();
-ArrayRef<EnumEntry<ABI>> getABIs();
+LLVM_ABI ArrayRef<EnumEntry<Version>> getVersions();
+LLVM_ABI ArrayRef<EnumEntry<Flags>> getFlags();
+LLVM_ABI ArrayRef<EnumEntry<ABI>> getABIs();
} // namespace sframe
} // namespace llvm
diff --git a/llvm/include/llvm/CodeGen/MachineFunctionAnalysis.h b/llvm/include/llvm/CodeGen/MachineFunctionAnalysis.h
index 1d954cf60c68c..1982ac68d61ae 100644
--- a/llvm/include/llvm/CodeGen/MachineFunctionAnalysis.h
+++ b/llvm/include/llvm/CodeGen/MachineFunctionAnalysis.h
@@ -48,7 +48,7 @@ class MachineFunctionAnalysis
class FreeMachineFunctionPass : public PassInfoMixin<FreeMachineFunctionPass> {
public:
- PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
+ LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
};
} // namespace llvm
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/EPCIndirectionUtils.h b/llvm/include/llvm/ExecutionEngine/Orc/EPCIndirectionUtils.h
index 2834331b21f20..b865e0205b672 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/EPCIndirectionUtils.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/EPCIndirectionUtils.h
@@ -17,6 +17,7 @@
#include "llvm/ExecutionEngine/JITLink/JITLinkMemoryManager.h"
#include "llvm/ExecutionEngine/Orc/IndirectionUtils.h"
#include "llvm/ExecutionEngine/Orc/LazyReexports.h"
+#include "llvm/Support/Compiler.h"
#include <mutex>
@@ -33,7 +34,7 @@ class EPCIndirectionUtils {
public:
/// ABI support base class. Used to write resolver, stub, and trampoline
/// blocks.
- class ABISupport {
+ class LLVM_ABI ABISupport {
protected:
ABISupport(unsigned PointerSize, unsigned TrampolineSize, unsigned StubSize,
unsigned StubToPointerMaxDisplacement, unsigned ResolverCodeSize)
@@ -81,7 +82,7 @@ class EPCIndirectionUtils {
CreateWithABI(ExecutorProcessControl &EPC);
/// Create based on the ExecutorProcessControl triple.
- static Expected<std::unique_ptr<EPCIndirectionUtils>>
+ LLVM_ABI static Expected<std::unique_ptr<EPCIndirectionUtils>>
Create(ExecutorProcessControl &EPC);
/// Create based on the ExecutorProcessControl triple.
@@ -98,27 +99,27 @@ class EPCIndirectionUtils {
/// Release memory for resources held by this instance. This *must* be called
/// prior to destruction of the class.
- Error cleanup();
+ LLVM_ABI Error cleanup();
/// Write resolver code to the executor process and return its address.
/// This must be called before any call to createTrampolinePool or
/// createLazyCallThroughManager.
- Expected<ExecutorAddr> writeResolverBlock(ExecutorAddr ReentryFnAddr,
- ExecutorAddr ReentryCtxAddr);
+ LLVM_ABI Expected<ExecutorAddr>
+ writeResolverBlock(ExecutorAddr ReentryFnAddr, ExecutorAddr ReentryCtxAddr);
/// Returns the address of the Resolver block. Returns zero if the
/// writeResolverBlock method has not previously been called.
ExecutorAddr getResolverBlockAddress() const { return ResolverBlockAddr; }
/// Create an IndirectStubsManager for the executor process.
- std::unique_ptr<IndirectStubsManager> createIndirectStubsManager();
+ LLVM_ABI std::unique_ptr<IndirectStubsManager> createIndirectStubsManager();
/// Create a TrampolinePool for the executor process.
- TrampolinePool &getTrampolinePool();
+ LLVM_ABI TrampolinePool &getTrampolinePool();
/// Create a LazyCallThroughManager.
/// This function should only be called once.
- LazyCallThroughManager &
+ LLVM_ABI LazyCallThroughManager &
createLazyCallThroughManager(ExecutionSession &ES,
ExecutorAddr ErrorHandlerAddr);
@@ -170,7 +171,7 @@ class EPCIndirectionUtils {
/// called.
///
/// This function is experimental and likely subject to revision.
-Error setUpInProcessLCTMReentryViaEPCIU(EPCIndirectionUtils &EPCIU);
+LLVM_ABI Error setUpInProcessLCTMReentryViaEPCIU(EPCIndirectionUtils &EPCIU);
namespace detail {
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/SpeculateAnalyses.h b/llvm/include/llvm/ExecutionEngine/Orc/SpeculateAnalyses.h
index c92719e9f5296..a9f5c45f8b116 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/SpeculateAnalyses.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/SpeculateAnalyses.h
@@ -16,6 +16,7 @@
#include "llvm/Analysis/BranchProbabilityInfo.h"
#include "llvm/ExecutionEngine/Orc/Core.h"
#include "llvm/ExecutionEngine/Orc/Speculation.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
@@ -24,8 +25,8 @@ namespace orc {
// Provides common code.
class SpeculateQuery {
protected:
- void findCalles(const BasicBlock *, DenseSet<StringRef> &);
- bool isStraightLine(const Function &F);
+ LLVM_ABI void findCalles(const BasicBlock *, DenseSet<StringRef> &);
+ LLVM_ABI bool isStraightLine(const Function &F);
public:
using ResultTy = std::optional<DenseMap<StringRef, DenseSet<StringRef>>>;
@@ -37,7 +38,7 @@ class BlockFreqQuery : public SpeculateQuery {
public:
// Find likely next executables based on IR Block Frequency
- ResultTy operator()(Function &F);
+ LLVM_ABI ResultTy operator()(Function &F);
};
// This Query generates a sequence of basic blocks which follows the order of
@@ -73,7 +74,7 @@ class SequenceBBQuery : public SpeculateQuery {
VisitedBlocksInfoTy &);
public:
- ResultTy operator()(Function &F);
+ LLVM_ABI ResultTy operator()(Function &F);
};
} // namespace orc
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.h b/llvm/include/llvm/IR/RuntimeLibcalls.h
index 89ad4e5bc6ca4..eb882c48270cf 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.h
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.h
@@ -134,7 +134,7 @@ struct RuntimeLibcallsInfo {
/// Check if this is valid libcall for the current module, otherwise
/// RTLIB::Unsupported.
- RTLIB::LibcallImpl getSupportedLibcallImpl(StringRef FuncName) const;
+ LLVM_ABI RTLIB::LibcallImpl getSupportedLibcallImpl(StringRef FuncName) const;
private:
static const RTLIB::LibcallImpl
diff --git a/llvm/include/llvm/MC/MCAssembler.h b/llvm/include/llvm/MC/MCAssembler.h
index 467ad4eabd3b0..4853701847cba 100644
--- a/llvm/include/llvm/MC/MCAssembler.h
+++ b/llvm/include/llvm/MC/MCAssembler.h
@@ -209,7 +209,7 @@ class MCAssembler {
LLVM_ABI bool registerSection(MCSection &Section);
LLVM_ABI bool registerSymbol(const MCSymbol &Symbol);
- void addRelocDirective(RelocDirective RD);
+ LLVM_ABI void addRelocDirective(RelocDirective RD);
LLVM_ABI void reportError(SMLoc L, const Twine &Msg) const;
// Record pending errors during layout iteration, as they may go away once the
diff --git a/llvm/include/llvm/MC/MCSection.h b/llvm/include/llvm/MC/MCSection.h
index 87a83497c1920..f03545ce1ea54 100644
--- a/llvm/include/llvm/MC/MCSection.h
+++ b/llvm/include/llvm/MC/MCSection.h
@@ -378,7 +378,7 @@ class MCFragment {
.slice(ContentStart, ContentEnd - ContentStart);
}
- void setVarContents(ArrayRef<char> Contents);
+ LLVM_ABI void setVarContents(ArrayRef<char> Contents);
void clearVarContents() { setVarContents({}); }
MutableArrayRef<char> getVarContents() {
return MutableArrayRef(getParent()->ContentStorage)
@@ -411,7 +411,7 @@ class MCFragment {
// Source fixup offsets are relative to the variable part's start.
// Stored fixup offsets are relative to the fixed part's start.
- void setVarFixups(ArrayRef<MCFixup> Fixups);
+ LLVM_ABI void setVarFixups(ArrayRef<MCFixup> Fixups);
void clearVarFixups() { setVarFixups({}); }
MutableArrayRef<MCFixup> getVarFixups() {
return MutableArrayRef(getParent()->FixupStorage)
diff --git a/llvm/include/llvm/Object/SFrameParser.h b/llvm/include/llvm/Object/SFrameParser.h
index cf4fe20e84431..e595bedcc3561 100644
--- a/llvm/include/llvm/Object/SFrameParser.h
+++ b/llvm/include/llvm/Object/SFrameParser.h
@@ -11,6 +11,7 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/BinaryFormat/SFrame.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Error.h"
#include <cstdint>
@@ -39,8 +40,8 @@ template <endianness E> class SFrameParser {
: Data(Data), Header(Header) {}
};
-extern template class SFrameParser<endianness::big>;
-extern template class SFrameParser<endianness::little>;
+extern template class LLVM_TEMPLATE_ABI SFrameParser<endianness::big>;
+extern template class LLVM_TEMPLATE_ABI SFrameParser<endianness::little>;
} // end namespace object
} // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Scalar/Reassociate.h b/llvm/include/llvm/Transforms/Scalar/Reassociate.h
index a5d137661e11e..749f6ee34346d 100644
--- a/llvm/include/llvm/Transforms/Scalar/Reassociate.h
+++ b/llvm/include/llvm/Transforms/Scalar/Reassociate.h
@@ -28,6 +28,7 @@
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/PassManager.h"
#include "llvm/IR/ValueHandle.h"
+#include "llvm/Support/Compiler.h"
#include <deque>
namespace llvm {
@@ -96,7 +97,7 @@ class ReassociatePass : public PassInfoMixin<ReassociatePass> {
bool MadeChange;
public:
- PreservedAnalyses run(Function &F, FunctionAnalysisManager &);
+ LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &);
private:
void BuildRankMap(Function &F, ReversePostOrderTraversal<Function *> &RPOT);
diff --git a/llvm/include/llvm/Transforms/Utils/Mem2Reg.h b/llvm/include/llvm/Transforms/Utils/Mem2Reg.h
index 76c1c2c5bffec..d0006bf162f25 100644
--- a/llvm/include/llvm/Transforms/Utils/Mem2Reg.h
+++ b/llvm/include/llvm/Transforms/Utils/Mem2Reg.h
@@ -15,6 +15,7 @@
#define LLVM_TRANSFORMS_UTILS_MEM2REG_H
#include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
@@ -22,7 +23,7 @@ class Function;
class PromotePass : public PassInfoMixin<PromotePass> {
public:
- PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+ LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
};
} // end namespace llvm
diff --git a/llvm/lib/Object/SFrameParser.cpp b/llvm/lib/Object/SFrameParser.cpp
index 2d74d1d6b3827..6f0037c547c51 100644
--- a/llvm/lib/Object/SFrameParser.cpp
+++ b/llvm/lib/Object/SFrameParser.cpp
@@ -51,5 +51,6 @@ Expected<SFrameParser<E>> SFrameParser<E>::create(ArrayRef<uint8_t> Contents) {
return SFrameParser(Contents, *Header);
}
-template class llvm::object::SFrameParser<endianness::big>;
-template class llvm::object::SFrameParser<endianness::little>;
+template class LLVM_EXPORT_TEMPLATE llvm::object::SFrameParser<endianness::big>;
+template class LLVM_EXPORT_TEMPLATE
+ llvm::object::SFrameParser<endianness::little>;
|
I'm really concerned that this is going to constantly rot, with people not knowing about or not knowing when they need to add the |
The plan is for a CI job to find and emits fixes-- it just hasn't been completed yet, #128370 |
3101b8e
to
23aa89b
Compare
@compnerd @vgvassilev this one just annotates symbols that were missed by previous patches or newly added-- all automatically added by ids. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm!
This patch is one in a series of code-mods that annotate LLVM’s public interface for export. This patch annotates symbols that were recently added to LLVM without proper annotations. 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. This effort is tracked in llvm#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). The bulk of these changes were generated automatically using the [Interface Definition Scanner (IDS)](https://github.com/compnerd/ids) tool, followed formatting with `git clang-format`. The following manual adjustments were also applied after running IDS: - Add `LLVM_EXPORT_TEMPLATE` and `LLVM_TEMPLATE_ABI` annotations to explicitly instantiated instances of `llvm::object::SFrameParser`. 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
This patch is one in a series of code-mods that annotate LLVM’s public interface for export. This patch annotates symbols that were recently added to LLVM without proper annotations. 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. This effort is tracked in llvm#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). The bulk of these changes were generated automatically using the [Interface Definition Scanner (IDS)](https://github.com/compnerd/ids) tool, followed formatting with `git clang-format`. The following manual adjustments were also applied after running IDS: - Add `LLVM_EXPORT_TEMPLATE` and `LLVM_TEMPLATE_ABI` annotations to explicitly instantiated instances of `llvm::object::SFrameParser`. 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
This patch is one in a series of code-mods that annotate LLVM’s public interface for export. This patch annotates symbols that were recently added to LLVM without proper annotations. 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. This effort is tracked in llvm#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). The bulk of these changes were generated automatically using the [Interface Definition Scanner (IDS)](https://github.com/compnerd/ids) tool, followed formatting with `git clang-format`. The following manual adjustments were also applied after running IDS: - Add `LLVM_EXPORT_TEMPLATE` and `LLVM_TEMPLATE_ABI` annotations to explicitly instantiated instances of `llvm::object::SFrameParser`. 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
This patch is one in a series of code-mods that annotate LLVM’s public interface for export. This patch annotates symbols that were recently added to LLVM without proper annotations. 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. This effort is tracked in llvm#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). The bulk of these changes were generated automatically using the [Interface Definition Scanner (IDS)](https://github.com/compnerd/ids) tool, followed formatting with `git clang-format`. The following manual adjustments were also applied after running IDS: - Add `LLVM_EXPORT_TEMPLATE` and `LLVM_TEMPLATE_ABI` annotations to explicitly instantiated instances of `llvm::object::SFrameParser`. 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
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 recently added to LLVM without proper annotations. 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
The bulk of these changes were generated automatically using the Interface Definition Scanner (IDS) tool, followed formatting with
git clang-format
.The following manual adjustments were also applied after running IDS:
LLVM_EXPORT_TEMPLATE
andLLVM_TEMPLATE_ABI
annotations to explicitly instantiated instances ofllvm::object::SFrameParser
.Validation
Local builds and tests to validate cross-platform compatibility. This included llvm, clang, and lldb on the following configurations: