diff --git a/unittests/CodeGen/MachineInstrTest.cpp b/unittests/CodeGen/MachineInstrTest.cpp index 9e455548e15..90c8a4049e2 100644 --- a/unittests/CodeGen/MachineInstrTest.cpp +++ b/unittests/CodeGen/MachineInstrTest.cpp @@ -139,11 +139,9 @@ private: BogusSubtarget ST; }; -static MCAsmInfo AsmInfo = MCAsmInfo(); - -std::unique_ptr createMCContext() { +std::unique_ptr createMCContext(MCAsmInfo *AsmInfo) { return std::make_unique( - &AsmInfo, nullptr, nullptr, nullptr, nullptr, false); + AsmInfo, nullptr, nullptr, nullptr, nullptr, false); } std::unique_ptr createTargetMachine() { @@ -378,7 +376,8 @@ TEST(MachineInstrExtraInfo, AddExtraInfo) { 0, nullptr, nullptr, nullptr, 0, nullptr}; auto MI = MF->CreateMachineInstr(MCID, DebugLoc()); - auto MC = createMCContext(); + auto MAI = MCAsmInfo(); + auto MC = createMCContext(&MAI); auto MMO = MF->getMachineMemOperand(MachinePointerInfo(), MachineMemOperand::MOLoad, 8, 8); SmallVector MMOs; @@ -424,7 +423,8 @@ TEST(MachineInstrExtraInfo, ChangeExtraInfo) { 0, nullptr, nullptr, nullptr, 0, nullptr}; auto MI = MF->CreateMachineInstr(MCID, DebugLoc()); - auto MC = createMCContext(); + auto MAI = MCAsmInfo(); + auto MC = createMCContext(&MAI); auto MMO = MF->getMachineMemOperand(MachinePointerInfo(), MachineMemOperand::MOLoad, 8, 8); SmallVector MMOs; @@ -460,7 +460,8 @@ TEST(MachineInstrExtraInfo, RemoveExtraInfo) { 0, nullptr, nullptr, nullptr, 0, nullptr}; auto MI = MF->CreateMachineInstr(MCID, DebugLoc()); - auto MC = createMCContext(); + auto MAI = MCAsmInfo(); + auto MC = createMCContext(&MAI); auto MMO = MF->getMachineMemOperand(MachinePointerInfo(), MachineMemOperand::MOLoad, 8, 8); SmallVector MMOs;