aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Interpreter/Interpreter.cpp
diff options
context:
space:
mode:
authorSunho Kim <ksunhokim123@gmail.com>2022-06-26 19:02:19 +0900
committerSunho Kim <ksunhokim123@gmail.com>2022-06-26 19:02:19 +0900
commit9de8b05bfe0de2915d2443d06159396c5f9d389f (patch)
tree97fba64aedd6ac38c737ea4a904c3e88c522535a /clang/lib/Interpreter/Interpreter.cpp
parentec1922313101f94ffa0f3fe8c721220b83ebcb32 (diff)
downloadllvm-9de8b05bfe0de2915d2443d06159396c5f9d389f.zip
llvm-9de8b05bfe0de2915d2443d06159396c5f9d389f.tar.gz
llvm-9de8b05bfe0de2915d2443d06159396c5f9d389f.tar.bz2
[clang-repl] Support destructors of global objects.
Supports destructors of global objects by properly calling jitdylib deinitialize which calls the global dtors of ir modules. This supersedes https://reviews.llvm.org/D127945. There was an issue when calling deinitialize on windows but it got fixed by https://reviews.llvm.org/D128037. Reviewed By: v.g.vassilev Differential Revision: https://reviews.llvm.org/D128589
Diffstat (limited to 'clang/lib/Interpreter/Interpreter.cpp')
-rw-r--r--clang/lib/Interpreter/Interpreter.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/Interpreter/Interpreter.cpp b/clang/lib/Interpreter/Interpreter.cpp
index 564b24e..c3bbfcf 100644
--- a/clang/lib/Interpreter/Interpreter.cpp
+++ b/clang/lib/Interpreter/Interpreter.cpp
@@ -183,7 +183,14 @@ Interpreter::Interpreter(std::unique_ptr<CompilerInstance> CI,
*TSCtx->getContext(), Err);
}
-Interpreter::~Interpreter() {}
+Interpreter::~Interpreter() {
+ if (IncrExecutor) {
+ if (llvm::Error Err = IncrExecutor->cleanUp())
+ llvm::report_fatal_error(
+ llvm::Twine("Failed to clean up IncrementalExecutor: ") +
+ toString(std::move(Err)));
+ }
+}
llvm::Expected<std::unique_ptr<Interpreter>>
Interpreter::create(std::unique_ptr<CompilerInstance> CI) {