This is an archive of the discontinued LLVM Phabricator instance.

[mips] Remove the last usage of parseRegister from MipsAsmParser.
ClosedPublic

Authored by matheusalmeida on May 8 2014, 8:56 AM.

Details

Summary

Added negative test case so that we can be sure we handle erroneous situations
while parsing the .cpsetup directive.

Diff Detail

Event Timeline

matheusalmeida retitled this revision from to [mips] Remove the last usage of parseRegister from MipsAsmParser..
matheusalmeida updated this object.
matheusalmeida edited the test plan for this revision. (Show Details)
dsanders accepted this revision.May 14 2014, 8:04 AM
dsanders edited edge metadata.

LGTM with one nit about the placement of TmpReg.clear()

You can also use unique_ptr to avoid the manual delete statements if you want to.

lib/Target/Mips/AsmParser/MipsAsmParser.cpp
2366

It's probably best to use std::unique_ptr so you don't have to manually delete the object.

2379–2380

Move this up to the 'delete FuncRegOpnd'

This revision is now accepted and ready to land.May 14 2014, 8:04 AM
matheusalmeida edited edge metadata.

Use of std::unique_ptr to avoid having to manually delete the MipsOperands created while
parsing the directive.

Trying to fix the previous mistake when I forgot to specify HEAD^...

I know you LGTM'd this already but I made the change you suggested (use of std::unique_ptr). Do you want to skim read this patch again just to make sure I implemented exactly what you suggested ?

Matheus

The unique_ptr would be better as part of the 'SmallVector<MCParsedAsmOperand *, 1> TmpReg'. At the moment, there are two pointers to TmpReg[0] so it's not really unique.

Fix use of std::unique_ptr.