Skip to content

Commit 87ce754

Browse files
authored
[llvm] annotate remaining BinaryFormat and DebugInfo library interfaces for DLL export (#145364)
## Purpose This patch is one in a series of code-mods that annotate LLVM’s public interface for export. This patch annotates the remaining LLVM BinaryFormat and DebugInfo interfaces that were missed in, or modified since, previous patches. 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](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). ## Overview These changes were generated automatically using the [Interface Definition Scanner (IDS)](https://github.com/compnerd/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 - Darwin with Clang
1 parent 3574560 commit 87ce754

File tree

5 files changed

+21
-15
lines changed

5 files changed

+21
-15
lines changed

llvm/include/llvm/BinaryFormat/DXContainer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ enum class DescriptorRangeType : uint32_t {
186186
#include "DXContainerConstants.def"
187187
};
188188

189-
ArrayRef<EnumEntry<DescriptorRangeType>> getDescriptorRangeTypes();
189+
LLVM_ABI ArrayRef<EnumEntry<DescriptorRangeType>> getDescriptorRangeTypes();
190190

191191
#define ROOT_PARAMETER(Val, Enum) \
192192
case Val: \

llvm/include/llvm/DebugInfo/DWARF/DWARFCFIPrinter.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,18 @@
1010
#define LLVM_DEBUGINFO_DWARF_DWARFCFIPRINTER_H
1111

1212
#include "llvm/DebugInfo/DWARF/DWARFCFIProgram.h"
13+
#include "llvm/Support/Compiler.h"
1314

1415
namespace llvm {
1516

1617
struct DIDumpOptions;
1718

1819
namespace dwarf {
1920

20-
void printCFIProgram(const CFIProgram &P, raw_ostream &OS,
21-
const DIDumpOptions &DumpOpts, unsigned IndentLevel,
22-
std::optional<uint64_t> Address);
21+
LLVM_ABI void printCFIProgram(const CFIProgram &P, raw_ostream &OS,
22+
const DIDumpOptions &DumpOpts,
23+
unsigned IndentLevel,
24+
std::optional<uint64_t> Address);
2325

2426
} // end namespace dwarf
2527

llvm/include/llvm/DebugInfo/DWARF/DWARFCFIProgram.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,11 @@ class CFIProgram {
106106
};
107107

108108
/// Get the OperandType as a "const char *".
109-
static const char *operandTypeString(OperandType OT);
109+
LLVM_ABI static const char *operandTypeString(OperandType OT);
110110

111111
/// Retrieve the array describing the types of operands according to the enum
112112
/// above. This is indexed by opcode.
113-
static ArrayRef<OperandType[MaxOperands]> getOperandTypes();
113+
LLVM_ABI static ArrayRef<OperandType[MaxOperands]> getOperandTypes();
114114

115115
private:
116116
std::vector<Instruction> Instructions;

llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,9 @@ class DWARFExpressionPrinter {
186186
/// \param E to be printed
187187
/// \param OS to this stream
188188
/// \param GetNameForDWARFReg callback to return dwarf register name
189-
static void print(const DWARFExpression *E, raw_ostream &OS,
190-
DIDumpOptions DumpOpts, DWARFUnit *U, bool IsEH = false);
189+
LLVM_ABI static void print(const DWARFExpression *E, raw_ostream &OS,
190+
DIDumpOptions DumpOpts, DWARFUnit *U,
191+
bool IsEH = false);
191192

192193
/// Print the expression in a format intended to be compact and useful to a
193194
/// user, but not perfectly unambiguous, or capable of representing every
@@ -199,9 +200,10 @@ class DWARFExpressionPrinter {
199200
/// \param GetNameForDWARFReg callback to return dwarf register name
200201
///
201202
/// \returns true if the expression was successfully printed
202-
static bool printCompact(const DWARFExpression *E, raw_ostream &OS,
203-
std::function<StringRef(uint64_t RegNum, bool IsEH)>
204-
GetNameForDWARFReg = nullptr);
203+
LLVM_ABI static bool printCompact(
204+
const DWARFExpression *E, raw_ostream &OS,
205+
std::function<StringRef(uint64_t RegNum, bool IsEH)> GetNameForDWARFReg =
206+
nullptr);
205207

206208
/// Pretty print a register opcode and operands.
207209
/// \param U within the context of this Dwarf unit, if any.
@@ -211,9 +213,10 @@ class DWARFExpressionPrinter {
211213
/// \param Operands to the opcode
212214
///
213215
/// returns true if the Op was successfully printed
214-
static bool prettyPrintRegisterOp(DWARFUnit *U, raw_ostream &OS,
215-
DIDumpOptions DumpOpts, uint8_t Opcode,
216-
ArrayRef<uint64_t> Operands);
216+
LLVM_ABI static bool prettyPrintRegisterOp(DWARFUnit *U, raw_ostream &OS,
217+
DIDumpOptions DumpOpts,
218+
uint8_t Opcode,
219+
ArrayRef<uint64_t> Operands);
217220

218221
private:
219222
static bool printOp(const DWARFExpression::Operation *Op, raw_ostream &OS,

llvm/include/llvm/DebugInfo/LogicalView/Core/LVSourceLanguage.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "llvm/ADT/StringRef.h"
1818
#include "llvm/BinaryFormat/Dwarf.h"
1919
#include "llvm/DebugInfo/CodeView/CodeView.h"
20+
#include "llvm/Support/Compiler.h"
2021

2122
namespace llvm {
2223
namespace logicalview {
@@ -52,7 +53,7 @@ struct LVSourceLanguage {
5253

5354
bool isValid() const { return Language != Invalid; }
5455
TaggedLanguage get() const { return Language; }
55-
StringRef getName() const;
56+
LLVM_ABI StringRef getName() const;
5657

5758
private:
5859
TaggedLanguage Language = Invalid;

0 commit comments

Comments
 (0)