From 34d15eaced9db0a9769a7cdb1899ffa534b6ed44 Mon Sep 17 00:00:00 2001 From: Vy Nguyen Date: Tue, 16 Nov 2021 19:57:24 -0500 Subject: [PATCH] [lld-macho][nfc] Sanity check on template type Differential Revision: https://reviews.llvm.org/D114044 --- lld/MachO/InputFiles.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lld/MachO/InputFiles.cpp b/lld/MachO/InputFiles.cpp index 9fb6cd3bf265..7bc432296024 100644 --- a/lld/MachO/InputFiles.cpp +++ b/lld/MachO/InputFiles.cpp @@ -70,6 +70,8 @@ #include "llvm/TextAPI/Architecture.h" #include "llvm/TextAPI/InterfaceFile.h" +#include + using namespace llvm; using namespace llvm::MachO; using namespace llvm::support::endian; @@ -358,6 +360,9 @@ void ObjFile::parseSections(ArrayRef sectionHeaders) { template static InputSection *findContainingSubsection(Subsections &subsections, T *offset) { + static_assert(std::is_same::value || + std::is_same::value, + "unexpected type for offset"); auto it = std::prev(llvm::upper_bound( subsections, *offset, [](uint64_t value, Subsection subsec) { return value < subsec.offset; }));