Revert "[ORC] Add optional context string to duplicate symbol definition errors."
Broke buildbots: https://lab.llvm.org/buildbot/#/builders/10/builds/5025
This reverts commit b0979b8c65.
This commit is contained in:
@@ -48,16 +48,12 @@ class DuplicateDefinition : public ErrorInfo<DuplicateDefinition> {
|
||||
public:
|
||||
static char ID;
|
||||
|
||||
DuplicateDefinition(std::string SymbolName,
|
||||
std::optional<std::string> Context = {});
|
||||
DuplicateDefinition(std::string SymbolName);
|
||||
std::error_code convertToErrorCode() const override;
|
||||
void log(raw_ostream &OS) const override;
|
||||
const std::string &getSymbolName() const;
|
||||
const std::optional<std::string> &getContext() const;
|
||||
|
||||
private:
|
||||
std::string SymbolName;
|
||||
std::optional<std::string> Context;
|
||||
};
|
||||
|
||||
class JITSymbolNotFound : public ErrorInfo<JITSymbolNotFound> {
|
||||
|
||||
@@ -731,8 +731,7 @@ JITDylib::defineMaterializing(MaterializationResponsibility &FromMR,
|
||||
Symbols.erase(Symbols.find_as(S));
|
||||
|
||||
// FIXME: Return all duplicates.
|
||||
return make_error<DuplicateDefinition>(
|
||||
std::string(*Name), "defineMaterializing operation");
|
||||
return make_error<DuplicateDefinition>(std::string(*Name));
|
||||
}
|
||||
|
||||
// Otherwise just make a note to discard this symbol after the loop.
|
||||
@@ -1425,8 +1424,7 @@ Error JITDylib::defineImpl(MaterializationUnit &MU) {
|
||||
if (!Duplicates.empty()) {
|
||||
LLVM_DEBUG(
|
||||
{ dbgs() << " Error: Duplicate symbols " << Duplicates << "\n"; });
|
||||
return make_error<DuplicateDefinition>(std::string(**Duplicates.begin()),
|
||||
MU.getName().str());
|
||||
return make_error<DuplicateDefinition>(std::string(**Duplicates.begin()));
|
||||
}
|
||||
|
||||
// Discard any overridden defs in this MU.
|
||||
|
||||
@@ -86,28 +86,21 @@ std::error_code orcError(OrcErrorCode ErrCode) {
|
||||
return std::error_code(static_cast<UT>(ErrCode), getOrcErrCat());
|
||||
}
|
||||
|
||||
DuplicateDefinition::DuplicateDefinition(std::string SymbolName,
|
||||
std::optional<std::string> Context)
|
||||
: SymbolName(std::move(SymbolName)), Context(std::move(Context)) {}
|
||||
DuplicateDefinition::DuplicateDefinition(std::string SymbolName)
|
||||
: SymbolName(std::move(SymbolName)) {}
|
||||
|
||||
std::error_code DuplicateDefinition::convertToErrorCode() const {
|
||||
return orcError(OrcErrorCode::DuplicateDefinition);
|
||||
}
|
||||
|
||||
void DuplicateDefinition::log(raw_ostream &OS) const {
|
||||
if (Context)
|
||||
OS << "In " << *Context << ", ";
|
||||
OS << "duplicate definition of symbol '" << SymbolName << "'";
|
||||
OS << "Duplicate definition of symbol '" << SymbolName << "'";
|
||||
}
|
||||
|
||||
const std::string &DuplicateDefinition::getSymbolName() const {
|
||||
return SymbolName;
|
||||
}
|
||||
|
||||
const std::optional<std::string> &DuplicateDefinition::getContext() const {
|
||||
return Context;
|
||||
}
|
||||
|
||||
JITSymbolNotFound::JITSymbolNotFound(std::string SymbolName)
|
||||
: SymbolName(std::move(SymbolName)) {}
|
||||
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
define i32 @main(i32 %argc, i8** %argv) {
|
||||
entry:
|
||||
ret i32 42
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
# RUN: rm -rf %t && mkdir %t
|
||||
# RUN: llc -filetype=obj -o %t/main-ret-0.o %S/Inputs/main-ret-0.ll
|
||||
# RUN: llc -filetype=obj -o %T/main-ret-42.o %S/Inputs/main-ret-42.ll
|
||||
# RUN: not llvm-jitlink -noexec %T/main-ret-0.o %T/main-ret-42.o 2>&1 | FileCheck %s
|
||||
#
|
||||
# Trigger a duplicate definition error by trying to link two main functions,
|
||||
# check that the error message includes the file that introduced the duplicate.
|
||||
#
|
||||
# CHECK: In {{.*}}main-ret-42.o, duplicate definition of {{.*}}main
|
||||
Reference in New Issue
Block a user