[PATCH] D15346: Fix the order of destructors in LibLTOCodeGenerator
Steven Wu via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 8 19:41:01 PST 2015
This revision was automatically updated to reflect the committed changes.
Closed by commit rL255092: Fix the order of destructors in LibLTOCodeGenerator (authored by steven_wu).
Changed prior to commit:
http://reviews.llvm.org/D15346?vs=42212&id=42263#toc
Repository:
rL LLVM
http://reviews.llvm.org/D15346
Files:
llvm/trunk/include/llvm/LTO/LTOCodeGenerator.h
llvm/trunk/tools/lto/lto.cpp
Index: llvm/trunk/tools/lto/lto.cpp
===================================================================
--- llvm/trunk/tools/lto/lto.cpp
+++ llvm/trunk/tools/lto/lto.cpp
@@ -124,6 +124,10 @@
: LTOCodeGenerator(*Context), OwnedContext(std::move(Context)) {
setDiagnosticHandler(handleLibLTODiagnostic, nullptr); }
+ // Reset the module first in case MergedModule is created in OwnedContext.
+ // Module must be destructed before its context gets destructed.
+ ~LibLTOCodeGenerator() { resetMergedModule(); }
+
std::unique_ptr<MemoryBuffer> NativeObjectFile;
std::unique_ptr<LLVMContext> OwnedContext;
};
Index: llvm/trunk/include/llvm/LTO/LTOCodeGenerator.h
===================================================================
--- llvm/trunk/include/llvm/LTO/LTOCodeGenerator.h
+++ llvm/trunk/include/llvm/LTO/LTOCodeGenerator.h
@@ -148,6 +148,8 @@
LLVMContext &getContext() { return Context; }
+ void resetMergedModule() { MergedModule.reset(); }
+
private:
void initializeLTOPasses();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15346.42263.patch
Type: text/x-patch
Size: 1023 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151209/7b32ac3a/attachment.bin>
More information about the llvm-commits
mailing list