mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-19 18:24:00 +00:00
Use unique_ptr to manager FilterChooser ownership.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217014 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -230,7 +230,7 @@ protected:
|
|||||||
std::vector<unsigned> VariableInstructions;
|
std::vector<unsigned> VariableInstructions;
|
||||||
|
|
||||||
// Map of well-known segment value to its delegate.
|
// Map of well-known segment value to its delegate.
|
||||||
std::map<unsigned, const FilterChooser*> FilterChooserMap;
|
std::map<unsigned, std::unique_ptr<const FilterChooser>> FilterChooserMap;
|
||||||
|
|
||||||
// Number of instructions which fall under FilteredInstructions category.
|
// Number of instructions which fall under FilteredInstructions category.
|
||||||
unsigned NumFiltered;
|
unsigned NumFiltered;
|
||||||
@ -530,12 +530,6 @@ Filter::Filter(FilterChooser &owner, unsigned startBit, unsigned numBits,
|
|||||||
}
|
}
|
||||||
|
|
||||||
Filter::~Filter() {
|
Filter::~Filter() {
|
||||||
std::map<unsigned, const FilterChooser*>::iterator filterIterator;
|
|
||||||
for (filterIterator = FilterChooserMap.begin();
|
|
||||||
filterIterator != FilterChooserMap.end();
|
|
||||||
filterIterator++) {
|
|
||||||
delete filterIterator->second;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Divides the decoding task into sub tasks and delegates them to the
|
// Divides the decoding task into sub tasks and delegates them to the
|
||||||
@ -557,14 +551,12 @@ void Filter::recurse() {
|
|||||||
|
|
||||||
// Delegates to an inferior filter chooser for further processing on this
|
// Delegates to an inferior filter chooser for further processing on this
|
||||||
// group of instructions whose segment values are variable.
|
// group of instructions whose segment values are variable.
|
||||||
FilterChooserMap.insert(std::pair<unsigned, const FilterChooser*>(
|
FilterChooserMap.emplace((unsigned)-1,
|
||||||
(unsigned)-1,
|
make_unique<FilterChooser>(Owner->AllInstructions,
|
||||||
new FilterChooser(Owner->AllInstructions,
|
VariableInstructions,
|
||||||
VariableInstructions,
|
Owner->Operands,
|
||||||
Owner->Operands,
|
BitValueArray,
|
||||||
BitValueArray,
|
*Owner));
|
||||||
*Owner)
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// No need to recurse for a singleton filtered instruction.
|
// No need to recurse for a singleton filtered instruction.
|
||||||
@ -590,14 +582,12 @@ void Filter::recurse() {
|
|||||||
|
|
||||||
// Delegates to an inferior filter chooser for further processing on this
|
// Delegates to an inferior filter chooser for further processing on this
|
||||||
// category of instructions.
|
// category of instructions.
|
||||||
FilterChooserMap.insert(std::pair<unsigned, const FilterChooser*>(
|
FilterChooserMap.emplace(mapIterator->first,
|
||||||
mapIterator->first,
|
make_unique<FilterChooser>(Owner->AllInstructions,
|
||||||
new FilterChooser(Owner->AllInstructions,
|
mapIterator->second,
|
||||||
mapIterator->second,
|
Owner->Operands,
|
||||||
Owner->Operands,
|
BitValueArray,
|
||||||
BitValueArray,
|
*Owner));
|
||||||
*Owner)
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -632,7 +622,8 @@ void Filter::emitTableEntry(DecoderTableInfo &TableInfo) const {
|
|||||||
// A new filter entry begins a new scope for fixup resolution.
|
// A new filter entry begins a new scope for fixup resolution.
|
||||||
TableInfo.FixupStack.push_back(FixupList());
|
TableInfo.FixupStack.push_back(FixupList());
|
||||||
|
|
||||||
std::map<unsigned, const FilterChooser*>::const_iterator filterIterator;
|
std::map<unsigned,
|
||||||
|
std::unique_ptr<const FilterChooser>>::const_iterator filterIterator;
|
||||||
|
|
||||||
DecoderTable &Table = TableInfo.Table;
|
DecoderTable &Table = TableInfo.Table;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user