[llvm] [CodeGen] Fix `MachineModuleInfo`'s move constructor to be more safe with `MCContext` ownership. (PR #104834)

Matin Raayai via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 20 08:56:48 PDT 2024


================
@@ -124,10 +124,10 @@ class MachineModuleInfo {
   const LLVMTargetMachine &getTarget() const { return TM; }
 
   const MCContext &getContext() const {
-    return ExternalContext ? *ExternalContext : Context;
+    return ExternalContext ? *ExternalContext : *Context;
----------------
matinraayai wrote:

I agree; See my comments [below](https://github.com/llvm/llvm-project/pull/104834#issuecomment-2299180092). IMO it's better to have an external owner. It will bring MMI closer to how `llvm::Module` is managed.

https://github.com/llvm/llvm-project/pull/104834


More information about the llvm-commits mailing list