[llvm] e842765 - [ORC] Make a narrowing conversion explicit.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 13 01:11:59 PST 2020
Author: Lang Hames
Date: 2020-11-13T20:11:19+11:00
New Revision: e8427656663d1ad48f706864373201b5093249fb
URL: https://github.com/llvm/llvm-project/commit/e8427656663d1ad48f706864373201b5093249fb
DIFF: https://github.com/llvm/llvm-project/commit/e8427656663d1ad48f706864373201b5093249fb.diff
LOG: [ORC] Make a narrowing conversion explicit.
Added:
Modified:
llvm/include/llvm/ExecutionEngine/Orc/OrcRPCTargetProcessControl.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/OrcRPCTargetProcessControl.h b/llvm/include/llvm/ExecutionEngine/Orc/OrcRPCTargetProcessControl.h
index f63dcd0f3471..b498661021ae 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/OrcRPCTargetProcessControl.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/OrcRPCTargetProcessControl.h
@@ -59,7 +59,7 @@ class OrcRPCTPCJITLinkMemoryManager : public jitlink::JITLinkMemoryManager {
auto I = HostAllocs.find(Seg);
assert(I != HostAllocs.end() && "No host allocation for segment");
auto &HA = I->second;
- return {HA.Mem.get(), HA.Size};
+ return {HA.Mem.get(), static_cast<size_t>(HA.Size)};
}
JITTargetAddress getTargetMemory(ProtectionFlags Seg) override {
@@ -153,6 +153,9 @@ class OrcRPCTPCJITLinkMemoryManager : public jitlink::JITLinkMemoryManager {
HostAllocMap HostAllocs;
for (auto &KV : Request) {
+ assert(KV.second.getContentSize() <= std::numeric_limits<size_t>::max() &&
+ "Content size is out-of-range for host");
+
RMR.push_back({orcrpctpc::toWireProtectionFlags(
static_cast<sys::Memory::ProtectionFlags>(KV.first)),
KV.second.getContentSize() + KV.second.getZeroFillSize(),
More information about the llvm-commits
mailing list