llvm-project/orc-rt/lib/executor/ControllerInterface.cpp
Lang Hames 69b8327457
[orc-rt] Add ControllerInterface symbol table. (#186947)
ControllerInterface holds the set of named symbols that the ORC runtime
exposes to the controller for bootstrapping the ExecutionSession.
Insertion is checked: duplicate symbols are rejected with an error.

Session is updated to own a ControllerInterface instance, pre-populated
with an orc_rt_SessionInstance entry pointing to the Session object.
2026-03-17 15:36:20 +11:00

35 lines
1.1 KiB
C++

//===- ControllerInterface.cpp --------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// Contains the implementation of APIs in the orc-rt/ControllerInterface.h
// header.
//
//===----------------------------------------------------------------------===//
#include "orc-rt/ControllerInterface.h"
#include "orc-rt/iterator_range.h"
#include <algorithm>
namespace orc_rt {
Error ControllerInterface::makeDuplicatesError(
std::vector<std::string_view> Dups) {
std::sort(Dups.begin(), Dups.end());
std::string ErrMsg = "Could not add duplicate symbols: [ ";
ErrMsg += Dups.front();
for (auto &Dup : iterator_range(std::next(Dups.begin()), Dups.end())) {
ErrMsg += ", ";
ErrMsg += Dup;
}
ErrMsg += " ]";
return make_error<StringError>(std::move(ErrMsg));
}
} // namespace orc_rt