Skip to content

Commit ea15772

Browse files
committed
Replace assertion with explicit error return
1 parent a16374e commit ea15772

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

llvm/lib/ExecutionEngine/Orc/EPCDebugObjectRegistrar.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,11 @@ Expected<std::unique_ptr<EPCDebugObjectRegistrar>> createJITLoaderGDBRegistrar(
4141
assert(Result->size() == 1 && "Unexpected number of dylibs in result");
4242
assert((*Result)[0].size() == 1 &&
4343
"Unexpected number of addresses in result");
44-
assert((*Result)[0][0].has_value() &&
45-
"Expected a valid address in the lookup result");
44+
45+
if (!(*Result)[0][0].has_value())
46+
return make_error<StringError>(
47+
"Expected a valid address in the lookup result",
48+
inconvertibleErrorCode());
4649

4750
ExecutorAddr RegisterAddr = (*Result)[0][0]->getAddress();
4851
return std::make_unique<EPCDebugObjectRegistrar>(ES, RegisterAddr);

0 commit comments

Comments
 (0)