mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-16 11:24:39 +00:00
Use std::unique_ptr to manage MCBasicBlocks in MCFunction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206242 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -20,21 +20,16 @@ MCFunction::MCFunction(StringRef Name, MCModule *Parent)
|
||||
: Name(Name), ParentModule(Parent)
|
||||
{}
|
||||
|
||||
MCFunction::~MCFunction() {
|
||||
for (iterator I = begin(), E = end(); I != E; ++I)
|
||||
delete *I;
|
||||
}
|
||||
|
||||
MCBasicBlock &MCFunction::createBlock(const MCTextAtom &TA) {
|
||||
MCBasicBlock *MCBB = new MCBasicBlock(TA, this);
|
||||
Blocks.push_back(MCBB);
|
||||
return *MCBB;
|
||||
std::unique_ptr<MCBasicBlock> MCBB(new MCBasicBlock(TA, this));
|
||||
Blocks.push_back(std::move(MCBB));
|
||||
return *Blocks.back();
|
||||
}
|
||||
|
||||
MCBasicBlock *MCFunction::find(uint64_t StartAddr) {
|
||||
for (const_iterator I = begin(), E = end(); I != E; ++I)
|
||||
if ((*I)->getInsts()->getBeginAddr() == StartAddr)
|
||||
return *I;
|
||||
return I->get();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user