mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-11 13:44:28 +00:00
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
This commit is contained in:
parent
7e5d31edd7
commit
9b53419507
@ -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));
|
||||
|
||||
|
@ -21,8 +21,7 @@ std::unique_ptr<TargetMachine> 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<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);
|
||||
|
Loading…
Reference in New Issue
Block a user