llvm/lld/MachO/UnwindInfoSection.h
Jez Ng 2a6669060f [lld-macho][nfc] De-templatize UnwindInfoSection
Follow-on to {D123276}. Now that we work with an internal
representation of compact unwind entries, we no longer need to template
our UnwindInfoSectionImpl code based on the pointer size of the target
architecture.

I've still kept the split between `UnwindInfoSectionImpl` and
`UnwindInfoSection`. I'd introduced that split in order to do type
erasure, but I think it's still useful to have in order to keep
`UnwindInfoSection`'s definition in the header file clean.

Reviewed By: #lld-macho, oontvoo

Differential Revision: https://reviews.llvm.org/D123277
2022-04-13 16:19:22 -04:00

44 lines
1.2 KiB
C++

//===- UnwindInfoSection.h ------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLD_MACHO_UNWIND_INFO_H
#define LLD_MACHO_UNWIND_INFO_H
#include "ConcatOutputSection.h"
#include "SyntheticSections.h"
#include "llvm/ADT/MapVector.h"
#include "mach-o/compact_unwind_encoding.h"
namespace lld {
namespace macho {
class UnwindInfoSection : public SyntheticSection {
public:
// If all functions are free of unwind info, we can omit the unwind info
// section entirely.
bool isNeeded() const override { return !allEntriesAreOmitted; }
void addSymbol(const Defined *);
virtual void prepareRelocations() = 0;
protected:
UnwindInfoSection();
llvm::MapVector<std::pair<const InputSection *, uint64_t /*Defined::value*/>,
const Defined *>
symbols;
bool allEntriesAreOmitted = true;
};
UnwindInfoSection *makeUnwindInfoSection();
} // namespace macho
} // namespace lld
#endif