[llvm] [DWARFLinker][DWARFLinkerParallel] Refactor DWARFLinker&DWARFLinkerParallel to have a common library. (PR #74725)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 7 07:10:12 PST 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-debuginfo
Author: None (avl-llvm)
<details>
<summary>Changes</summary>
This creates DWARFLinkerBase library which shares code between DWARFLinker and DWARFLinkerParallel. Now AddressesMap, DWARFFile, IndexedValuesMap are shared between DWARFLinker implementations.
---
Patch is 224.10 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/74725.diff
61 Files Affected:
- (renamed) llvm/include/llvm/DWARFLinker/AddressesMap.h (+5-5)
- (renamed) llvm/include/llvm/DWARFLinker/Apple/DWARFLinker.h (+65-360)
- (renamed) llvm/include/llvm/DWARFLinker/Apple/DWARFLinkerCompileUnit.h (+5-3)
- (renamed) llvm/include/llvm/DWARFLinker/Apple/DWARFLinkerDeclContext.h (+5-3)
- (renamed) llvm/include/llvm/DWARFLinker/Apple/DWARFStreamer.h (+72-71)
- (renamed) llvm/include/llvm/DWARFLinker/ArrayList.h (+5-5)
- (renamed) llvm/include/llvm/DWARFLinker/DWARFFile.h (+9-8)
- (added) llvm/include/llvm/DWARFLinker/DWARFLinkerBase.h (+124)
- (renamed) llvm/include/llvm/DWARFLinker/IndexedValuesMap.h (+7-6)
- (added) llvm/include/llvm/DWARFLinker/LLVM/DWARFLinker.h (+191)
- (renamed) llvm/include/llvm/DWARFLinker/StringPool.h (+6-6)
- (renamed) llvm/include/llvm/DWARFLinker/Utils.h (+31-5)
- (removed) llvm/include/llvm/DWARFLinkerParallel/DWARFLinker.h (-223)
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFDebugMacro.h (+5-2)
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h (+3-1)
- (modified) llvm/lib/CMakeLists.txt (-1)
- (added) llvm/lib/DWARFLinker/Apple/CMakeLists.txt (+24)
- (renamed) llvm/lib/DWARFLinker/Apple/DWARFLinker.cpp (+96-129)
- (renamed) llvm/lib/DWARFLinker/Apple/DWARFLinkerCompileUnit.cpp (+4-5)
- (renamed) llvm/lib/DWARFLinker/Apple/DWARFLinkerDeclContext.cpp (+4-5)
- (renamed) llvm/lib/DWARFLinker/Apple/DWARFStreamer.cpp (+63-26)
- (modified) llvm/lib/DWARFLinker/CMakeLists.txt (+5-14)
- (renamed) llvm/lib/DWARFLinker/LLVM/AcceleratorRecordsSaver.cpp (+4-6)
- (renamed) llvm/lib/DWARFLinker/LLVM/AcceleratorRecordsSaver.h (+5-3)
- (renamed) llvm/lib/DWARFLinker/LLVM/CMakeLists.txt (+3-3)
- (renamed) llvm/lib/DWARFLinker/LLVM/DIEAttributeCloner.cpp (+3-5)
- (renamed) llvm/lib/DWARFLinker/LLVM/DIEAttributeCloner.h (+6-4)
- (renamed) llvm/lib/DWARFLinker/LLVM/DIEGenerator.h (+5-3)
- (renamed) llvm/lib/DWARFLinker/LLVM/DWARFEmitterImpl.cpp (+4-26)
- (renamed) llvm/lib/DWARFLinker/LLVM/DWARFEmitterImpl.h (+11-19)
- (added) llvm/lib/DWARFLinker/LLVM/DWARFLinker.cpp (+77)
- (renamed) llvm/lib/DWARFLinker/LLVM/DWARFLinkerCompileUnit.cpp (+10-29)
- (renamed) llvm/lib/DWARFLinker/LLVM/DWARFLinkerCompileUnit.h (+11-7)
- (renamed) llvm/lib/DWARFLinker/LLVM/DWARFLinkerGlobalData.h (+24-9)
- (renamed) llvm/lib/DWARFLinker/LLVM/DWARFLinkerImpl.cpp (+136-157)
- (renamed) llvm/lib/DWARFLinker/LLVM/DWARFLinkerImpl.h (+16-16)
- (renamed) llvm/lib/DWARFLinker/LLVM/DWARFLinkerTypeUnit.cpp (+2-1)
- (renamed) llvm/lib/DWARFLinker/LLVM/DWARFLinkerTypeUnit.h (+5-3)
- (renamed) llvm/lib/DWARFLinker/LLVM/DWARFLinkerUnit.cpp (+16-17)
- (renamed) llvm/lib/DWARFLinker/LLVM/DWARFLinkerUnit.h (+8-6)
- (renamed) llvm/lib/DWARFLinker/LLVM/DebugLineSectionEmitter.h (+7-5)
- (renamed) llvm/lib/DWARFLinker/LLVM/DependencyTracker.cpp (+3-5)
- (renamed) llvm/lib/DWARFLinker/LLVM/DependencyTracker.h (+5-3)
- (renamed) llvm/lib/DWARFLinker/LLVM/OutputSections.cpp (+23-92)
- (renamed) llvm/lib/DWARFLinker/LLVM/OutputSections.h (+53-82)
- (renamed) llvm/lib/DWARFLinker/LLVM/StringEntryToDwarfStringPoolEntryMap.h (+6-4)
- (renamed) llvm/lib/DWARFLinker/LLVM/SyntheticTypeNameBuilder.cpp (+3-5)
- (renamed) llvm/lib/DWARFLinker/LLVM/SyntheticTypeNameBuilder.h (+5-3)
- (renamed) llvm/lib/DWARFLinker/LLVM/TypePool.h (+6-4)
- (renamed) llvm/lib/DWARFLinker/Utils.cpp (+5-2)
- (removed) llvm/lib/DWARFLinkerParallel/DWARFFile.cpp (-17)
- (removed) llvm/lib/DWARFLinkerParallel/DWARFLinker.cpp (-18)
- (modified) llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp (+2-8)
- (modified) llvm/tools/dsymutil/CMakeLists.txt (+1)
- (modified) llvm/tools/dsymutil/DwarfLinkerForBinary.cpp (+86-107)
- (modified) llvm/tools/dsymutil/DwarfLinkerForBinary.h (+7-14)
- (modified) llvm/tools/dsymutil/LinkUtils.h (+3-3)
- (modified) llvm/tools/dsymutil/dsymutil.cpp (+2-1)
- (modified) llvm/tools/llvm-dwarfutil/CMakeLists.txt (+1)
- (modified) llvm/tools/llvm-dwarfutil/DebugInfoLinker.cpp (+35-22)
- (modified) llvm/unittests/DWARFLinkerParallel/StringPoolTest.cpp (+2-2)
``````````diff
diff --git a/llvm/include/llvm/DWARFLinkerParallel/AddressesMap.h b/llvm/include/llvm/DWARFLinker/AddressesMap.h
similarity index 97%
rename from llvm/include/llvm/DWARFLinkerParallel/AddressesMap.h
rename to llvm/include/llvm/DWARFLinker/AddressesMap.h
index b451fee4e0b723..b9d4223456cb4b 100644
--- a/llvm/include/llvm/DWARFLinkerParallel/AddressesMap.h
+++ b/llvm/include/llvm/DWARFLinker/AddressesMap.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_DWARFLINKERPARALLEL_ADDRESSESMAP_H
-#define LLVM_DWARFLINKERPARALLEL_ADDRESSESMAP_H
+#ifndef LLVM_DWARFLINKER_ADDRESSESMAP_H
+#define LLVM_DWARFLINKER_ADDRESSESMAP_H
#include "llvm/ADT/AddressRanges.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
@@ -17,7 +17,7 @@
#include <cstdint>
namespace llvm {
-namespace dwarflinker_parallel {
+namespace dwarflinker {
/// Mapped value in the address map is the offset to apply to the
/// linked address.
@@ -186,7 +186,7 @@ class AddressesMap {
}
};
-} // end of namespace dwarflinker_parallel
+} // end namespace dwarflinker
} // end namespace llvm
-#endif // LLVM_DWARFLINKERPARALLEL_ADDRESSESMAP_H
+#endif // LLVM_DWARFLINKER_ADDRESSESMAP_H
diff --git a/llvm/include/llvm/DWARFLinker/DWARFLinker.h b/llvm/include/llvm/DWARFLinker/Apple/DWARFLinker.h
similarity index 61%
rename from llvm/include/llvm/DWARFLinker/DWARFLinker.h
rename to llvm/include/llvm/DWARFLinker/Apple/DWARFLinker.h
index 2bd85e30d3b13b..0788ac7547b207 100644
--- a/llvm/include/llvm/DWARFLinker/DWARFLinker.h
+++ b/llvm/include/llvm/DWARFLinker/Apple/DWARFLinker.h
@@ -6,14 +6,15 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_DWARFLINKER_DWARFLINKER_H
-#define LLVM_DWARFLINKER_DWARFLINKER_H
+#ifndef LLVM_DWARFLINKER_APPLE_DWARFLINKER_H
+#define LLVM_DWARFLINKER_APPLE_DWARFLINKER_H
#include "llvm/ADT/AddressRanges.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/CodeGen/AccelTable.h"
#include "llvm/CodeGen/NonRelocatableStringpool.h"
-#include "llvm/DWARFLinker/DWARFLinkerCompileUnit.h"
+#include "llvm/DWARFLinker/Apple/DWARFLinkerCompileUnit.h"
+#include "llvm/DWARFLinker/DWARFLinkerBase.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugLine.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugRangeList.h"
@@ -25,301 +26,15 @@ namespace llvm {
class DWARFExpression;
class DWARFUnit;
class DataExtractor;
-class DeclContextTree;
template <typename T> class SmallVectorImpl;
-enum class DwarfLinkerClient { Dsymutil, LLD, General };
-
-/// AddressesMap represents information about valid addresses used
-/// by debug information. Valid addresses are those which points to
-/// live code sections. i.e. relocations for these addresses point
-/// into sections which would be/are placed into resulting binary.
-class AddressesMap {
-public:
- virtual ~AddressesMap();
-
- /// Checks that there are valid relocations against a .debug_info
- /// section.
- virtual bool hasValidRelocs() = 0;
-
- /// Checks that the specified DWARF expression operand \p Op references live
- /// code section and returns the relocation adjustment value (to get the
- /// linked address this value might be added to the source expression operand
- /// address).
- /// \returns relocation adjustment value or std::nullopt if there is no
- /// corresponding live address.
- virtual std::optional<int64_t>
- getExprOpAddressRelocAdjustment(DWARFUnit &U,
- const DWARFExpression::Operation &Op,
- uint64_t StartOffset, uint64_t EndOffset) = 0;
-
- /// Checks that the specified subprogram \p DIE references the live code
- /// section and returns the relocation adjustment value (to get the linked
- /// address this value might be added to the source subprogram address).
- /// Allowed kinds of input DIE: DW_TAG_subprogram, DW_TAG_label.
- /// \returns relocation adjustment value or std::nullopt if there is no
- /// corresponding live address.
- virtual std::optional<int64_t>
- getSubprogramRelocAdjustment(const DWARFDie &DIE) = 0;
-
- /// Returns the file name associated to the AddessesMap
- virtual std::optional<StringRef> getLibraryInstallName() = 0;
-
- /// Apply the valid relocations to the buffer \p Data, taking into
- /// account that Data is at \p BaseOffset in the .debug_info section.
- ///
- /// \returns true whether any reloc has been applied.
- virtual bool applyValidRelocs(MutableArrayRef<char> Data, uint64_t BaseOffset,
- bool IsLittleEndian) = 0;
-
- /// Check if the linker needs to gather and save relocation info.
- virtual bool needToSaveValidRelocs() = 0;
-
- /// Update and save original relocations located in between StartOffset and
- /// EndOffset. LinkedOffset is the value which should be added to the original
- /// relocation offset to get new relocation offset in linked binary.
- virtual void updateAndSaveValidRelocs(bool IsDWARF5,
- uint64_t OriginalUnitOffset,
- int64_t LinkedOffset,
- uint64_t StartOffset,
- uint64_t EndOffset) = 0;
-
- /// Update the valid relocations that used OriginalUnitOffset as the compile
- /// unit offset, and update their values to reflect OutputUnitOffset.
- virtual void updateRelocationsWithUnitOffset(uint64_t OriginalUnitOffset,
- uint64_t OutputUnitOffset) = 0;
-
- /// Erases all data.
- virtual void clear() = 0;
-};
-
+namespace dwarflinker {
+class DeclContextTree;
using Offset2UnitMap = DenseMap<uint64_t, CompileUnit *>;
-struct DebugDieValuePool {
- DenseMap<uint64_t, uint64_t> DieValueMap;
- SmallVector<uint64_t> DieValues;
-
- uint64_t getValueIndex(uint64_t Value) {
- DenseMap<uint64_t, uint64_t>::iterator It = DieValueMap.find(Value);
- if (It == DieValueMap.end()) {
- It = DieValueMap.insert(std::make_pair(Value, DieValues.size())).first;
- DieValues.push_back(Value);
- }
- return It->second;
- }
-
- void clear() {
- DieValueMap.clear();
- DieValues.clear();
- }
-};
-
-/// DwarfEmitter presents interface to generate all debug info tables.
-class DwarfEmitter {
-public:
- virtual ~DwarfEmitter();
-
- /// Emit section named SecName with data SecData.
- virtual void emitSectionContents(StringRef SecData, StringRef SecName) = 0;
-
- /// Emit the abbreviation table \p Abbrevs to the .debug_abbrev section.
- virtual void
- emitAbbrevs(const std::vector<std::unique_ptr<DIEAbbrev>> &Abbrevs,
- unsigned DwarfVersion) = 0;
-
- /// Emit the string table described by \p Pool into .debug_str table.
- virtual void emitStrings(const NonRelocatableStringpool &Pool) = 0;
-
- /// Emit the debug string offset table described by \p StringOffsets into the
- /// .debug_str_offsets table.
- virtual void emitStringOffsets(const SmallVector<uint64_t> &StringOffsets,
- uint16_t TargetDWARFVersion) = 0;
-
- /// Emit the string table described by \p Pool into .debug_line_str table.
- virtual void emitLineStrings(const NonRelocatableStringpool &Pool) = 0;
-
- /// Emit DWARF debug names.
- virtual void emitDebugNames(DWARF5AccelTable &Table) = 0;
-
- /// Emit Apple namespaces accelerator table.
- virtual void
- emitAppleNamespaces(AccelTable<AppleAccelTableStaticOffsetData> &Table) = 0;
-
- /// Emit Apple names accelerator table.
- virtual void
- emitAppleNames(AccelTable<AppleAccelTableStaticOffsetData> &Table) = 0;
-
- /// Emit Apple Objective-C accelerator table.
- virtual void
- emitAppleObjc(AccelTable<AppleAccelTableStaticOffsetData> &Table) = 0;
-
- /// Emit Apple type accelerator table.
- virtual void
- emitAppleTypes(AccelTable<AppleAccelTableStaticTypeData> &Table) = 0;
-
- /// Emit debug ranges (.debug_ranges, .debug_rnglists) header.
- virtual MCSymbol *emitDwarfDebugRangeListHeader(const CompileUnit &Unit) = 0;
-
- /// Emit debug ranges (.debug_ranges, .debug_rnglists) fragment.
- virtual void emitDwarfDebugRangeListFragment(
- const CompileUnit &Unit, const AddressRanges &LinkedRanges,
- PatchLocation Patch, DebugDieValuePool &AddrPool) = 0;
-
- /// Emit debug ranges (.debug_ranges, .debug_rnglists) footer.
- virtual void emitDwarfDebugRangeListFooter(const CompileUnit &Unit,
- MCSymbol *EndLabel) = 0;
-
- /// Emit debug locations (.debug_loc, .debug_loclists) header.
- virtual MCSymbol *emitDwarfDebugLocListHeader(const CompileUnit &Unit) = 0;
-
- /// Emit debug locations (.debug_loc, .debug_loclists) fragment.
- virtual void emitDwarfDebugLocListFragment(
- const CompileUnit &Unit,
- const DWARFLocationExpressionsVector &LinkedLocationExpression,
- PatchLocation Patch, DebugDieValuePool &AddrPool) = 0;
-
- /// Emit debug locations (.debug_loc, .debug_loclists) footer.
- virtual void emitDwarfDebugLocListFooter(const CompileUnit &Unit,
- MCSymbol *EndLabel) = 0;
-
- /// Emit .debug_addr header.
- virtual MCSymbol *emitDwarfDebugAddrsHeader(const CompileUnit &Unit) = 0;
-
- /// Emit the addresses described by \p Addrs into the .debug_addr section.
- virtual void emitDwarfDebugAddrs(const SmallVector<uint64_t> &Addrs,
- uint8_t AddrSize) = 0;
-
- /// Emit .debug_addr footer.
- virtual void emitDwarfDebugAddrsFooter(const CompileUnit &Unit,
- MCSymbol *EndLabel) = 0;
-
- /// Emit .debug_aranges entries for \p Unit
- virtual void
- emitDwarfDebugArangesTable(const CompileUnit &Unit,
- const AddressRanges &LinkedRanges) = 0;
-
- /// Emit specified \p LineTable into .debug_line table.
- virtual void emitLineTableForUnit(const DWARFDebugLine::LineTable &LineTable,
- const CompileUnit &Unit,
- OffsetsStringPool &DebugStrPool,
- OffsetsStringPool &DebugLineStrPool) = 0;
-
- /// Emit the .debug_pubnames contribution for \p Unit.
- virtual void emitPubNamesForUnit(const CompileUnit &Unit) = 0;
-
- /// Emit the .debug_pubtypes contribution for \p Unit.
- virtual void emitPubTypesForUnit(const CompileUnit &Unit) = 0;
-
- /// Emit a CIE.
- virtual void emitCIE(StringRef CIEBytes) = 0;
-
- /// Emit an FDE with data \p Bytes.
- virtual void emitFDE(uint32_t CIEOffset, uint32_t AddreSize, uint64_t Address,
- StringRef Bytes) = 0;
-
- /// Emit the compilation unit header for \p Unit in the
- /// .debug_info section.
- ///
- /// As a side effect, this also switches the current Dwarf version
- /// of the MC layer to the one of U.getOrigUnit().
- virtual void emitCompileUnitHeader(CompileUnit &Unit,
- unsigned DwarfVersion) = 0;
-
- /// Recursively emit the DIE tree rooted at \p Die.
- virtual void emitDIE(DIE &Die) = 0;
-
- /// Emit all available macro tables(DWARFv4 and DWARFv5).
- /// Use \p UnitMacroMap to get compilation unit by macro table offset.
- /// Side effects: Fill \p StringPool with macro strings, update
- /// DW_AT_macro_info, DW_AT_macros attributes for corresponding compile
- /// units.
- virtual void emitMacroTables(DWARFContext *Context,
- const Offset2UnitMap &UnitMacroMap,
- OffsetsStringPool &StringPool) = 0;
-
- /// Returns size of generated .debug_line section.
- virtual uint64_t getLineSectionSize() const = 0;
-
- /// Returns size of generated .debug_frame section.
- virtual uint64_t getFrameSectionSize() const = 0;
-
- /// Returns size of generated .debug_ranges section.
- virtual uint64_t getRangesSectionSize() const = 0;
-
- /// Returns size of generated .debug_rnglists section.
- virtual uint64_t getRngListsSectionSize() const = 0;
-
- /// Returns size of generated .debug_info section.
- virtual uint64_t getDebugInfoSectionSize() const = 0;
-
- /// Returns size of generated .debug_macinfo section.
- virtual uint64_t getDebugMacInfoSectionSize() const = 0;
-
- /// Returns size of generated .debug_macro section.
- virtual uint64_t getDebugMacroSectionSize() const = 0;
-
- /// Returns size of generated .debug_loclists section.
- virtual uint64_t getLocListsSectionSize() const = 0;
-
- /// Returns size of generated .debug_addr section.
- virtual uint64_t getDebugAddrSectionSize() const = 0;
-
- /// Dump the file to the disk.
- virtual void finish() = 0;
-
- /// Emit the swift_ast section stored in \p Buffer.
- virtual void emitSwiftAST(StringRef Buffer) = 0;
-
- /// Emit the swift reflection section stored in \p Buffer.
- virtual void emitSwiftReflectionSection(
- llvm::binaryformat::Swift5ReflectionSectionKind ReflSectionKind,
- StringRef Buffer, uint32_t Alignment, uint32_t Size) = 0;
-
- /// Returns underlying AsmPrinter.
- virtual AsmPrinter &getAsmPrinter() const = 0;
-};
-
class DwarfStreamer;
using UnitListTy = std::vector<std::unique_ptr<CompileUnit>>;
-/// This class represents DWARF information for source file
-/// and its address map.
-class DWARFFile {
-public:
- using UnloadCallbackTy = std::function<void(StringRef FileName)>;
- DWARFFile(StringRef Name, std::unique_ptr<DWARFContext> Dwarf,
- std::unique_ptr<AddressesMap> Addresses,
- UnloadCallbackTy UnloadFunc = nullptr)
- : FileName(Name), Dwarf(std::move(Dwarf)),
- Addresses(std::move(Addresses)), UnloadFunc(UnloadFunc) {}
-
- /// The object file name.
- StringRef FileName;
-
- /// The source DWARF information.
- std::unique_ptr<DWARFContext> Dwarf;
-
- /// Helpful address information(list of valid address ranges, relocations).
- std::unique_ptr<AddressesMap> Addresses;
-
- /// Callback to the module keeping object file to unload.
- UnloadCallbackTy UnloadFunc;
-
- /// Unloads object file and corresponding AddressesMap and Dwarf Context.
- void unload() {
- Addresses.reset();
- Dwarf.reset();
-
- if (UnloadFunc)
- UnloadFunc(FileName);
- }
-};
-
-typedef std::map<std::string, std::string> swiftInterfacesMap;
-typedef std::map<std::string, std::string> objectPrefixMap;
-
-typedef function_ref<void(const DWARFUnit &Unit)> CompileUnitHandler;
-
/// The core of the Dwarf linking logic.
///
/// The generation of the dwarf information from the object files will be
@@ -334,46 +49,20 @@ typedef function_ref<void(const DWARFUnit &Unit)> CompileUnitHandler;
/// a variable). These relocations are called ValidRelocs in the
/// AddressesInfo and are gathered as a very first step when we start
/// processing a object file.
-class DWARFLinker {
+class DWARFLinker : public DWARFLinkerBase {
public:
- typedef std::function<void(const Twine &Warning, StringRef Context,
- const DWARFDie *DIE)>
- messageHandler;
- DWARFLinker(messageHandler ErrorHandler, messageHandler WarningHandler,
+ DWARFLinker(MessageHandlerTy ErrorHandler, MessageHandlerTy WarningHandler,
std::function<StringRef(StringRef)> StringsTranslator)
- : DwarfLinkerClientID(DwarfLinkerClient::Dsymutil),
- StringsTranslator(StringsTranslator), ErrorHandler(ErrorHandler),
+ : StringsTranslator(StringsTranslator), ErrorHandler(ErrorHandler),
WarningHandler(WarningHandler) {}
static std::unique_ptr<DWARFLinker> createLinker(
- messageHandler ErrorHandler, messageHandler WarningHandler,
+ MessageHandlerTy ErrorHandler, MessageHandlerTy WarningHandler,
std::function<StringRef(StringRef)> StringsTranslator = nullptr) {
return std::make_unique<DWARFLinker>(ErrorHandler, WarningHandler,
StringsTranslator);
}
- /// Type of output file.
- enum class OutputFileType {
- Object,
- Assembly,
- };
-
- /// The kind of accelerator tables we should emit.
- enum class AccelTableKind : uint8_t {
- Apple, ///< .apple_names, .apple_namespaces, .apple_types, .apple_objc.
- Pub, ///< .debug_pubnames, .debug_pubtypes
- DebugNames ///< .debug_names.
- };
- typedef std::function<void(const DWARFFile &File, llvm::StringRef Output)> inputVerificationHandler;
- typedef std::function<ErrorOr<DWARFFile &>(StringRef ContainerName,
- StringRef Path)>
- objFileLoader;
-
- Error createEmitter(const Triple &TheTriple, OutputFileType FileType,
- raw_pwrite_stream &OutFile);
-
- DwarfEmitter *getEmitter();
-
/// Add object file to be linked. Pre-load compile unit die. Call
/// \p OnCUDieLoaded for each compile unit die. If specified \p File
/// has reference to the Clang module then such module would be
@@ -381,73 +70,84 @@ class DWARFLinker {
///
/// \pre NoODR, Update options should be set before call to addObjectFile.
void addObjectFile(
- DWARFFile &File, objFileLoader Loader = nullptr,
- CompileUnitHandler OnCUDieLoaded = [](const DWARFUnit &) {});
+ DWARFFile &File, ObjFileLoaderTy Loader = nullptr,
+ CompileUnitHandlerTy OnCUDieLoaded = [](const DWARFUnit &) {}) override;
/// Link debug info for added objFiles. Object files are linked all together.
- Error link();
+ Error link() override;
/// A number of methods setting various linking options:
/// Allows to generate log of linking process to the standard output.
- void setVerbosity(bool Verbose) { Options.Verbose = Verbose; }
+ void setVerbosity(bool Verbose) override { Options.Verbose = Verbose; }
/// Print statistics to standard output.
- void setStatistics(bool Statistics) { Options.Statistics = Statistics; }
+ void setStatistics(bool Statistics) override {
+ Options.Statistics = Statistics;
+ }
/// Verify the input DWARF.
- void setVerifyInputDWARF(bool Verify) { Options.VerifyInputDWARF = Verify; }
+ void setVerifyInputDWARF(bool Verify) override {
+ Options.VerifyInputDWARF = Verify;
+ }
/// Do not unique types according to ODR.
- void setNoODR(bool NoODR) { Options.NoODR = NoODR; }
+ void setNoODR(bool NoODR) override { Options.NoODR = NoODR; }
/// Update index tables only(do not modify rest of DWARF).
- void setUpdateIndexTablesOnly(bool Update) { Options.Update = Update; }
+ void setUpdateIndexTablesOnly(bool Update) override {
+ Options.Update = Update;
+ }
/// Allow generating valid, but non-deterministic output.
- void setAllowNonDeterministicOutput(bool) { /* Nothing to do. */
+ void setAllowNonDeterministicOutput(bool) override { /* Nothing to do. */
}
/// Set whether to keep the enclosing function for a static variable.
- void setKeepFunctionForStatic(bool KeepFunctionForStatic) {
+ void setKeepFunctionForStatic(bool KeepFunctionForStatic) override {
Options.KeepFunctionForStatic = KeepFunctionForStatic;
}
/// Use specified number of threads for parallel files linking.
- void setNumThreads(unsigned NumThreads) { Options.Threads = NumThreads; }
+ void setNumThreads(unsigned NumThreads) override {
+ Options.Threads = NumThreads;
+ }
/// Add kind of accelerator tables to be generated.
- void addAccelTableKind(AccelTableKind Kind) {
+ void addAccelTableKind(AccelTableKind Kind) override {
assert(!llvm::is_contained(Options.AccelTables, Kind));
Options.AccelTables.emplace_back(Kind);
}
/// Set prepend path for clang modules.
- void setPrependPath(const std::string &Ppath) { Options.PrependPath = Ppath; }
+ void setPrependPath(const std::string &Ppath) override {
+ Options.PrependPath = Ppath;
+ }
/// Set estimated objects files amount, for preliminary data allocation.
- void setEstimatedObjfilesAmount(unsigned ObjFilesNum) {
+ void setEstimatedObjfilesAmount(unsigned ObjFilesNum) override {
ObjectContexts.reserve(ObjFilesNum);
}
/// Set verification handler which would be used to report verification
/// errors.
- void setInputVerificationHandler(inputVerificationHandler Handler) {
+ void
+ setInputVerificationHandler(InputVerificationHandlerTy Handler) override {
Options.InputVerificationHandler = Handler;
}
/// Set map for Swift interfac...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/74725
More information about the llvm-commits
mailing list