From 785805863cbee537ba1e963ff177265171801aeb Mon Sep 17 00:00:00 2001 From: Richard-Qin-X Date: Wed, 12 Aug 2026 01:16:51 +0800 Subject: [CodeGen] Test cloning unnamed functions --- backend/unittests/CodeGen/MachineFunctionClonerTest.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/backend/unittests/CodeGen/MachineFunctionClonerTest.cpp b/backend/unittests/CodeGen/MachineFunctionClonerTest.cpp index 9d8ffd2..e923108 100644 --- a/backend/unittests/CodeGen/MachineFunctionClonerTest.cpp +++ b/backend/unittests/CodeGen/MachineFunctionClonerTest.cpp @@ -800,11 +800,11 @@ void testCloneFailures(TestContext &Context) { rcc::MachineFunctionCloneOptions{ rcc::MachineFunctionStableID::fromValue(0), std::nullopt}), "clone must reject an invalid destination StableID"); - Context.expect( - !rcc::cloneMachineFunction(*Source, *Target, - rcc::MachineFunctionCloneOptions{ - rcc::MachineFunctionStableID::fromValue(3), std::string()}), - "clone must reject an explicitly empty destination name"); + auto EmptyName = rcc::cloneMachineFunction( + *Source, *Target, + rcc::MachineFunctionCloneOptions{rcc::MachineFunctionStableID::fromValue(3), std::string()}); + Context.expect(EmptyName && EmptyName->ClonedFunction->name().empty(), + "clone must preserve an explicitly empty destination name"); auto Invalid = createFunction(Context, "invalid_source", 4); rcc::MachineBasicBlock *Block = Invalid ? createBlock(Context, *Invalid) : nullptr; -- cgit v1.2.3