sgraenitz added a comment. Thanks for working on this! It looks like this is going to be the clang-repl equivalent for Cling's `.L` command. Do you think we can get test coverage for it?
So far, the only tests I found for `libclangInterpreter` are unit tests in https://github.com/llvm/llvm-project/tree/main/clang/unittests/Interpreter -- e.g. there is a test for the `%undo` command. I guess the `%lib` command would be a good candidate for a LIT test, because it requires a dynamic library to load from disk. The tests for `.L` in Cling may give you a hint on how this could look like: https://github.com/root-project/cling/tree/master/test/LibraryCall ================ Comment at: clang/include/clang/Interpreter/Interpreter.h:62 const CompilerInstance *getCompilerInstance() const; - const llvm::orc::LLJIT *getExecutionEngine() const; + llvm::Expected<llvm::orc::LLJIT &> GetExecutionEngine(); + ---------------- Do we really want these functions capitalized? IIRC in the clang code-base they are used to highlight core API functions. It looks like these two functions are only used as helpers inside `Interpreter` itself. ================ Comment at: clang/include/clang/Interpreter/Interpreter.h:78 + /// Link a dyanmic library + llvm::Error LoadDynamicLibrary(const char *name); ---------------- Typo `dynamic` ================ Comment at: clang/lib/Interpreter/Interpreter.cpp:223 +llvm::Error Interpreter::CreateExecutor() { + const clang::TargetInfo &TI = ---------------- Factoring out this function looks like an independent change. Is it related to the load-library command in any way? ================ Comment at: clang/tools/clang-repl/ClangRepl.cpp:126 } + if (Line->rfind(R"(%lib )", 0) == 0) { + if (auto Err = Interp->LoadDynamicLibrary(Line->data() + 5)) { ---------------- I see this is analog to existing code, but is there a good reason for using the multi-line string syntax here? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D141824/new/ https://reviews.llvm.org/D141824 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits