[PATCH] D114044: [lld-macho][nfc] Sanity check on template type
Vy Nguyen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 16 17:05:01 PST 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG34d15eaced9d: [lld-macho][nfc] Sanity check on template type (authored by oontvoo).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D114044/new/
https://reviews.llvm.org/D114044
Files:
lld/MachO/InputFiles.cpp
Index: lld/MachO/InputFiles.cpp
===================================================================
--- lld/MachO/InputFiles.cpp
+++ lld/MachO/InputFiles.cpp
@@ -70,6 +70,8 @@
#include "llvm/TextAPI/Architecture.h"
#include "llvm/TextAPI/InterfaceFile.h"
+#include <type_traits>
+
using namespace llvm;
using namespace llvm::MachO;
using namespace llvm::support::endian;
@@ -358,6 +360,9 @@
template <class T>
static InputSection *findContainingSubsection(Subsections &subsections,
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(
subsections, *offset,
[](uint64_t value, Subsection subsec) { return value < subsec.offset; }));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114044.387792.patch
Type: text/x-patch
Size: 860 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211117/ade674b3/attachment.bin>
More information about the llvm-commits
mailing list