From: Lang Hames Date: Wed, 30 Aug 2017 00:47:42 +0000 (+0000) Subject: [Orc] Fix member variable ordering issue in OrcMCJITReplacement. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=eb735545f15600c859e73d7150d218a320bc5e85;p=llvm [Orc] Fix member variable ordering issue in OrcMCJITReplacement. https://reviews.llvm.org/D36888 From that review description: When an OrcMCJITReplacement object gets destructed, LazyEmitLayer may still contain a shared_ptr of a module, which requires ShouldDelete in the deleter. But ShouldDelete gets destructed before LazyEmitLayer due to the order of declaration in OrcMCJITReplacement, which leads to a crash, when the destructor of LazyEmitLayer is executed. Changing the order of declaration fixes this. Patch by Moritz Kroll. Thanks Moritz! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312086 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h b/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h index a24f92b82fb..743d5e2307c 100644 --- a/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h +++ b/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h @@ -381,6 +381,9 @@ private: std::shared_ptr ClientResolver; Mangler Mang; + std::map ShouldDelete; + std::vector> LocalModules; + NotifyObjectLoadedT NotifyObjectLoaded; NotifyFinalizedT NotifyFinalized; @@ -402,8 +405,6 @@ private: std::map UnfinalizedSections; - std::map ShouldDelete; - std::vector> LocalModules; std::vector> Archives; };