forked from OSchip/llvm-project
[lld-macho][nfc] Sanity check on template type
Differential Revision: https://reviews.llvm.org/D114044
This commit is contained in:
parent
209dadf269
commit
34d15eaced
|
@ -70,6 +70,8 @@
|
||||||
#include "llvm/TextAPI/Architecture.h"
|
#include "llvm/TextAPI/Architecture.h"
|
||||||
#include "llvm/TextAPI/InterfaceFile.h"
|
#include "llvm/TextAPI/InterfaceFile.h"
|
||||||
|
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
using namespace llvm::MachO;
|
using namespace llvm::MachO;
|
||||||
using namespace llvm::support::endian;
|
using namespace llvm::support::endian;
|
||||||
|
@ -358,6 +360,9 @@ void ObjFile::parseSections(ArrayRef<SectionHeader> sectionHeaders) {
|
||||||
template <class T>
|
template <class T>
|
||||||
static InputSection *findContainingSubsection(Subsections &subsections,
|
static InputSection *findContainingSubsection(Subsections &subsections,
|
||||||
T *offset) {
|
T *offset) {
|
||||||
|
static_assert(std::is_same<uint64_t, T>::value ||
|
||||||
|
std::is_same<uint32_t, T>::value,
|
||||||
|
"unexpected type for offset");
|
||||||
auto it = std::prev(llvm::upper_bound(
|
auto it = std::prev(llvm::upper_bound(
|
||||||
subsections, *offset,
|
subsections, *offset,
|
||||||
[](uint64_t value, Subsection subsec) { return value < subsec.offset; }));
|
[](uint64_t value, Subsection subsec) { return value < subsec.offset; }));
|
||||||
|
|
Loading…
Reference in New Issue