Skip to content

Commit

Permalink
Revert "[clang-repl] Adapt to the recent dylib-related changes in ORC."
Browse files Browse the repository at this point in the history
This reverts commit 196d856 while investigating
bot failure: https://lab.llvm.org/buildbot/#/builders/216/builds/26444
  • Loading branch information
vgvassilev committed Aug 29, 2023
1 parent 6276927 commit e6cd950
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 22 deletions.
19 changes: 6 additions & 13 deletions clang/lib/Interpreter/IncrementalExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,12 @@ llvm::Error IncrementalExecutor::runCtors() const {
llvm::Expected<llvm::orc::ExecutorAddr>
IncrementalExecutor::getSymbolAddress(llvm::StringRef Name,
SymbolNameKind NameKind) const {
using namespace llvm::orc;
auto SO = makeJITDylibSearchOrder({&Jit->getMainJITDylib(),
Jit->getPlatformJITDylib().get(),
Jit->getProcessSymbolsJITDylib().get()});

ExecutionSession &ES = Jit->getExecutionSession();

auto SymOrErr =
ES.lookup(SO, (NameKind == LinkerName) ? ES.intern(Name)
: Jit->mangleAndIntern(Name));
if (auto Err = SymOrErr.takeError())
return std::move(Err);
return SymOrErr->getAddress();
auto Sym = (NameKind == LinkerName) ? Jit->lookupLinkerMangled(Name)
: Jit->lookup(Name);

if (!Sym)
return Sym.takeError();
return Sym;
}

} // end namespace clang
12 changes: 3 additions & 9 deletions clang/unittests/Interpreter/InterpreterTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,16 +234,10 @@ TEST(IncrementalProcessing, FindMangledNameSymbol) {
}

std::string MangledName = MangleName(FD);
auto Addr = Interp->getSymbolAddress(MangledName);
EXPECT_FALSE(!Addr);
EXPECT_NE(0U, Addr->getValue());
auto Addr = cantFail(Interp->getSymbolAddress(MangledName));
EXPECT_NE(0U, Addr.getValue());
GlobalDecl GD(FD);
EXPECT_EQ(*Addr, cantFail(Interp->getSymbolAddress(GD)));
cantFail(
Interp->ParseAndExecute("extern \"C\" int printf(const char*,...);"));
Addr = Interp->getSymbolAddress("printf");
EXPECT_FALSE(!Addr);
EXPECT_EQ((unsigned long long)&printf, Addr->getValue());
EXPECT_EQ(Addr, cantFail(Interp->getSymbolAddress(GD)));
}

static void *AllocateObject(TypeDecl *TD, Interpreter &Interp) {
Expand Down

0 comments on commit e6cd950

Please sign in to comment.