[llvm] r305519 - UnitTests: Replace some if(x)report_fatal_error() with EXPECT_TRUE(!x)
Matthias Braun via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 15 15:31:08 PDT 2017
Author: matze
Date: Thu Jun 15 17:31:08 2017
New Revision: 305519
URL: http://llvm.org/viewvc/llvm-project?rev=305519&view=rev
Log:
UnitTests: Replace some if(x)report_fatal_error() with EXPECT_TRUE(!x)
Modified:
llvm/trunk/unittests/MI/LiveIntervalTest.cpp
llvm/trunk/unittests/Target/AArch64/InstSizes.cpp
Modified: llvm/trunk/unittests/MI/LiveIntervalTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/MI/LiveIntervalTest.cpp?rev=305519&r1=305518&r2=305519&view=diff
==============================================================================
--- llvm/trunk/unittests/MI/LiveIntervalTest.cpp (original)
+++ llvm/trunk/unittests/MI/LiveIntervalTest.cpp Thu Jun 15 17:31:08 2017
@@ -151,8 +151,7 @@ body: |
std::unique_ptr<MIRParser> MIR;
std::unique_ptr<Module> 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));
Modified: llvm/trunk/unittests/Target/AArch64/InstSizes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Target/AArch64/InstSizes.cpp?rev=305519&r1=305518&r2=305519&view=diff
==============================================================================
--- llvm/trunk/unittests/Target/AArch64/InstSizes.cpp (original)
+++ llvm/trunk/unittests/Target/AArch64/InstSizes.cpp Thu Jun 15 17:31:08 2017
@@ -21,8 +21,7 @@ std::unique_ptr<TargetMachine> createTar
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<TargetMachine>(
TheTarget->createTargetMachine(TT, CPU, FS, TargetOptions(), None,
@@ -59,24 +58,20 @@ void runChecks(
std::unique_ptr<MemoryBuffer> MBuffer = MemoryBuffer::getMemBuffer(MIRString);
std::unique_ptr<MIRParser> MParser =
createMIRParser(std::move(MBuffer), Context);
- if (!MParser)
- report_fatal_error("Couldn't create MIR parser");
+ EXPECT_TRUE(MParser);
std::unique_ptr<Module> 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);
More information about the llvm-commits
mailing list