mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-05 14:34:55 +00:00
ARMAsmParser: Plug a leak.
Using an object to do the cleanup may look like overkill, but it's safer and nicer than putting deletes everywhere. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187696 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
bc2160f7c9
commit
527692a594
@ -8009,11 +8009,19 @@ bool ARMAsmParser::parseDirectiveRegSave(SMLoc L, bool IsVector) {
|
||||
if (HandlerDataLoc.isValid())
|
||||
return Error(L, ".save or .vsave must precede .handlerdata directive");
|
||||
|
||||
// RAII object to make sure parsed operands are deleted.
|
||||
struct CleanupObject {
|
||||
SmallVector<MCParsedAsmOperand *, 1> Operands;
|
||||
~CleanupObject() {
|
||||
for (unsigned I = 0, E = Operands.size(); I != E; ++I)
|
||||
delete Operands[I];
|
||||
}
|
||||
} CO;
|
||||
|
||||
// Parse the register list
|
||||
SmallVector<MCParsedAsmOperand*, 1> Operands;
|
||||
if (parseRegisterList(Operands))
|
||||
if (parseRegisterList(CO.Operands))
|
||||
return true;
|
||||
ARMOperand *Op = (ARMOperand*)Operands[0];
|
||||
ARMOperand *Op = (ARMOperand*)CO.Operands[0];
|
||||
if (!IsVector && !Op->isRegList())
|
||||
return Error(L, ".save expects GPR registers");
|
||||
if (IsVector && !Op->isDPRRegList())
|
||||
|
Loading…
x
Reference in New Issue
Block a user