[llvm-commits] [llvm] r121450 - /llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
Kevin Enderby
enderby at apple.com
Thu Dec 9 17:41:56 PST 2010
Author: enderby
Date: Thu Dec 9 19:41:56 2010
New Revision: 121450
URL: http://llvm.org/viewvc/llvm-project?rev=121450&view=rev
Log:
Fix the leak from r121401 of the Operands erased in the list but not deleted.
Modified:
llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
Modified: llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp?rev=121450&r1=121449&r2=121450&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Thu Dec 9 19:41:56 2010
@@ -962,8 +962,11 @@
MatchResult2 = MatchInstructionImpl(Operands, Inst, ErrorInfo);
if (MatchResult2 == Match_Success)
MatchResult = Match_Success;
- else
+ else {
+ ARMOperand *CCOut = ((ARMOperand*)Operands[1]);
Operands.erase(Operands.begin() + 1);
+ delete CCOut;
+ }
}
// If we get a Match_MnemonicFail it might be some arithmetic instruction
// that updates the condition codes if it ends in 's'. So see if the
@@ -976,8 +979,10 @@
// removed the 's' from the mnemonic for matching.
StringRef MnemonicNoS = Mnemonic.slice(0, Mnemonic.size() - 1);
SMLoc NameLoc = ((ARMOperand*)Operands[0])->getStartLoc();
- Operands.erase(Operands.begin());
- Operands.insert(Operands.begin(),
+ ARMOperand *OldMnemonic = ((ARMOperand*)Operands[0]);
+ Operands.erase(Operands.begin());
+ delete OldMnemonic;
+ Operands.insert(Operands.begin(),
ARMOperand::CreateToken(MnemonicNoS, NameLoc));
Operands.insert(Operands.begin() + 1,
ARMOperand::CreateCCOut(ARM::CPSR, NameLoc));
@@ -985,10 +990,14 @@
if (MatchResult2 == Match_Success)
MatchResult = Match_Success;
else {
- Operands.erase(Operands.begin());
- Operands.insert(Operands.begin(),
+ ARMOperand *OldMnemonic = ((ARMOperand*)Operands[0]);
+ Operands.erase(Operands.begin());
+ delete OldMnemonic;
+ Operands.insert(Operands.begin(),
ARMOperand::CreateToken(Mnemonic, NameLoc));
- Operands.erase(Operands.begin() + 1);
+ ARMOperand *CCOut = ((ARMOperand*)Operands[1]);
+ Operands.erase(Operands.begin() + 1);
+ delete CCOut;
}
}
}
More information about the llvm-commits
mailing list