From: Matthias Braun Date: Thu, 15 Jun 2017 22:31:08 +0000 (+0000) Subject: UnitTests: Replace some if(x)report_fatal_error() with EXPECT_TRUE(!x) X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9b534195076a85b90f9e88531385758cd074779b;p=llvm UnitTests: Replace some if(x)report_fatal_error() with EXPECT_TRUE(!x) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305519 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/unittests/MI/LiveIntervalTest.cpp b/unittests/MI/LiveIntervalTest.cpp index 7118a43e6d8..43dfa4a7978 100644 --- a/unittests/MI/LiveIntervalTest.cpp +++ b/unittests/MI/LiveIntervalTest.cpp @@ -151,8 +151,7 @@ body: | std::unique_ptr MIR; std::unique_ptr M = parseMIR(Context, PM, MIR, *TM, MIRString, "func"); - if (!M) - report_fatal_error("Could not parse MIR code\n"); + EXPECT_TRUE(M); PM.add(new TestPass(T)); diff --git a/unittests/Target/AArch64/InstSizes.cpp b/unittests/Target/AArch64/InstSizes.cpp index c1fe7f22dc5..32b91da0910 100644 --- a/unittests/Target/AArch64/InstSizes.cpp +++ b/unittests/Target/AArch64/InstSizes.cpp @@ -21,8 +21,7 @@ std::unique_ptr createTargetMachine() { std::string Error; const Target *TheTarget = TargetRegistry::lookupTarget(TT, Error); - if (!TheTarget) - report_fatal_error("Target not registered"); + EXPECT_TRUE(TheTarget); return std::unique_ptr( TheTarget->createTargetMachine(TT, CPU, FS, TargetOptions(), None, @@ -59,24 +58,20 @@ void runChecks( std::unique_ptr MBuffer = MemoryBuffer::getMemBuffer(MIRString); std::unique_ptr MParser = createMIRParser(std::move(MBuffer), Context); - if (!MParser) - report_fatal_error("Couldn't create MIR parser"); + EXPECT_TRUE(MParser); std::unique_ptr M = MParser->parseIRModule(); - if (!M) - report_fatal_error("Couldn't parse module"); + EXPECT_TRUE(M); M->setTargetTriple(TM->getTargetTriple().getTriple()); M->setDataLayout(TM->createDataLayout()); MachineModuleInfo MMI(TM); bool Res = MParser->parseMachineFunctions(*M, MMI); - if (Res) - report_fatal_error("Couldn't parse MIR functions"); + EXPECT_FALSE(Res); auto F = M->getFunction("sizes"); - if (!F) - report_fatal_error("Couldn't find intended function"); + EXPECT_TRUE(F); auto &MF = MMI.getOrCreateMachineFunction(*F); Checks(*II, MF);