junaire updated this revision to Diff 513924. junaire added a comment. Avoid unnecessary changes
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148434/new/ https://reviews.llvm.org/D148434 Files: clang/include/clang/Interpreter/Interpreter.h clang/lib/Interpreter/IncrementalExecutor.cpp clang/lib/Interpreter/IncrementalExecutor.h clang/lib/Interpreter/Interpreter.cpp clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp clang/unittests/Interpreter/InterpreterTest.cpp
Index: clang/unittests/Interpreter/InterpreterTest.cpp =================================================================== --- clang/unittests/Interpreter/InterpreterTest.cpp +++ clang/unittests/Interpreter/InterpreterTest.cpp @@ -225,7 +225,7 @@ std::string MangledName = MangleName(FD); auto Addr = cantFail(Interp->getSymbolAddress(MangledName)); - EXPECT_NE(0U, Addr); + EXPECT_NE(0U, Addr.getValue()); GlobalDecl GD(FD); EXPECT_EQ(Addr, cantFail(Interp->getSymbolAddress(GD))); } @@ -309,7 +309,8 @@ std::string MangledName = MangleName(TmpltSpec); typedef int (*TemplateSpecFn)(void *); - auto fn = (TemplateSpecFn)cantFail(Interp->getSymbolAddress(MangledName)); + auto fn = + cantFail(Interp->getSymbolAddress(MangledName)).toPtr<TemplateSpecFn>(); EXPECT_EQ(42, fn(NewA)); free(NewA); } Index: clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp =================================================================== --- clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp +++ clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp @@ -25,7 +25,6 @@ #include "llvm/ExecutionEngine/Orc/LLJIT.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/TargetSelect.h" -#include "llvm-c/Error.h" #include "gmock/gmock.h" #include "gtest/gtest.h" @@ -116,7 +115,8 @@ llvm::cantFail(Interp->ParseAndExecute(ExceptionCode)); testing::internal::CaptureStdout(); auto ThrowException = - (int (*)())llvm::cantFail(Interp->getSymbolAddress("throw_exception")); + llvm::cantFail(Interp->getSymbolAddress("throw_exception")) + .toPtr<int (*)()>(); EXPECT_ANY_THROW(ThrowException()); std::string CapturedStdOut = testing::internal::GetCapturedStdout(); EXPECT_EQ(CapturedStdOut, "Caught: 'To be caught in JIT'\n"); Index: clang/lib/Interpreter/Interpreter.cpp =================================================================== --- clang/lib/Interpreter/Interpreter.cpp +++ clang/lib/Interpreter/Interpreter.cpp @@ -246,7 +246,7 @@ return llvm::Error::success(); } -llvm::Expected<llvm::JITTargetAddress> +llvm::Expected<llvm::orc::ExecutorAddr> Interpreter::getSymbolAddress(GlobalDecl GD) const { if (!IncrExecutor) return llvm::make_error<llvm::StringError>("Operation failed. " @@ -256,7 +256,7 @@ return getSymbolAddress(MangledName); } -llvm::Expected<llvm::JITTargetAddress> +llvm::Expected<llvm::orc::ExecutorAddr> Interpreter::getSymbolAddress(llvm::StringRef IRName) const { if (!IncrExecutor) return llvm::make_error<llvm::StringError>("Operation failed. " @@ -266,7 +266,7 @@ return IncrExecutor->getSymbolAddress(IRName, IncrementalExecutor::IRName); } -llvm::Expected<llvm::JITTargetAddress> +llvm::Expected<llvm::orc::ExecutorAddr> Interpreter::getSymbolAddressFromLinkerName(llvm::StringRef Name) const { if (!IncrExecutor) return llvm::make_error<llvm::StringError>("Operation failed. " Index: clang/lib/Interpreter/IncrementalExecutor.h =================================================================== --- clang/lib/Interpreter/IncrementalExecutor.h +++ clang/lib/Interpreter/IncrementalExecutor.h @@ -16,6 +16,7 @@ #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/StringRef.h" #include "llvm/ExecutionEngine/Orc/ExecutionUtils.h" +#include "llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h" #include <memory> @@ -51,7 +52,7 @@ llvm::Error removeModule(PartialTranslationUnit &PTU); llvm::Error runCtors() const; llvm::Error cleanUp(); - llvm::Expected<llvm::JITTargetAddress> + llvm::Expected<llvm::orc::ExecutorAddr> getSymbolAddress(llvm::StringRef Name, SymbolNameKind NameKind) const; llvm::orc::LLJIT &GetExecutionEngine() { return *Jit; } Index: clang/lib/Interpreter/IncrementalExecutor.cpp =================================================================== --- clang/lib/Interpreter/IncrementalExecutor.cpp +++ clang/lib/Interpreter/IncrementalExecutor.cpp @@ -77,7 +77,7 @@ return Jit->initialize(Jit->getMainJITDylib()); } -llvm::Expected<llvm::JITTargetAddress> +llvm::Expected<llvm::orc::ExecutorAddr> IncrementalExecutor::getSymbolAddress(llvm::StringRef Name, SymbolNameKind NameKind) const { auto Sym = (NameKind == LinkerName) ? Jit->lookupLinkerMangled(Name) @@ -85,7 +85,7 @@ if (!Sym) return Sym.takeError(); - return Sym->getValue(); + return llvm::orc::ExecutorAddr(Sym->getValue()); } } // end namespace clang Index: clang/include/clang/Interpreter/Interpreter.h =================================================================== --- clang/include/clang/Interpreter/Interpreter.h +++ clang/include/clang/Interpreter/Interpreter.h @@ -19,6 +19,7 @@ #include "clang/AST/GlobalDecl.h" #include "llvm/ExecutionEngine/JITSymbol.h" +#include "llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h" #include "llvm/Support/Error.h" #include <memory> @@ -78,18 +79,18 @@ /// Link a dynamic library llvm::Error LoadDynamicLibrary(const char *name); - /// \returns the \c JITTargetAddress of a \c GlobalDecl. This interface uses + /// \returns the \c ExecutorAddr of a \c GlobalDecl. This interface uses /// the CodeGenModule's internal mangling cache to avoid recomputing the /// mangled name. - llvm::Expected<llvm::JITTargetAddress> getSymbolAddress(GlobalDecl GD) const; + llvm::Expected<llvm::orc::ExecutorAddr> getSymbolAddress(GlobalDecl GD) const; - /// \returns the \c JITTargetAddress of a given name as written in the IR. - llvm::Expected<llvm::JITTargetAddress> + /// \returns the \c ExecutorAddr of a given name as written in the IR. + llvm::Expected<llvm::orc::ExecutorAddr> getSymbolAddress(llvm::StringRef IRName) const; - /// \returns the \c JITTargetAddress of a given name as written in the object + /// \returns the \c ExecutorAddr of a given name as written in the object /// file. - llvm::Expected<llvm::JITTargetAddress> + llvm::Expected<llvm::orc::ExecutorAddr> getSymbolAddressFromLinkerName(llvm::StringRef LinkerName) const; }; } // namespace clang
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits