…ition. Renames the SimpleSymbolTable addSymbolsUnique method to addUnique. The new class name (from c727cd9a4b2) already implies that we're adding symbols. This commit also relaxes the error condition for addUnique: Rather than rejecting any duplicate symbols, it only rejects symbols that were previously added with a different address. This makes it safe to add the same symbol(s) multiple time, as long as all definitions point to the same address. The intent of this is to allow ORC runtime components to unconditionally add their interfaces to symbols, even if that interface might have been added previously.
36 lines
1.2 KiB
C++
36 lines
1.2 KiB
C++
//===- SimpleSymbolTable.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/SimpleSymbolTable.h
|
|
// header.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "orc-rt/SimpleSymbolTable.h"
|
|
#include "orc-rt/iterator_range.h"
|
|
|
|
#include <algorithm>
|
|
|
|
namespace orc_rt {
|
|
|
|
Error SimpleSymbolTable::makeIncompatibleDefsError(
|
|
std::vector<std::string_view> IncompatibleDefs) {
|
|
std::sort(IncompatibleDefs.begin(), IncompatibleDefs.end());
|
|
std::string ErrMsg = "Incompatible definitions for symbols: [ ";
|
|
ErrMsg += IncompatibleDefs.front();
|
|
for (auto &Def : iterator_range(std::next(IncompatibleDefs.begin()),
|
|
IncompatibleDefs.end())) {
|
|
ErrMsg += ", ";
|
|
ErrMsg += Def;
|
|
}
|
|
ErrMsg += " ]";
|
|
return make_error<StringError>(std::move(ErrMsg));
|
|
}
|
|
|
|
} // namespace orc_rt
|