From: Craig Topper Date: Wed, 3 Sep 2014 06:07:54 +0000 (+0000) Subject: Recommit "Use unique_ptr to manager FilterChooser ownership." X-Git-Tag: android-x86-7.1-r4~57886 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=732b0261192db96ad8950120e4325ea674b051c6;p=android-x86%2Fexternal-llvm.git Recommit "Use unique_ptr to manager FilterChooser ownership." Just using insert of a pair this time instead of emplace. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217018 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/utils/TableGen/FixedLenDecoderEmitter.cpp b/utils/TableGen/FixedLenDecoderEmitter.cpp index 27114cba5e5..0a8179f443d 100644 --- a/utils/TableGen/FixedLenDecoderEmitter.cpp +++ b/utils/TableGen/FixedLenDecoderEmitter.cpp @@ -230,7 +230,7 @@ protected: std::vector VariableInstructions; // Map of well-known segment value to its delegate. - std::map FilterChooserMap; + std::map> 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::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)-1, - new FilterChooser(Owner->AllInstructions, - VariableInstructions, - Owner->Operands, - BitValueArray, - *Owner) - )); + FilterChooserMap.insert(std::make_pair( + -1U, + make_unique(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( + FilterChooserMap.insert(std::make_pair( mapIterator->first, - new FilterChooser(Owner->AllInstructions, - mapIterator->second, - Owner->Operands, - BitValueArray, - *Owner) - )); + make_unique(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::const_iterator filterIterator; + std::map>::const_iterator filterIterator; DecoderTable &Table = TableInfo.Table;