MIR Parser: make the machine instruction parsing interface more consistent. NFC.

This commit refactors the interface for machine instruction parser. It adopts
the pattern of returning a bool and passing in the result in the first argument
that is used by the other parsing methods for the the method 'parse' and the
function 'parseMachineInstr'.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241085 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Alex Lorenz
2015-06-30 17:47:50 +00:00
parent 8f1e30d67c
commit 939f023bf9
3 changed files with 26 additions and 30 deletions

View File

@@ -265,13 +265,13 @@ bool MIRParserImpl::initializeMachineBasicBlock(
// Parse the instructions.
for (const auto &MISource : YamlMBB.Instructions) {
SMDiagnostic Error;
if (auto *MI = parseMachineInstr(SM, MF, MISource.Value, MBBSlots, IRSlots,
Error)) {
MBB.insert(MBB.end(), MI);
continue;
MachineInstr *MI = nullptr;
if (parseMachineInstr(MI, SM, MF, MISource.Value, MBBSlots, IRSlots,
Error)) {
reportDiagnostic(diagFromMIStringDiag(Error, MISource.SourceRange));
return true;
}
reportDiagnostic(diagFromMIStringDiag(Error, MISource.SourceRange));
return true;
MBB.insert(MBB.end(), MI);
}
return false;
}