llvm.org GIT mirror llvm / 9b53419
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 Matthias Braun 3 years ago
2 changed file(s) with 6 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
150150 std::unique_ptr MIR;
151151 std::unique_ptr M = parseMIR(Context, PM, MIR, *TM, MIRString,
152152 "func");
153 if (!M)
154 report_fatal_error("Could not parse MIR code\n");
153 EXPECT_TRUE(M);
155154
156155 PM.add(new TestPass(T));
157156
2020
2121 std::string Error;
2222 const Target *TheTarget = TargetRegistry::lookupTarget(TT, Error);
23 if (!TheTarget)
24 report_fatal_error("Target not registered");
23 EXPECT_TRUE(TheTarget);
2524
2625 return std::unique_ptr(
2726 TheTarget->createTargetMachine(TT, CPU, FS, TargetOptions(), None,
5857 std::unique_ptr MBuffer = MemoryBuffer::getMemBuffer(MIRString);
5958 std::unique_ptr MParser =
6059 createMIRParser(std::move(MBuffer), Context);
61 if (!MParser)
62 report_fatal_error("Couldn't create MIR parser");
60 EXPECT_TRUE(MParser);
6361
6462 std::unique_ptr M = MParser->parseIRModule();
65 if (!M)
66 report_fatal_error("Couldn't parse module");
63 EXPECT_TRUE(M);
6764
6865 M->setTargetTriple(TM->getTargetTriple().getTriple());
6966 M->setDataLayout(TM->createDataLayout());
7067
7168 MachineModuleInfo MMI(TM);
7269 bool Res = MParser->parseMachineFunctions(*M, MMI);
73 if (Res)
74 report_fatal_error("Couldn't parse MIR functions");
70 EXPECT_FALSE(Res);
7571
7672 auto F = M->getFunction("sizes");
77 if (!F)
78 report_fatal_error("Couldn't find intended function");
73 EXPECT_TRUE(F);
7974 auto &MF = MMI.getOrCreateMachineFunction(*F);
8075
8176 Checks(*II, MF);