Skip to content

Commit b4cc902

Browse files
committed
[llvm] IDS auto codemod for DWARFLinker, DWP, and Demangle libraries
1 parent 764ae04 commit b4cc902

File tree

7 files changed

+38
-31
lines changed

7 files changed

+38
-31
lines changed

llvm/include/llvm/DWARFLinker/Classic/DWARFLinker.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#ifndef LLVM_DWARFLINKER_CLASSIC_DWARFLINKER_H
1010
#define LLVM_DWARFLINKER_CLASSIC_DWARFLINKER_H
1111

12+
#include "llvm/Support/Compiler.h"
1213
#include "llvm/ADT/AddressRanges.h"
1314
#include "llvm/ADT/DenseMap.h"
1415
#include "llvm/CodeGen/AccelTable.h"
@@ -211,7 +212,7 @@ using UnitListTy = std::vector<std::unique_ptr<CompileUnit>>;
211212
/// a variable). These relocations are called ValidRelocs in the
212213
/// AddressesInfo and are gathered as a very first step when we start
213214
/// processing a object file.
214-
class DWARFLinker : public DWARFLinkerBase {
215+
class LLVM_ABI DWARFLinker : public DWARFLinkerBase {
215216
public:
216217
DWARFLinker(MessageHandlerTy ErrorHandler, MessageHandlerTy WarningHandler,
217218
std::function<StringRef(StringRef)> StringsTranslator)
@@ -586,18 +587,18 @@ class DWARFLinker : public DWARFLinkerBase {
586587
/// applied to the entry point of the function to get the linked address.
587588
/// \param Die the output DIE to use, pass NULL to create one.
588589
/// \returns the root of the cloned tree or null if nothing was selected.
589-
DIE *cloneDIE(const DWARFDie &InputDIE, const DWARFFile &File,
590+
LLVM_ABI DIE *cloneDIE(const DWARFDie &InputDIE, const DWARFFile &File,
590591
CompileUnit &U, int64_t PCOffset, uint32_t OutOffset,
591592
unsigned Flags, bool IsLittleEndian, DIE *Die = nullptr);
592593

593594
/// Construct the output DIE tree by cloning the DIEs we
594595
/// chose to keep above. If there are no valid relocs, then there's
595596
/// nothing to clone/emit.
596-
uint64_t cloneAllCompileUnits(DWARFContext &DwarfContext,
597+
LLVM_ABI uint64_t cloneAllCompileUnits(DWARFContext &DwarfContext,
597598
const DWARFFile &File, bool IsLittleEndian);
598599

599600
/// Emit the .debug_addr section for the \p Unit.
600-
void emitDebugAddrSection(CompileUnit &Unit,
601+
LLVM_ABI void emitDebugAddrSection(CompileUnit &Unit,
601602
const uint16_t DwarfVersion) const;
602603

603604
using ExpressionHandlerRef = function_ref<void(
@@ -606,7 +607,7 @@ class DWARFLinker : public DWARFLinkerBase {
606607

607608
/// Compute and emit debug locations (.debug_loc, .debug_loclists)
608609
/// for \p Unit, patch the attributes referencing it.
609-
void generateUnitLocations(CompileUnit &Unit, const DWARFFile &File,
610+
LLVM_ABI void generateUnitLocations(CompileUnit &Unit, const DWARFFile &File,
610611
ExpressionHandlerRef ExprHandler);
611612

612613
private:

llvm/include/llvm/DWARFLinker/Classic/DWARFLinkerCompileUnit.h

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#ifndef LLVM_DWARFLINKER_CLASSIC_DWARFLINKERCOMPILEUNIT_H
1010
#define LLVM_DWARFLINKER_CLASSIC_DWARFLINKERCOMPILEUNIT_H
1111

12+
#include "llvm/Support/Compiler.h"
1213
#include "llvm/ADT/AddressRanges.h"
1314
#include "llvm/ADT/DenseMap.h"
1415
#include "llvm/CodeGen/DIE.h"
@@ -142,9 +143,9 @@ class CompileUnit {
142143

143144
bool hasODR() const { return HasODR; }
144145
bool isClangModule() const { return !ClangModuleName.empty(); }
145-
uint16_t getLanguage();
146+
LLVM_ABI uint16_t getLanguage();
146147
/// Return the DW_AT_LLVM_sysroot of the compile unit or an empty StringRef.
147-
StringRef getSysRoot();
148+
LLVM_ABI StringRef getSysRoot();
148149

149150
const std::string &getClangModuleName() const { return ClangModuleName; }
150151

@@ -185,58 +186,58 @@ class CompileUnit {
185186
/// Mark every DIE in this unit as kept. This function also
186187
/// marks variables as InDebugMap so that they appear in the
187188
/// reconstructed accelerator tables.
188-
void markEverythingAsKept();
189+
LLVM_ABI void markEverythingAsKept();
189190

190191
/// Compute the end offset for this unit. Must be called after the CU's DIEs
191192
/// have been cloned. \returns the next unit offset (which is also the
192193
/// current debug_info section size).
193-
uint64_t computeNextUnitOffset(uint16_t DwarfVersion);
194+
LLVM_ABI uint64_t computeNextUnitOffset(uint16_t DwarfVersion);
194195

195196
/// Keep track of a forward reference to DIE \p Die in \p RefUnit by \p
196197
/// Attr. The attribute should be fixed up later to point to the absolute
197198
/// offset of \p Die in the debug_info section or to the canonical offset of
198199
/// \p Ctxt if it is non-null.
199-
void noteForwardReference(DIE *Die, const CompileUnit *RefUnit,
200+
LLVM_ABI void noteForwardReference(DIE *Die, const CompileUnit *RefUnit,
200201
DeclContext *Ctxt, PatchLocation Attr);
201202

202203
/// Apply all fixups recorded by noteForwardReference().
203-
void fixupForwardReferences();
204+
LLVM_ABI void fixupForwardReferences();
204205

205206
/// Add the low_pc of a label that is relocated by applying
206207
/// offset \p PCOffset.
207-
void addLabelLowPc(uint64_t LabelLowPc, int64_t PcOffset);
208+
LLVM_ABI void addLabelLowPc(uint64_t LabelLowPc, int64_t PcOffset);
208209

209210
/// Add a function range [\p LowPC, \p HighPC) that is relocated by applying
210211
/// offset \p PCOffset.
211-
void addFunctionRange(uint64_t LowPC, uint64_t HighPC, int64_t PCOffset);
212+
LLVM_ABI void addFunctionRange(uint64_t LowPC, uint64_t HighPC, int64_t PCOffset);
212213

213214
/// Keep track of a DW_AT_range attribute that we will need to patch up later.
214-
void noteRangeAttribute(const DIE &Die, PatchLocation Attr);
215+
LLVM_ABI void noteRangeAttribute(const DIE &Die, PatchLocation Attr);
215216

216217
/// Keep track of a location attribute pointing to a location list in the
217218
/// debug_loc section.
218-
void noteLocationAttribute(PatchLocation Attr);
219+
LLVM_ABI void noteLocationAttribute(PatchLocation Attr);
219220

220221
// Record that the given DW_AT_LLVM_stmt_sequence attribute may need to be
221222
// patched later.
222-
void noteStmtSeqListAttribute(PatchLocation Attr);
223+
LLVM_ABI void noteStmtSeqListAttribute(PatchLocation Attr);
223224

224225
/// Add a name accelerator entry for \a Die with \a Name.
225-
void addNamespaceAccelerator(const DIE *Die, DwarfStringPoolEntryRef Name);
226+
LLVM_ABI void addNamespaceAccelerator(const DIE *Die, DwarfStringPoolEntryRef Name);
226227

227228
/// Add a name accelerator entry for \a Die with \a Name.
228-
void addNameAccelerator(const DIE *Die, DwarfStringPoolEntryRef Name,
229+
LLVM_ABI void addNameAccelerator(const DIE *Die, DwarfStringPoolEntryRef Name,
229230
bool SkipPubnamesSection = false);
230231

231232
/// Add various accelerator entries for \p Die with \p Name which is stored
232233
/// in the string table at \p Offset. \p Name must be an Objective-C
233234
/// selector.
234-
void addObjCAccelerator(const DIE *Die, DwarfStringPoolEntryRef Name,
235+
LLVM_ABI void addObjCAccelerator(const DIE *Die, DwarfStringPoolEntryRef Name,
235236
bool SkipPubnamesSection = false);
236237

237238
/// Add a type accelerator entry for \p Die with \p Name which is stored in
238239
/// the string table at \p Offset.
239-
void addTypeAccelerator(const DIE *Die, DwarfStringPoolEntryRef Name,
240+
LLVM_ABI void addTypeAccelerator(const DIE *Die, DwarfStringPoolEntryRef Name,
240241
bool ObjcClassImplementation,
241242
uint32_t QualifiedNameHash);
242243

llvm/include/llvm/DWARFLinker/Classic/DWARFStreamer.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#ifndef LLVM_DWARFLINKER_CLASSIC_DWARFSTREAMER_H
1010
#define LLVM_DWARFLINKER_CLASSIC_DWARFSTREAMER_H
1111

12+
#include "llvm/Support/Compiler.h"
1213
#include "DWARFLinker.h"
1314
#include "llvm/BinaryFormat/Swift.h"
1415
#include "llvm/CodeGen/AsmPrinter.h"
@@ -41,7 +42,7 @@ namespace classic {
4142
///
4243
/// All interactions with the MC layer that is used to build the debug
4344
/// information binary representation are handled in this class.
44-
class DwarfStreamer : public DwarfEmitter {
45+
class LLVM_ABI DwarfStreamer : public DwarfEmitter {
4546
public:
4647
DwarfStreamer(DWARFLinkerBase::OutputFileType OutFileType,
4748
raw_pwrite_stream &OutFile,

llvm/include/llvm/DWARFLinker/DWARFLinkerBase.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#ifndef LLVM_DWARFLINKER_DWARFLINKERBASE_H
1010
#define LLVM_DWARFLINKER_DWARFLINKERBASE_H
11+
#include "llvm/Support/Compiler.h"
1112
#include "AddressesMap.h"
1213
#include "DWARFFile.h"
1314
#include "llvm/ADT/AddressRanges.h"
@@ -68,7 +69,7 @@ getSectionName(DebugSectionKind SectionKind) {
6869
}
6970

7071
/// Recognise the table name and match it with the DebugSectionKind.
71-
std::optional<DebugSectionKind> parseDebugTableName(StringRef Name);
72+
LLVM_ABI std::optional<DebugSectionKind> parseDebugTableName(StringRef Name);
7273

7374
/// The base interface for DWARFLinker implementations.
7475
class DWARFLinkerBase {

llvm/include/llvm/DWARFLinker/Parallel/DWARFLinker.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#ifndef LLVM_DWARFLINKER_PARALLEL_DWARFLINKER_H
1010
#define LLVM_DWARFLINKER_PARALLEL_DWARFLINKER_H
1111

12+
#include "llvm/Support/Compiler.h"
1213
#include "llvm/CodeGen/AsmPrinter.h"
1314
#include "llvm/DWARFLinker/DWARFFile.h"
1415
#include "llvm/DWARFLinker/DWARFLinkerBase.h"
@@ -122,7 +123,7 @@ class DWARFLinker : public DWARFLinkerBase {
122123
virtual ~DWARFLinker() = default;
123124

124125
/// Creates dwarf linker instance.
125-
static std::unique_ptr<DWARFLinker>
126+
LLVM_ABI static std::unique_ptr<DWARFLinker>
126127
createLinker(MessageHandlerTy ErrorHandler, MessageHandlerTy WarningHandler);
127128

128129
/// Set output DWARF handler. Result of linking DWARF is set of sections

llvm/include/llvm/DWP/DWP.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#ifndef LLVM_DWP_DWP_H
22
#define LLVM_DWP_DWP_H
33

4+
#include "llvm/Support/Compiler.h"
45
#include "DWPStringPool.h"
56
#include "llvm/ADT/ArrayRef.h"
67
#include "llvm/ADT/MapVector.h"
@@ -66,12 +67,12 @@ struct CompileUnitIdentifiers {
6667
const char *DWOName = "";
6768
};
6869

69-
Error write(MCStreamer &Out, ArrayRef<std::string> Inputs,
70+
LLVM_ABI Error write(MCStreamer &Out, ArrayRef<std::string> Inputs,
7071
OnCuIndexOverflow OverflowOptValue);
7172

72-
unsigned getContributionIndex(DWARFSectionKind Kind, uint32_t IndexVersion);
73+
LLVM_ABI unsigned getContributionIndex(DWARFSectionKind Kind, uint32_t IndexVersion);
7374

74-
Error handleSection(
75+
LLVM_ABI Error handleSection(
7576
const StringMap<std::pair<MCSection *, DWARFSectionKind>> &KnownSections,
7677
const MCSection *StrSection, const MCSection *StrOffsetSection,
7778
const MCSection *TypesSection, const MCSection *CUIndexSection,
@@ -85,17 +86,17 @@ Error handleSection(
8586
StringRef &CurCUIndexSection, StringRef &CurTUIndexSection,
8687
std::vector<std::pair<DWARFSectionKind, uint32_t>> &SectionLength);
8788

88-
Expected<InfoSectionUnitHeader> parseInfoSectionUnitHeader(StringRef Info);
89+
LLVM_ABI Expected<InfoSectionUnitHeader> parseInfoSectionUnitHeader(StringRef Info);
8990

90-
void writeStringsAndOffsets(MCStreamer &Out, DWPStringPool &Strings,
91+
LLVM_ABI void writeStringsAndOffsets(MCStreamer &Out, DWPStringPool &Strings,
9192
MCSection *StrOffsetSection,
9293
StringRef CurStrSection,
9394
StringRef CurStrOffsetSection, uint16_t Version);
9495

95-
Error buildDuplicateError(const std::pair<uint64_t, UnitIndexEntry> &PrevE,
96+
LLVM_ABI Error buildDuplicateError(const std::pair<uint64_t, UnitIndexEntry> &PrevE,
9697
const CompileUnitIdentifiers &ID, StringRef DWPName);
9798

98-
void writeIndex(MCStreamer &Out, MCSection *Section,
99+
LLVM_ABI void writeIndex(MCStreamer &Out, MCSection *Section,
99100
ArrayRef<unsigned> ContributionOffsets,
100101
const MapVector<uint64_t, UnitIndexEntry> &IndexEntries,
101102
uint32_t IndexVersion);

llvm/include/llvm/DWP/DWPError.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#ifndef LLVM_DWP_DWPERROR_H
22
#define LLVM_DWP_DWPERROR_H
33

4+
#include "llvm/Support/Compiler.h"
45
#include "llvm/Support/Error.h"
56
#include "llvm/Support/ErrorHandling.h"
67
#include <string>
@@ -13,7 +14,7 @@ class DWPError : public ErrorInfo<DWPError> {
1314
std::error_code convertToErrorCode() const override {
1415
llvm_unreachable("Not implemented");
1516
}
16-
static char ID;
17+
LLVM_ABI static char ID;
1718

1819
private:
1920
std::string Info;

0 commit comments

Comments
 (0)