diff options
author | Craig Topper <craig.topper@gmail.com> | 2014-09-03 06:07:54 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2014-09-03 06:07:54 +0000 |
commit | cf05f91ab586363e43ec14f2da4d98a6ce025c22 (patch) | |
tree | 909a03b640bf0c17310f43b1ff0303fdded8bab5 /llvm/utils/TableGen/FixedLenDecoderEmitter.cpp | |
parent | 2cfd1fed21db5fe9d5538ca88ec63f77b4c9c385 (diff) | |
download | bcm5719-llvm-cf05f91ab586363e43ec14f2da4d98a6ce025c22.tar.gz bcm5719-llvm-cf05f91ab586363e43ec14f2da4d98a6ce025c22.zip |
Recommit "Use unique_ptr to manager FilterChooser ownership."
Just using insert of a pair this time instead of emplace.
llvm-svn: 217018
Diffstat (limited to 'llvm/utils/TableGen/FixedLenDecoderEmitter.cpp')
-rw-r--r-- | llvm/utils/TableGen/FixedLenDecoderEmitter.cpp | 39 |
1 files changed, 16 insertions, 23 deletions
diff --git a/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp b/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp index 27114cba5e5..0a8179f443d 100644 --- a/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp +++ b/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp @@ -230,7 +230,7 @@ protected: std::vector<unsigned> VariableInstructions; // 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. unsigned NumFiltered; @@ -530,12 +530,6 @@ Filter::Filter(FilterChooser &owner, unsigned startBit, unsigned numBits, } 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 @@ -557,14 +551,13 @@ void Filter::recurse() { // Delegates to an inferior filter chooser for further processing on this // group of instructions whose segment values are variable. - FilterChooserMap.insert(std::pair<unsigned, const FilterChooser*>( - (unsigned)-1, - new FilterChooser(Owner->AllInstructions, - VariableInstructions, - Owner->Operands, - BitValueArray, - *Owner) - )); + FilterChooserMap.insert(std::make_pair( + -1U, + make_unique<FilterChooser>(Owner->AllInstructions, + VariableInstructions, + Owner->Operands, + BitValueArray, + *Owner))); } // No need to recurse for a singleton filtered instruction. @@ -590,14 +583,13 @@ void Filter::recurse() { // Delegates to an inferior filter chooser for further processing on this // category of instructions. - FilterChooserMap.insert(std::pair<unsigned, const FilterChooser*>( + FilterChooserMap.insert(std::make_pair( mapIterator->first, - new FilterChooser(Owner->AllInstructions, - mapIterator->second, - Owner->Operands, - BitValueArray, - *Owner) - )); + make_unique<FilterChooser>(Owner->AllInstructions, + mapIterator->second, + Owner->Operands, + BitValueArray, + *Owner))); } } @@ -632,7 +624,8 @@ void Filter::emitTableEntry(DecoderTableInfo &TableInfo) const { // A new filter entry begins a new scope for fixup resolution. 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; |