aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Interpreter/Interpreter.cpp
diff options
context:
space:
mode:
authorSunho Kim <ksunhokim123@naver.com>2022-07-29 02:37:16 +0900
committerSunho Kim <ksunhokim123@naver.com>2022-07-29 02:38:40 +0900
commitc619d4f840dcba54751ff8c5aaafce0f173a4ad5 (patch)
treed0156c372524240f6713116c91e00e141119f644 /clang/lib/Interpreter/Interpreter.cpp
parentaeb1c98f4c1095f0ad2b59f3cc13c0b5b74f807a (diff)
downloadllvm-c619d4f840dcba54751ff8c5aaafce0f173a4ad5.zip
llvm-c619d4f840dcba54751ff8c5aaafce0f173a4ad5.tar.gz
llvm-c619d4f840dcba54751ff8c5aaafce0f173a4ad5.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 0191ad7..bdba4ae 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) {