using emplace

This commit is contained in:
caheckman 2021-01-07 14:36:10 -05:00
parent 3644c120c0
commit 5f715d73e3
34 changed files with 101 additions and 103 deletions

View file

@ -1066,7 +1066,7 @@ void Architecture::parsePreferSplit(const Element *el)
List::const_iterator iter; List::const_iterator iter;
for(iter=list.begin();iter!=list.end();++iter) { for(iter=list.begin();iter!=list.end();++iter) {
splitrecords.push_back(PreferSplitRecord()); splitrecords.emplace_back();
PreferSplitRecord &record( splitrecords.back() ); PreferSplitRecord &record( splitrecords.back() );
record.storage.restoreXml( *iter, this ); record.storage.restoreXml( *iter, this );
record.splitoffset = record.storage.size/2; record.splitoffset = record.storage.size/2;

View file

@ -73,11 +73,11 @@ void FlowBlock::addInEdge(FlowBlock *b,uint4 lab)
void FlowBlock::restoreNextInEdge(const Element *el,BlockMap &resolver) void FlowBlock::restoreNextInEdge(const Element *el,BlockMap &resolver)
{ {
intothis.push_back(BlockEdge()); intothis.emplace_back();
BlockEdge &inedge(intothis.back()); BlockEdge &inedge(intothis.back());
inedge.restoreXml(el,resolver); inedge.restoreXml(el,resolver);
while(inedge.point->outofthis.size() <= inedge.reverse_index) while(inedge.point->outofthis.size() <= inedge.reverse_index)
inedge.point->outofthis.push_back(BlockEdge()); inedge.point->outofthis.emplace_back();
BlockEdge &outedge(inedge.point->outofthis[inedge.reverse_index]); BlockEdge &outedge(inedge.point->outofthis[inedge.reverse_index]);
outedge.label = 0; outedge.label = 0;
outedge.point = this; outedge.point = this;
@ -3271,7 +3271,7 @@ BlockSwitch::BlockSwitch(FlowBlock *ind)
void BlockSwitch::addCase(FlowBlock *switchbl,FlowBlock *bl,uint4 gt) void BlockSwitch::addCase(FlowBlock *switchbl,FlowBlock *bl,uint4 gt)
{ {
caseblocks.push_back(CaseOrder()); caseblocks.emplace_back();
CaseOrder &curcase( caseblocks.back() ); CaseOrder &curcase( caseblocks.back() );
const FlowBlock *basicbl = bl->getFrontLeaf()->subBlock(0); const FlowBlock *basicbl = bl->getFrontLeaf()->subBlock(0);
curcase.block = bl; curcase.block = bl;

View file

@ -729,7 +729,7 @@ TraceDAG::BlockTrace *TraceDAG::selectBadEdge(void)
if ((*aiter)->isTerminal()) continue; if ((*aiter)->isTerminal()) continue;
if (((*aiter)->top->top == (FlowBlock *)0)&&((*aiter)->bottom==(FlowBlock *)0)) if (((*aiter)->top->top == (FlowBlock *)0)&&((*aiter)->bottom==(FlowBlock *)0))
continue; // Never remove virtual edges continue; // Never remove virtual edges
badedgelist.push_back(BadEdgeScore()); badedgelist.emplace_back();
BadEdgeScore &score( badedgelist.back() ); BadEdgeScore &score( badedgelist.back() );
score.trace = *aiter; score.trace = *aiter;
score.exitproto = score.trace->destnode; score.exitproto = score.trace->destnode;
@ -1125,7 +1125,7 @@ void CollapseStructure::labelLoops(vector<LoopBody *> &looporder)
for(int4 j=0;j<sizein;++j) { for(int4 j=0;j<sizein;++j) {
if (bl->isBackEdgeIn(j)) { // back-edge coming in must be from the bottom of a loop if (bl->isBackEdgeIn(j)) { // back-edge coming in must be from the bottom of a loop
FlowBlock *loopbottom = bl->getIn(j); FlowBlock *loopbottom = bl->getIn(j);
loopbody.push_back(LoopBody(bl)); loopbody.emplace_back(bl);
LoopBody &curbody( loopbody.back() ); LoopBody &curbody( loopbody.back() );
curbody.addTail(loopbottom); curbody.addTail(loopbottom);
looporder.push_back( & curbody ); looporder.push_back( & curbody );

View file

@ -193,7 +193,7 @@ void CallGraph::clearMarks(void)
CallGraphEdge &CallGraph::insertBlankEdge(CallGraphNode *node,int4 slot) CallGraphEdge &CallGraph::insertBlankEdge(CallGraphNode *node,int4 slot)
{ {
node->outedge.push_back(CallGraphEdge()); node->outedge.emplace_back();
if (node->outedge.size() > 1) { if (node->outedge.size() > 1) {
for(int4 i=node->outedge.size()-2;i>=slot;--i) { for(int4 i=node->outedge.size()-2;i>=slot;--i) {
int4 newi = i+1; int4 newi = i+1;
@ -255,7 +255,7 @@ void CallGraph::addEdge(CallGraphNode *from,CallGraphNode *to,const Address &add
CallGraphEdge &fromedge( insertBlankEdge(from,i) ); CallGraphEdge &fromedge( insertBlankEdge(from,i) );
int4 toi = to->inedge.size(); int4 toi = to->inedge.size();
to->inedge.push_back(CallGraphEdge()); to->inedge.emplace_back();
CallGraphEdge &toedge( to->inedge.back() ); CallGraphEdge &toedge( to->inedge.back() );
fromedge.from = from; fromedge.from = from;

View file

@ -282,7 +282,7 @@ Address CodeDataAnalysis::disassembleBlock(const Address &addr,const Address &en
} }
for(;;) { for(;;) {
disengine.disassemble(curaddr,disresult); disengine.disassemble(curaddr,disresult);
codevec.push_back(CodeUnit()); codevec.emplace_back();
if (!disresult.success) { if (!disresult.success) {
codevec.back().flags = CodeUnit::notcode; codevec.back().flags = CodeUnit::notcode;
codevec.back().size = 1; codevec.back().size = 1;
@ -428,16 +428,16 @@ void CodeDataAnalysis::markCrossHits(void)
void CodeDataAnalysis::addTargetHit(const Address &codeaddr,uintb targethit) void CodeDataAnalysis::addTargetHit(const Address &codeaddr,uintb targethit)
{ {
targethits.push_back(TargetHit()); Address funcstart = findFunctionStart( codeaddr );
targethits.back().funcstart = findFunctionStart( codeaddr ); Address thunkaddr = Address(glb->translate->getDefaultCodeSpace(),targethit);
targethits.back().codeaddr = codeaddr; uint4 mask;
targethits.back().thunkaddr = Address(glb->translate->getDefaultCodeSpace(),targethit);
map<Address,TargetFeature>::const_iterator titer; map<Address,TargetFeature>::const_iterator titer;
titer = targets.find( targethits.back().thunkaddr ); titer = targets.find( thunkaddr );
if (titer != targets.end()) if (titer != targets.end())
targethits.back().mask = (*titer).second.featuremask; mask = (*titer).second.featuremask;
else else
throw LowlevelError("Found thunk without a feature mask"); throw LowlevelError("Found thunk without a feature mask");
targethits.emplace_back(funcstart,codeaddr,thunkaddr,mask);
} }
void CodeDataAnalysis::resolveThunkHit(const Address &codeaddr,uintb targethit) void CodeDataAnalysis::resolveThunkHit(const Address &codeaddr,uintb targethit)
@ -524,7 +524,7 @@ bool CodeDataAnalysis::repairJump(const Address &addr,int4 max)
if (curaddr == (*iter).first) break; // Back on cut if (curaddr == (*iter).first) break; // Back on cut
disengine.disassemble(curaddr,disresult); disengine.disassemble(curaddr,disresult);
if (!disresult.success) return false; if (!disresult.success) return false;
codevec.push_back(CodeUnit()); codevec.emplace_back();
if ((disresult.flags & CodeUnit::jump)!=0) { if ((disresult.flags & CodeUnit::jump)!=0) {
fromto_vec[ AddrLink(curaddr,disresult.jumpaddress) ] = disresult.flags; fromto_vec[ AddrLink(curaddr,disresult.jumpaddress) ] = disresult.flags;
} }

View file

@ -77,6 +77,8 @@ public:
Address codeaddr; // Address of instruction refering to target call Address codeaddr; // Address of instruction refering to target call
Address thunkaddr; // The target call Address thunkaddr; // The target call
uint4 mask; // Mask associated with this target uint4 mask; // Mask associated with this target
TargetHit(const Address &func,const Address &code,const Address &thunk,uint4 m) :
funcstart(func), codeaddr(code), thunkaddr(thunk) { mask = m; }
bool operator<(const TargetHit &op2) const { return (funcstart < op2.funcstart); } bool operator<(const TargetHit &op2) const { return (funcstart < op2.funcstart); }
}; };

View file

@ -119,7 +119,7 @@ uintm ParserContext::getContextBits(int4 startbit,int4 size) const
void ParserContext::addCommit(TripleSymbol *sym,int4 num,uintm mask,bool flow,ConstructState *point) void ParserContext::addCommit(TripleSymbol *sym,int4 num,uintm mask,bool flow,ConstructState *point)
{ {
contextcommit.push_back(ContextSet()); contextcommit.emplace_back();
ContextSet &set(contextcommit.back()); ContextSet &set(contextcommit.back());
set.sym = sym; set.sym = sym;

View file

@ -4532,7 +4532,7 @@ void ActionInferTypes::propagateOneType(TypeFactory *typegrp,Varnode *vn)
PropagationState *ptr; PropagationState *ptr;
vector<PropagationState> state; vector<PropagationState> state;
state.push_back(PropagationState(vn)); state.emplace_back(vn);
vn->setMark(); vn->setMark();
while(!state.empty()) { while(!state.empty()) {
@ -4545,7 +4545,7 @@ void ActionInferTypes::propagateOneType(TypeFactory *typegrp,Varnode *vn)
if (propagateTypeEdge(typegrp,ptr->op,ptr->inslot,ptr->slot)) { if (propagateTypeEdge(typegrp,ptr->op,ptr->inslot,ptr->slot)) {
vn = (ptr->slot==-1) ? ptr->op->getOut() : ptr->op->getIn(ptr->slot); vn = (ptr->slot==-1) ? ptr->op->getOut() : ptr->op->getIn(ptr->slot);
ptr->step(); // Make sure to step before push_back ptr->step(); // Make sure to step before push_back
state.push_back(PropagationState(vn)); state.emplace_back(vn);
vn->setMark(); vn->setMark();
} }
else else

View file

@ -193,7 +193,7 @@ CPoolRecord *ConstantPoolInternal::createRecord(const vector<uintb> &refs)
{ {
CheapSorter sorter(refs); CheapSorter sorter(refs);
pair<map<CheapSorter,CPoolRecord>::iterator,bool> res; pair<map<CheapSorter,CPoolRecord>::iterator,bool> res;
res = cpoolMap.insert(pair<CheapSorter,CPoolRecord>(sorter,CPoolRecord())); res = cpoolMap.emplace(piecewise_construct,forward_as_tuple(sorter),forward_as_tuple());
if (res.second == false) if (res.second == false)
throw LowlevelError("Creating duplicate entry in constant pool: "+(*res.first).second.getToken()); throw LowlevelError("Creating duplicate entry in constant pool: "+(*res.first).second.getToken());
return &(*res.first).second; return &(*res.first).second;

View file

@ -53,12 +53,11 @@ SymbolEntry::SymbolEntry(Symbol *sym,uint4 exfl,uint8 h,int4 off,int4 sz,const R
uselimit = rnglist; uselimit = rnglist;
} }
/// Assuming the boundary offsets have been specified with /// Establish the boundary offsets and fill in additional data
/// the constructor, fill in the rest of the data.
/// \param data contains the raw initialization data /// \param data contains the raw initialization data
/// \param a is the starting offset of the entry /// \param a is the starting offset of the entry
/// \param b is the ending offset of the entry /// \param b is the ending offset of the entry
void SymbolEntry::initialize(const EntryInitData &data,uintb a,uintb b) SymbolEntry::SymbolEntry(const EntryInitData &data,uintb a,uintb b)
{ {
addr = Address(data.space,a); addr = Address(data.space,a);

View file

@ -112,7 +112,7 @@ public:
typedef EntrySubsort subsorttype; ///< The sub-sort object for a rangemap typedef EntrySubsort subsorttype; ///< The sub-sort object for a rangemap
typedef EntryInitData inittype; ///< Initialization data for a SymbolEntry in a rangemap typedef EntryInitData inittype; ///< Initialization data for a SymbolEntry in a rangemap
SymbolEntry(void) {} ///< Constructor for use with rangemap SymbolEntry(const EntryInitData &data,uintb a,uintb b); ///< Fully initialize \b this
SymbolEntry(Symbol *sym,uint4 exfl,uint8 h,int4 off,int4 sz,const RangeList &rnglist); ///< Construct a dynamic SymbolEntry SymbolEntry(Symbol *sym,uint4 exfl,uint8 h,int4 off,int4 sz,const RangeList &rnglist); ///< Construct a dynamic SymbolEntry
bool isPiece(void) const { return ((extraflags&(Varnode::precislo|Varnode::precishi))!=0); } ///< Is \b this a high or low piece of the whole Symbol bool isPiece(void) const { return ((extraflags&(Varnode::precislo|Varnode::precishi))!=0); } ///< Is \b this a high or low piece of the whole Symbol
bool isDynamic(void) const { return addr.isInvalid(); } ///< Is \b storage \e dynamic bool isDynamic(void) const { return addr.isInvalid(); } ///< Is \b storage \e dynamic
@ -122,7 +122,6 @@ public:
uintb getFirst(void) const { return addr.getOffset(); } ///< Get the first offset of \b this storage location uintb getFirst(void) const { return addr.getOffset(); } ///< Get the first offset of \b this storage location
uintb getLast(void) const { return (addr.getOffset()+size-1); } ///< Get the last offset of \b this storage location uintb getLast(void) const { return (addr.getOffset()+size-1); } ///< Get the last offset of \b this storage location
subsorttype getSubsort(void) const; ///< Get the sub-sort object subsorttype getSubsort(void) const; ///< Get the sub-sort object
void initialize(const EntryInitData &data,uintb a,uintb b); ///< Fully initialize \b this
Symbol *getSymbol(void) const { return symbol; } ///< Get the Symbol associated with \b this Symbol *getSymbol(void) const { return symbol; } ///< Get the Symbol associated with \b this
const Address &getAddr(void) const { return addr; } ///< Get the starting address of \b this storage const Address &getAddr(void) const { return addr; } ///< Get the starting address of \b this storage
uint8 getHash(void) const { return hash; } ///< Get the hash used to identify \b this storage uint8 getHash(void) const { return hash; } ///< Get the hash used to identify \b this storage
@ -819,13 +818,12 @@ private:
Address first; ///< The first address of the range Address first; ///< The first address of the range
Address last; ///< The last address of the range Address last; ///< The last address of the range
public: public:
ScopeMapper(void) {} ///< Constructor for use with rangemap ScopeMapper(const inittype &data,const Address &f,const Address &l) {
scope = data; first = f; last = l; } ///< Initialize the range (with the owning Scope)
Address getFirst(void) const { return first; } ///< Get the first address in the range Address getFirst(void) const { return first; } ///< Get the first address in the range
Address getLast(void) const { return last; } ///< Get the last address in the range Address getLast(void) const { return last; } ///< Get the last address in the range
NullSubsort getSubsort(void) const { return NullSubsort(); } ///< Get the sub-subsort object NullSubsort getSubsort(void) const { return NullSubsort(); } ///< Get the sub-subsort object
Scope *getScope(void) const { return scope; } ///< Get the Scope owning this address range Scope *getScope(void) const { return scope; } ///< Get the Scope owning this address range
void initialize(const inittype &data,const Address &f,const Address &l) {
scope = data; first = f; last = l; } ///< Initialize the range (with the owning Scope)
}; };
typedef rangemap<ScopeMapper> ScopeResolve; ///< A map from address to the owning Scope typedef rangemap<ScopeMapper> ScopeResolve; ///< A map from address to the owning Scope

View file

@ -1203,14 +1203,14 @@ void FlowInfo::injectUserOp(PcodeOp *op)
icontext.nextaddr = icontext.baseaddr; icontext.nextaddr = icontext.baseaddr;
for(int4 i=1;i<op->numInput();++i) { // Skip the first operand containing the injectid for(int4 i=1;i<op->numInput();++i) { // Skip the first operand containing the injectid
Varnode *vn = op->getIn(i); Varnode *vn = op->getIn(i);
icontext.inputlist.push_back(VarnodeData()); icontext.inputlist.emplace_back();
icontext.inputlist.back().space = vn->getSpace(); icontext.inputlist.back().space = vn->getSpace();
icontext.inputlist.back().offset = vn->getOffset(); icontext.inputlist.back().offset = vn->getOffset();
icontext.inputlist.back().size = vn->getSize(); icontext.inputlist.back().size = vn->getSize();
} }
Varnode *outvn = op->getOut(); Varnode *outvn = op->getOut();
if (outvn != (Varnode *)0) { if (outvn != (Varnode *)0) {
icontext.output.push_back(VarnodeData()); icontext.output.emplace_back();
icontext.output.back().space = outvn->getSpace(); icontext.output.back().space = outvn->getSpace();
icontext.output.back().offset = outvn->getOffset(); icontext.output.back().offset = outvn->getOffset();
icontext.output.back().size = outvn->getSize(); icontext.output.back().size = outvn->getSize();

View file

@ -545,7 +545,7 @@ void ParamListStandard::assignMap(const vector<Datatype *> &proto,bool isinput,T
throw ParamUnassignedError("Cannot assign parameter address for " + res.back().type->getName()); throw ParamUnassignedError("Cannot assign parameter address for " + res.back().type->getName());
} }
for(int4 i=1;i<proto.size();++i) { for(int4 i=1;i<proto.size();++i) {
res.push_back(ParameterPieces()); res.emplace_back();
if ((pointermax != 0)&&(proto[i]->getSize() > pointermax)) { // Datatype is too big if ((pointermax != 0)&&(proto[i]->getSize() > pointermax)) { // Datatype is too big
// Assume datatype is stored elsewhere and only the pointer is passed // Assume datatype is stored elsewhere and only the pointer is passed
AddrSpace *spc = spacebase; AddrSpace *spc = spacebase;
@ -567,7 +567,7 @@ void ParamListStandard::assignMap(const vector<Datatype *> &proto,bool isinput,T
} }
} }
else { else {
res.push_back(ParameterPieces()); res.emplace_back();
if (proto[0]->getMetatype() != TYPE_VOID) { if (proto[0]->getMetatype() != TYPE_VOID) {
res.back().addr = assignAddress(proto[0],status); res.back().addr = assignAddress(proto[0],status);
if (res.back().addr.isInvalid()) if (res.back().addr.isInvalid())
@ -1050,7 +1050,7 @@ void ParamListStandard::restoreXml(const Element *el,const AddrSpaceManager *man
for(fiter=flist.begin();fiter!=flist.end();++fiter) { for(fiter=flist.begin();fiter!=flist.end();++fiter) {
const Element *subel = *fiter; const Element *subel = *fiter;
if (subel->getName() == "pentry") { if (subel->getName() == "pentry") {
entry.push_back(ParamEntry(numgroup)); entry.emplace_back(numgroup);
entry.back().restoreXml(subel,manage,normalstack); entry.back().restoreXml(subel,manage,normalstack);
if (entry.back().getType()==TYPE_FLOAT) { if (entry.back().getType()==TYPE_FLOAT) {
if (nonfloatgroup >= 0) if (nonfloatgroup >= 0)
@ -1089,7 +1089,7 @@ void ParamListStandardOut::assignMap(const vector<Datatype *> &proto,bool isinpu
vector<int4> status(numgroup,0); vector<int4> status(numgroup,0);
// This is always an output list so we ignore -isinput- // This is always an output list so we ignore -isinput-
res.push_back(ParameterPieces()); res.emplace_back();
res.back().type = proto[0]; res.back().type = proto[0];
res.back().flags = 0; res.back().flags = 0;
if (proto[0]->getMetatype() == TYPE_VOID) { if (proto[0]->getMetatype() == TYPE_VOID) {
@ -1109,8 +1109,8 @@ void ParamListStandardOut::assignMap(const vector<Datatype *> &proto,bool isinpu
res.back().type = pointertp; res.back().type = pointertp;
res.back().flags = ParameterPieces::indirectstorage; res.back().flags = ParameterPieces::indirectstorage;
res.push_back(ParameterPieces()); // Add extra storage location in the input params res.emplace_back(); // Add extra storage location in the input params
res.back().type = pointertp; // that holds a pointer to where the return value should be stored res.back().type = pointertp; // that holds a pointer to where the return value should be stored
// leave its address invalid, to be filled in by the input list assignMap // leave its address invalid, to be filled in by the input list assignMap
res.back().flags = ParameterPieces::hiddenretparm; // Mark it as special res.back().flags = ParameterPieces::hiddenretparm; // Mark it as special
} }
@ -1851,7 +1851,7 @@ void ProtoModel::assignParameterStorage(const vector<Datatype *> &typelist,vecto
} }
catch(ParamUnassignedError &err) { catch(ParamUnassignedError &err) {
res.clear(); res.clear();
res.push_back(ParameterPieces()); res.emplace_back();
// leave address undefined // leave address undefined
res.back().flags = 0; res.back().flags = 0;
res.back().type = glb->types->getTypeVoid(); res.back().type = glb->types->getTypeVoid();
@ -1984,7 +1984,7 @@ void ProtoModel::restoreXml(const Element *el)
const List &flist(subnode->getChildren()); const List &flist(subnode->getChildren());
List::const_iterator fiter; List::const_iterator fiter;
for(fiter=flist.begin();fiter!=flist.end();++fiter) { for(fiter=flist.begin();fiter!=flist.end();++fiter) {
effectlist.push_back(EffectRecord()); effectlist.emplace_back();
effectlist.back().restoreXml(EffectRecord::unaffected,*fiter,glb); effectlist.back().restoreXml(EffectRecord::unaffected,*fiter,glb);
} }
} }
@ -1992,7 +1992,7 @@ void ProtoModel::restoreXml(const Element *el)
const List &flist(subnode->getChildren()); const List &flist(subnode->getChildren());
List::const_iterator fiter; List::const_iterator fiter;
for(fiter=flist.begin();fiter!=flist.end();++fiter) { for(fiter=flist.begin();fiter!=flist.end();++fiter) {
effectlist.push_back(EffectRecord()); effectlist.emplace_back();
effectlist.back().restoreXml(EffectRecord::killedbycall,*fiter,glb); effectlist.back().restoreXml(EffectRecord::killedbycall,*fiter,glb);
} }
} }
@ -2000,7 +2000,7 @@ void ProtoModel::restoreXml(const Element *el)
const List &flist(subnode->getChildren()); const List &flist(subnode->getChildren());
List::const_iterator fiter; List::const_iterator fiter;
for(fiter=flist.begin();fiter!=flist.end();++fiter) { for(fiter=flist.begin();fiter!=flist.end();++fiter) {
effectlist.push_back(EffectRecord()); effectlist.emplace_back();
effectlist.back().restoreXml(EffectRecord::return_address,*fiter,glb); effectlist.back().restoreXml(EffectRecord::return_address,*fiter,glb);
} }
sawretaddr = true; sawretaddr = true;
@ -2029,7 +2029,7 @@ void ProtoModel::restoreXml(const Element *el)
const List &flist(subnode->getChildren()); const List &flist(subnode->getChildren());
List::const_iterator fiter; List::const_iterator fiter;
for(fiter=flist.begin();fiter!=flist.end();++fiter) { for(fiter=flist.begin();fiter!=flist.end();++fiter) {
likelytrash.push_back(VarnodeData()); likelytrash.emplace_back();
likelytrash.back().restoreXml(*fiter,glb); likelytrash.back().restoreXml(*fiter,glb);
} }
} }
@ -2088,7 +2088,7 @@ void ScoreProtoModel::addParameter(const Address &addr,int4 sz)
else else
isparam = model->possibleOutputParamWithSlot(addr,sz,slot,slotsize); isparam = model->possibleOutputParamWithSlot(addr,sz,slot,slotsize);
if (isparam) { if (isparam) {
entry.push_back(PEntry()); entry.emplace_back();
entry.back().origIndex = orig; entry.back().origIndex = orig;
entry.back().slot = slot; entry.back().slot = slot;
entry.back().size = slotsize; entry.back().size = slotsize;
@ -2731,7 +2731,7 @@ void ProtoStoreInternal::clearOutput(void)
{ {
if (outparam != (ProtoParameter *)0) if (outparam != (ProtoParameter *)0)
delete outparam; delete outparam;
outparam = new ParameterBasic("",Address(),voidtype,0); outparam = new ParameterBasic(voidtype);
} }
ProtoParameter *ProtoStoreInternal::getOutput(void) ProtoParameter *ProtoStoreInternal::getOutput(void)
@ -2852,7 +2852,7 @@ void ProtoStoreInternal::restoreXml(const Element *el,ProtoModel *model)
} }
if ((flags & ParameterPieces::hiddenretparm) == 0) if ((flags & ParameterPieces::hiddenretparm) == 0)
namelist.push_back(name); namelist.push_back(name);
pieces.push_back(ParameterPieces()); pieces.emplace_back();
ParameterPieces &curparam( pieces.back() ); ParameterPieces &curparam( pieces.back() );
const List &sublist(subel->getChildren()); const List &sublist(subel->getChildren());
List::const_iterator subiter; List::const_iterator subiter;
@ -3963,7 +3963,7 @@ void FuncProto::restoreXml(const Element *el,Architecture *glb)
const List &list2((*iter)->getChildren()); const List &list2((*iter)->getChildren());
List::const_iterator iter2 = list2.begin(); List::const_iterator iter2 = list2.begin();
while(iter2 != list2.end()) { while(iter2 != list2.end()) {
effectlist.push_back(EffectRecord()); effectlist.emplace_back();
effectlist.back().restoreXml(EffectRecord::unaffected,*iter2,glb); effectlist.back().restoreXml(EffectRecord::unaffected,*iter2,glb);
++iter2; ++iter2;
} }
@ -3972,7 +3972,7 @@ void FuncProto::restoreXml(const Element *el,Architecture *glb)
const List &list2((*iter)->getChildren()); const List &list2((*iter)->getChildren());
List::const_iterator iter2 = list2.begin(); List::const_iterator iter2 = list2.begin();
while(iter2 != list2.end()) { while(iter2 != list2.end()) {
effectlist.push_back(EffectRecord()); effectlist.emplace_back();
effectlist.back().restoreXml(EffectRecord::killedbycall,*iter2,glb); effectlist.back().restoreXml(EffectRecord::killedbycall,*iter2,glb);
++iter2; ++iter2;
} }
@ -3981,7 +3981,7 @@ void FuncProto::restoreXml(const Element *el,Architecture *glb)
const List &list2((*iter)->getChildren()); const List &list2((*iter)->getChildren());
List::const_iterator iter2 = list2.begin(); List::const_iterator iter2 = list2.begin();
while(iter2 != list2.end()) { while(iter2 != list2.end()) {
effectlist.push_back(EffectRecord()); effectlist.emplace_back();
effectlist.back().restoreXml(EffectRecord::return_address,*iter2,glb); effectlist.back().restoreXml(EffectRecord::return_address,*iter2,glb);
++iter2; ++iter2;
} }
@ -3990,7 +3990,7 @@ void FuncProto::restoreXml(const Element *el,Architecture *glb)
const List &list2((*iter)->getChildren()); const List &list2((*iter)->getChildren());
List::const_iterator iter2 = list2.begin(); List::const_iterator iter2 = list2.begin();
while(iter2 != list2.end()) { while(iter2 != list2.end()) {
likelytrash.push_back(VarnodeData()); likelytrash.emplace_back();
likelytrash.back().restoreXml(*iter2,glb); likelytrash.back().restoreXml(*iter2,glb);
++iter2; ++iter2;
} }

View file

@ -130,8 +130,7 @@ public:
typedef SubsortPosition subsorttype; ///< The sub-sort object for a rangemap typedef SubsortPosition subsorttype; ///< The sub-sort object for a rangemap
typedef InitData inittype; ///< Initialization data for a ScopeMapper typedef InitData inittype; ///< Initialization data for a ScopeMapper
ParamEntryRange(void) {} ///< Constructor for use with rangemap ParamEntryRange(const inittype &data,uintb f,uintb l) {
void initialize(const inittype &data,uintb f,uintb l) {
first = f; last = l; position = data.position; entry = data.entry; } ///< Initialize the range first = f; last = l; position = data.position; entry = data.entry; } ///< Initialize the range
uintb getFirst(void) const { return first; } ///< Get the first address in the range uintb getFirst(void) const { return first; } ///< Get the first address in the range
uintb getLast(void) const { return last; } ///< Get the last address in the range uintb getLast(void) const { return last; } ///< Get the last address in the range
@ -981,6 +980,8 @@ class ParameterBasic : public ProtoParameter {
public: public:
ParameterBasic(const string &nm,const Address &ad,Datatype *tp,uint4 fl) { ParameterBasic(const string &nm,const Address &ad,Datatype *tp,uint4 fl) {
name = nm; addr = ad; type = tp; flags=fl; } ///< Construct from components name = nm; addr = ad; type = tp; flags=fl; } ///< Construct from components
ParameterBasic(Datatype *tp) {
type = tp; flags = 0; } ///< Construct a \e void parameter
virtual const string &getName(void) const { return name; } virtual const string &getName(void) const { return name; }
virtual Datatype *getType(void) const { return type; } virtual Datatype *getType(void) const { return type; }
virtual Address getAddress(void) const { return addr; } virtual Address getAddress(void) const { return addr; }

View file

@ -97,7 +97,7 @@ void ContextDatabase::restoreTracked(const Element *el,const AddrSpaceManager *m
while(iter != list.end()) { while(iter != list.end()) {
const Element *subel = *iter; const Element *subel = *iter;
vec.push_back(TrackedContext()); vec.emplace_back();
vec.back().restoreXml(subel,manage); vec.back().restoreXml(subel,manage);
++iter; ++iter;
} }

View file

@ -811,7 +811,7 @@ void Heritage::generateLoadGuard(StackNode &node,PcodeOp *op,AddrSpace *spc)
{ {
if (!op->usesSpacebasePtr()) { if (!op->usesSpacebasePtr()) {
loadGuard.push_back(LoadGuard()); loadGuard.emplace_back();
loadGuard.back().set(op,spc,node.offset); loadGuard.back().set(op,spc,node.offset);
fd->opMarkSpacebasePtr(op); fd->opMarkSpacebasePtr(op);
} }
@ -828,7 +828,7 @@ void Heritage::generateStoreGuard(StackNode &node,PcodeOp *op,AddrSpace *spc)
{ {
if (!op->usesSpacebasePtr()) { if (!op->usesSpacebasePtr()) {
storeGuard.push_back(LoadGuard()); storeGuard.emplace_back();
storeGuard.back().set(op,spc,node.offset); storeGuard.back().set(op,spc,node.offset);
fd->opMarkSpacebasePtr(op); fd->opMarkSpacebasePtr(op);
} }

View file

@ -2345,7 +2345,7 @@ void IfcPreferSplit::execute(istream &s)
s >> dec >> split; s >> dec >> split;
if (split == -1) if (split == -1)
throw IfaceParseError("Bad split offset"); throw IfaceParseError("Bad split offset");
dcp->conf->splitrecords.push_back(PreferSplitRecord()); dcp->conf->splitrecords.emplace_back();
PreferSplitRecord &rec( dcp->conf->splitrecords.back() ); PreferSplitRecord &rec( dcp->conf->splitrecords.back() );
rec.storage.space = addr.getSpace(); rec.storage.space = addr.getSpace();

View file

@ -2660,7 +2660,7 @@ void JumpTable::restoreXml(const Element *el)
missedlabel = true; // No following entries are allowed to have a label attribute missedlabel = true; // No following entries are allowed to have a label attribute
} }
else if (subel->getName() == "loadtable") { else if (subel->getName() == "loadtable") {
loadpoints.push_back(LoadTable()); loadpoints.emplace_back();
loadpoints.back().restoreXml(subel,glb); loadpoints.back().restoreXml(subel,glb);
} }
else if (subel->getName() == "basicoverride") { else if (subel->getName() == "basicoverride") {

View file

@ -123,7 +123,7 @@ void ExecutablePcode::build(void)
icontext.nextaddr = icontext.baseaddr; icontext.nextaddr = icontext.baseaddr;
for(int4 i=0;i<sizeInput();++i) { // Skip the first operand containing the injectid for(int4 i=0;i<sizeInput();++i) { // Skip the first operand containing the injectid
InjectParameter &param( getInput(i) ); InjectParameter &param( getInput(i) );
icontext.inputlist.push_back(VarnodeData()); icontext.inputlist.emplace_back();
icontext.inputlist.back().space = uniqSpace; icontext.inputlist.back().space = uniqSpace;
icontext.inputlist.back().offset = uniqReserve; icontext.inputlist.back().offset = uniqReserve;
icontext.inputlist.back().size = param.getSize(); icontext.inputlist.back().size = param.getSize();
@ -132,7 +132,7 @@ void ExecutablePcode::build(void)
} }
for(int4 i=0;i<sizeOutput();++i) { for(int4 i=0;i<sizeOutput();++i) {
InjectParameter &param( getOutput(i) ); InjectParameter &param( getOutput(i) );
icontext.output.push_back(VarnodeData()); icontext.output.emplace_back();
icontext.output.back().space = uniqSpace; icontext.output.back().space = uniqSpace;
icontext.output.back().offset = uniqReserve; icontext.output.back().offset = uniqReserve;
icontext.output.back().size = param.getSize(); icontext.output.back().size = param.getSize();

View file

@ -1725,7 +1725,7 @@ void PrintC::pushPartialSymbol(const Symbol *sym,int4 off,int4 sz,
const TypeField *field; const TypeField *field;
field = ((TypeStruct *)ct)->getField(off,sz,&off); field = ((TypeStruct *)ct)->getField(off,sz,&off);
if (field != (const TypeField *)0) { if (field != (const TypeField *)0) {
stack.push_back(PartialSymbolEntry()); stack.emplace_back();
PartialSymbolEntry &entry( stack.back() ); PartialSymbolEntry &entry( stack.back() );
entry.token = &object_member; entry.token = &object_member;
entry.field = field; entry.field = field;
@ -1740,7 +1740,7 @@ void PrintC::pushPartialSymbol(const Symbol *sym,int4 off,int4 sz,
int4 el; int4 el;
Datatype *arrayof = ((TypeArray *)ct)->getSubEntry(off,sz,&off,&el); Datatype *arrayof = ((TypeArray *)ct)->getSubEntry(off,sz,&off,&el);
if (arrayof != (Datatype *)0) { if (arrayof != (Datatype *)0) {
stack.push_back(PartialSymbolEntry()); stack.emplace_back();
PartialSymbolEntry &entry( stack.back() ); PartialSymbolEntry &entry( stack.back() );
entry.token = &subscript; entry.token = &subscript;
ostringstream s; ostringstream s;
@ -1761,7 +1761,7 @@ void PrintC::pushPartialSymbol(const Symbol *sym,int4 off,int4 sz,
succeeded = true; succeeded = true;
} }
if (!succeeded) { // Subtype was not good if (!succeeded) { // Subtype was not good
stack.push_back(PartialSymbolEntry()); stack.emplace_back();
PartialSymbolEntry &entry(stack.back()); PartialSymbolEntry &entry(stack.back());
entry.token = &object_member; entry.token = &object_member;
ostringstream s; ostringstream s;

View file

@ -142,7 +142,7 @@ void PrintLanguage::pushOp(const OpToken *tok,const PcodeOp *op)
else else
id = emit->openGroup(); id = emit->openGroup();
} }
revpol.push_back(ReversePolish()); revpol.emplace_back();
revpol.back().tok = tok; revpol.back().tok = tok;
revpol.back().visited = 0; revpol.back().visited = 0;
revpol.back().paren = paren; revpol.back().paren = paren;

View file

@ -28,11 +28,10 @@
/// intervals. I.e. a map from a linear ordered domain to /// intervals. I.e. a map from a linear ordered domain to
/// (multiple) records. /// (multiple) records.
/// The \b recordtype is the main object in the container, it must support: /// The \b recordtype is the main object in the container, it must support:
/// - recordtype() a constructor taking no parameters /// - recordtype(inittype,linetype,linetype) a constructor taking 3 parameters
/// - getFirst() beginning of range /// - getFirst() beginning of range
/// - getLast() end of range (inclusive) /// - getLast() end of range (inclusive)
/// - getSubsort() retrieve the subsorttype object (see below) /// - getSubsort() retrieve the subsorttype object (see below)
/// - initialize(inittype,linetype,linetype) an initializer routine
/// ///
/// The \b recordtype must define data-types: /// The \b recordtype must define data-types:
/// - linetype /// - linetype
@ -231,8 +230,7 @@ rangemap<_recordtype>::insert(const inittype &data,linetype a,linetype b)
unzip(f-1,low); // If so do the refinement unzip(f-1,low); // If so do the refinement
} }
record.push_front( _recordtype() ); record.emplace_front( data, a, b );
record.front().initialize( data, a, b );
liter = record.begin(); liter = record.begin();
AddrRange addrrange(b,(*liter).getSubsort()); AddrRange addrrange(b,(*liter).getSubsort());

View file

@ -1939,7 +1939,7 @@ ValueSet *ValueSetSolver::ValueSetEdge::getNext(void)
void ValueSetSolver::newValueSet(Varnode *vn,int4 tCode) void ValueSetSolver::newValueSet(Varnode *vn,int4 tCode)
{ {
valueNodes.push_back(ValueSet()); valueNodes.emplace_back();
valueNodes.back().setVarnode(vn, tCode); valueNodes.back().setVarnode(vn, tCode);
} }

View file

@ -79,7 +79,7 @@ void PcodeCacher::addLabelRef(VarnodeData *ptr)
{ // Store off a reference to a label and the next instruction { // Store off a reference to a label and the next instruction
// address // address
label_refs.push_back(RelativeRecord()); label_refs.emplace_back();
label_refs.back().dataptr = ptr; label_refs.back().dataptr = ptr;
label_refs.back().calling_index = issued.size(); label_refs.back().calling_index = issued.size();
} }

View file

@ -53,7 +53,7 @@ public:
return expandPool(size); return expandPool(size);
} }
PcodeData *allocateInstruction(void) { PcodeData *allocateInstruction(void) {
issued.push_back(PcodeData()); issued.emplace_back();
PcodeData *res = &issued.back(); PcodeData *res = &issued.back();
res->outvar = (VarnodeData *)0; res->outvar = (VarnodeData *)0;
res->invar = (VarnodeData *)0; res->invar = (VarnodeData *)0;

View file

@ -59,11 +59,11 @@ void LanguageDescription::restoreXml(const Element *el)
if (subel->getName() == "description") if (subel->getName() == "description")
description = subel->getContent(); description = subel->getContent();
else if (subel->getName() == "compiler") { else if (subel->getName() == "compiler") {
compilers.push_back(CompilerTag()); compilers.emplace_back();
compilers.back().restoreXml(subel); compilers.back().restoreXml(subel);
} }
else if (subel->getName() == "truncate_space") { else if (subel->getName() == "truncate_space") {
truncations.push_back(TruncationTag()); truncations.emplace_back();
truncations.back().restoreXml(subel); truncations.back().restoreXml(subel);
} }
} }
@ -113,7 +113,7 @@ void SleighArchitecture::loadLanguageDescription(const string &specfile,ostream
List::const_iterator iter; List::const_iterator iter;
for(iter=list.begin();iter!=list.end();++iter) { for(iter=list.begin();iter!=list.end();++iter) {
if ((*iter)->getName() != "language") continue; if ((*iter)->getName() != "language") continue;
description.push_back(LanguageDescription()); description.emplace_back();
description.back().restoreXml( *iter ); description.back().restoreXml( *iter );
} }
delete doc; delete doc;

View file

@ -227,7 +227,7 @@ void SleighBase::restoreXml(const Element *el)
List::const_iterator iter; List::const_iterator iter;
iter = list.begin(); iter = list.begin();
while((*iter)->getName() == "floatformat") { while((*iter)->getName() == "floatformat") {
floatformats.push_back(FloatFormat()); floatformats.emplace_back();
floatformats.back().restoreXml(*iter); floatformats.back().restoreXml(*iter);
++iter; ++iter;
} }

View file

@ -82,7 +82,7 @@ void SectionVector::append(ConstructTpl *rtl,SymbolScope *scope)
{ {
while(named.size() <= nextindex) while(named.size() <= nextindex)
named.push_back(RtlPair()); named.emplace_back();
named[ nextindex ] = RtlPair(rtl,scope); named[ nextindex ] = RtlPair(rtl,scope);
} }
@ -2700,7 +2700,7 @@ void SleighCompile::checkUniqueAllocation(void)
void SleighCompile::pushWith(SubtableSymbol *ss,PatternEquation *pateq,vector<ContextChange *> *contvec) void SleighCompile::pushWith(SubtableSymbol *ss,PatternEquation *pateq,vector<ContextChange *> *contvec)
{ {
withstack.push_back(WithBlock()); withstack.emplace_back();
withstack.back().set(ss,pateq,contvec); withstack.back().set(ss,pateq,contvec);
} }

View file

@ -1803,7 +1803,7 @@ TokenPattern *Constructor::buildPattern(ostream &s)
} }
// We should also check that recursion is rightmost extreme // We should also check that recursion is rightmost extreme
recursion = true; recursion = true;
oppattern.push_back(TokenPattern()); oppattern.emplace_back();
} }
else else
oppattern.push_back(*subsym->buildPattern(s)); oppattern.push_back(*subsym->buildPattern(s));

View file

@ -546,7 +546,7 @@ uintb JoinSpace::restoreXmlAttributes(const Element *el,uint4 &size) const
} }
int4 pos = (int4)(attrName[5] - '1'); int4 pos = (int4)(attrName[5] - '1');
while(pieces.size() <= pos) while(pieces.size() <= pos)
pieces.push_back(VarnodeData()); pieces.emplace_back();
VarnodeData &vdat( pieces[pos] ); VarnodeData &vdat( pieces[pos] );
string attrVal = el->getAttributeValue(i); string attrVal = el->getAttributeValue(i);
@ -604,7 +604,7 @@ uintb JoinSpace::read(const string &s,int4 &size) const
int4 szsum = 0; int4 szsum = 0;
int4 i=0; int4 i=0;
while(i < s.size()) { while(i < s.size()) {
pieces.push_back(VarnodeData()); // Prepare to read next VarnodeData pieces.emplace_back(); // Prepare to read next VarnodeData
string token; string token;
while((i<s.size())&&(s[i]!=',')) { while((i<s.size())&&(s[i]!=',')) {
token += s[i]; token += s[i];

View file

@ -158,7 +158,7 @@ SubvariableFlow::ReplaceOp *SubvariableFlow::createOp(OpCode opc,int4 numparam,R
{ {
if (outrvn->def != (ReplaceOp *)0) if (outrvn->def != (ReplaceOp *)0)
return outrvn->def; return outrvn->def;
oplist.push_back(ReplaceOp()); oplist.emplace_back();
ReplaceOp *rop = &oplist.back(); ReplaceOp *rop = &oplist.back();
outrvn->def = rop; outrvn->def = rop;
rop->op = outrvn->vn->getDef(); rop->op = outrvn->vn->getDef();
@ -181,7 +181,7 @@ SubvariableFlow::ReplaceOp *SubvariableFlow::createOp(OpCode opc,int4 numparam,R
SubvariableFlow::ReplaceOp *SubvariableFlow::createOpDown(OpCode opc,int4 numparam,PcodeOp *op,ReplaceVarnode *inrvn,int4 slot) SubvariableFlow::ReplaceOp *SubvariableFlow::createOpDown(OpCode opc,int4 numparam,PcodeOp *op,ReplaceVarnode *inrvn,int4 slot)
{ {
oplist.push_back(ReplaceOp()); oplist.emplace_back();
ReplaceOp *rop = &oplist.back(); ReplaceOp *rop = &oplist.back();
rop->op = op; rop->op = op;
rop->opc = opc; rop->opc = opc;
@ -215,7 +215,7 @@ bool SubvariableFlow::tryCallPull(PcodeOp *op,ReplaceVarnode *rvn,int4 slot)
if (fc->isInputActive()) return false; // Don't trim while in the middle of figuring out params if (fc->isInputActive()) return false; // Don't trim while in the middle of figuring out params
if (fc->isInputLocked() && (!fc->isDotdotdot())) return false; if (fc->isInputLocked() && (!fc->isDotdotdot())) return false;
patchlist.push_back(PatchRecord()); patchlist.emplace_back();
patchlist.back().type = PatchRecord::parameter_patch; patchlist.back().type = PatchRecord::parameter_patch;
patchlist.back().patchOp = op; patchlist.back().patchOp = op;
patchlist.back().in1 = rvn; patchlist.back().in1 = rvn;
@ -261,7 +261,7 @@ bool SubvariableFlow::tryReturnPull(PcodeOp *op,ReplaceVarnode *rvn,int4 slot)
worklist.push_back(rep); worklist.push_back(rep);
else if (retvn->isConstant() && retop != op) { else if (retvn->isConstant() && retop != op) {
// Trace won't revisit this RETURN, so we need to generate patch now // Trace won't revisit this RETURN, so we need to generate patch now
patchlist.push_back(PatchRecord()); patchlist.emplace_back();
patchlist.back().type = PatchRecord::parameter_patch; patchlist.back().type = PatchRecord::parameter_patch;
patchlist.back().patchOp = retop; patchlist.back().patchOp = retop;
patchlist.back().in1 = rep; patchlist.back().in1 = rep;
@ -271,7 +271,7 @@ bool SubvariableFlow::tryReturnPull(PcodeOp *op,ReplaceVarnode *rvn,int4 slot)
} }
returnsTraversed = true; returnsTraversed = true;
} }
patchlist.push_back(PatchRecord()); patchlist.emplace_back();
patchlist.back().type = PatchRecord::parameter_patch; patchlist.back().type = PatchRecord::parameter_patch;
patchlist.back().patchOp = op; patchlist.back().patchOp = op;
patchlist.back().in1 = rvn; patchlist.back().in1 = rvn;
@ -319,7 +319,7 @@ bool SubvariableFlow::trySwitchPull(PcodeOp *op,ReplaceVarnode *rvn)
if ((rvn->mask & 1) == 0) return false; // Logical value must be justified if ((rvn->mask & 1) == 0) return false; // Logical value must be justified
if ((rvn->vn->getConsume()&~rvn->mask)!=0) // If there's something outside the mask being consumed if ((rvn->vn->getConsume()&~rvn->mask)!=0) // If there's something outside the mask being consumed
return false; // we can't trim return false; // we can't trim
patchlist.push_back(PatchRecord()); patchlist.emplace_back();
patchlist.back().type = PatchRecord::parameter_patch; patchlist.back().type = PatchRecord::parameter_patch;
patchlist.back().patchOp = op; patchlist.back().patchOp = op;
patchlist.back().in1 = rvn; patchlist.back().in1 = rvn;
@ -1001,7 +1001,7 @@ bool SubvariableFlow::createCompareBridge(PcodeOp *op,ReplaceVarnode *inrvn,int4
SubvariableFlow::ReplaceVarnode *SubvariableFlow::addConstant(ReplaceOp *rop,uintb mask, SubvariableFlow::ReplaceVarnode *SubvariableFlow::addConstant(ReplaceOp *rop,uintb mask,
uint4 slot,uintb val) uint4 slot,uintb val)
{ // Add a constant to the replacement tree { // Add a constant to the replacement tree
newvarlist.push_back(ReplaceVarnode()); newvarlist.emplace_back();
ReplaceVarnode *res = &newvarlist.back(); ReplaceVarnode *res = &newvarlist.back();
res->vn = (Varnode *)0; res->vn = (Varnode *)0;
res->replacement = (Varnode *)0; res->replacement = (Varnode *)0;
@ -1028,7 +1028,7 @@ SubvariableFlow::ReplaceVarnode *SubvariableFlow::addConstant(ReplaceOp *rop,uin
void SubvariableFlow::createNewOut(ReplaceOp *rop,uintb mask) void SubvariableFlow::createNewOut(ReplaceOp *rop,uintb mask)
{ {
newvarlist.push_back(ReplaceVarnode()); newvarlist.emplace_back();
ReplaceVarnode *res = &newvarlist.back(); ReplaceVarnode *res = &newvarlist.back();
res->vn = (Varnode *)0; res->vn = (Varnode *)0;
res->replacement = (Varnode *)0; res->replacement = (Varnode *)0;
@ -1063,7 +1063,7 @@ void SubvariableFlow::addPush(PcodeOp *pushOp,ReplaceVarnode *rvn)
void SubvariableFlow::addTerminalPatch(PcodeOp *pullop,ReplaceVarnode *rvn) void SubvariableFlow::addTerminalPatch(PcodeOp *pullop,ReplaceVarnode *rvn)
{ {
patchlist.push_back(PatchRecord()); patchlist.emplace_back();
patchlist.back().type = PatchRecord::copy_patch; // Ultimately gets converted to a COPY patchlist.back().type = PatchRecord::copy_patch; // Ultimately gets converted to a COPY
patchlist.back().patchOp = pullop; // Operation pulling the variable out patchlist.back().patchOp = pullop; // Operation pulling the variable out
patchlist.back().in1 = rvn; // Point in container flow for pull patchlist.back().in1 = rvn; // Point in container flow for pull
@ -1081,7 +1081,7 @@ void SubvariableFlow::addTerminalPatch(PcodeOp *pullop,ReplaceVarnode *rvn)
void SubvariableFlow::addTerminalPatchSameOp(PcodeOp *pullop,ReplaceVarnode *rvn,int4 slot) void SubvariableFlow::addTerminalPatchSameOp(PcodeOp *pullop,ReplaceVarnode *rvn,int4 slot)
{ {
patchlist.push_back(PatchRecord()); patchlist.emplace_back();
patchlist.back().type = PatchRecord::parameter_patch; // Keep the original op, just change input patchlist.back().type = PatchRecord::parameter_patch; // Keep the original op, just change input
patchlist.back().patchOp = pullop; // Operation pulling the variable out patchlist.back().patchOp = pullop; // Operation pulling the variable out
patchlist.back().in1 = rvn; // Point in container flow for pull patchlist.back().in1 = rvn; // Point in container flow for pull
@ -1099,7 +1099,7 @@ void SubvariableFlow::addTerminalPatchSameOp(PcodeOp *pullop,ReplaceVarnode *rvn
void SubvariableFlow::addBooleanPatch(PcodeOp *pullop,ReplaceVarnode *rvn,int4 slot) void SubvariableFlow::addBooleanPatch(PcodeOp *pullop,ReplaceVarnode *rvn,int4 slot)
{ {
patchlist.push_back(PatchRecord()); patchlist.emplace_back();
patchlist.back().type = PatchRecord::parameter_patch; // Make no change to the operator, just put in the new input patchlist.back().type = PatchRecord::parameter_patch; // Make no change to the operator, just put in the new input
patchlist.back().patchOp = pullop; // Operation pulling the variable out patchlist.back().patchOp = pullop; // Operation pulling the variable out
patchlist.back().in1 = rvn; // Point in container flow for pull patchlist.back().in1 = rvn; // Point in container flow for pull
@ -1117,7 +1117,7 @@ void SubvariableFlow::addBooleanPatch(PcodeOp *pullop,ReplaceVarnode *rvn,int4 s
void SubvariableFlow::addSuggestedPatch(ReplaceVarnode *rvn,PcodeOp *pushop,int4 sa) void SubvariableFlow::addSuggestedPatch(ReplaceVarnode *rvn,PcodeOp *pushop,int4 sa)
{ {
patchlist.push_back(PatchRecord()); patchlist.emplace_back();
patchlist.back().type = PatchRecord::extension_patch; patchlist.back().type = PatchRecord::extension_patch;
patchlist.back().in1 = rvn; patchlist.back().in1 = rvn;
patchlist.back().patchOp = pushop; patchlist.back().patchOp = pushop;
@ -1137,7 +1137,7 @@ void SubvariableFlow::addSuggestedPatch(ReplaceVarnode *rvn,PcodeOp *pushop,int4
void SubvariableFlow::addComparePatch(ReplaceVarnode *in1,ReplaceVarnode *in2,PcodeOp *op) void SubvariableFlow::addComparePatch(ReplaceVarnode *in1,ReplaceVarnode *in2,PcodeOp *op)
{ {
patchlist.push_back(PatchRecord()); patchlist.emplace_back();
patchlist.back().type = PatchRecord::compare_patch; patchlist.back().type = PatchRecord::compare_patch;
patchlist.back().patchOp = op; patchlist.back().patchOp = op;
patchlist.back().in1 = in1; patchlist.back().in1 = in1;
@ -2020,7 +2020,7 @@ TransformVar *LaneDivide::setReplacement(Varnode *vn,int4 numLanes,int4 skipLane
vn->setMark(); vn->setMark();
TransformVar *res = newSplit(vn, description, numLanes, skipLanes); TransformVar *res = newSplit(vn, description, numLanes, skipLanes);
if (!vn->isFree()) { if (!vn->isFree()) {
workList.push_back(WorkNode()); workList.emplace_back();
workList.back().lanes = res; workList.back().lanes = res;
workList.back().numLanes = numLanes; workList.back().numLanes = numLanes;
workList.back().skipLanes = skipLanes; workList.back().skipLanes = skipLanes;

View file

@ -380,7 +380,7 @@ TransformVar *TransformManager::newPreexistingVarnode(Varnode *vn)
TransformVar *TransformManager::newUnique(int4 size) TransformVar *TransformManager::newUnique(int4 size)
{ {
newVarnodes.push_back(TransformVar()); newVarnodes.emplace_back();
TransformVar *res = &newVarnodes.back(); TransformVar *res = &newVarnodes.back();
res->initialize(TransformVar::normal_temp,(Varnode *)0,size*8,size,0); res->initialize(TransformVar::normal_temp,(Varnode *)0,size*8,size,0);
return res; return res;
@ -395,7 +395,7 @@ TransformVar *TransformManager::newUnique(int4 size)
TransformVar *TransformManager::newConstant(int4 size,int4 lsbOffset,uintb val) TransformVar *TransformManager::newConstant(int4 size,int4 lsbOffset,uintb val)
{ {
newVarnodes.push_back(TransformVar()); newVarnodes.emplace_back();
TransformVar *res = &newVarnodes.back(); TransformVar *res = &newVarnodes.back();
res->initialize(TransformVar::constant,(Varnode *)0,size*8,size,(val >> lsbOffset) & calc_mask(size)); res->initialize(TransformVar::constant,(Varnode *)0,size*8,size,(val >> lsbOffset) & calc_mask(size));
return res; return res;
@ -407,7 +407,7 @@ TransformVar *TransformManager::newConstant(int4 size,int4 lsbOffset,uintb val)
TransformVar *TransformManager::newIop(Varnode *vn) TransformVar *TransformManager::newIop(Varnode *vn)
{ {
newVarnodes.push_back(TransformVar()); newVarnodes.emplace_back();
TransformVar *res = &newVarnodes.back(); TransformVar *res = &newVarnodes.back();
res->initialize(TransformVar::constant_iop,(Varnode *)0,vn->getSize()*8,vn->getSize(),vn->getOffset()); res->initialize(TransformVar::constant_iop,(Varnode *)0,vn->getSize()*8,vn->getSize(),vn->getOffset());
return res; return res;
@ -499,7 +499,7 @@ TransformVar *TransformManager::newSplit(Varnode *vn,const LaneDescription &desc
TransformOp *TransformManager::newOpReplace(int4 numParams,OpCode opc,PcodeOp *replace) TransformOp *TransformManager::newOpReplace(int4 numParams,OpCode opc,PcodeOp *replace)
{ {
newOps.push_back(TransformOp()); newOps.emplace_back();
TransformOp &rop(newOps.back()); TransformOp &rop(newOps.back());
rop.op = replace; rop.op = replace;
rop.replacement = (PcodeOp *)0; rop.replacement = (PcodeOp *)0;
@ -522,7 +522,7 @@ TransformOp *TransformManager::newOpReplace(int4 numParams,OpCode opc,PcodeOp *r
TransformOp *TransformManager::newOp(int4 numParams,OpCode opc,TransformOp *follow) TransformOp *TransformManager::newOp(int4 numParams,OpCode opc,TransformOp *follow)
{ {
newOps.push_back(TransformOp()); newOps.emplace_back();
TransformOp &rop(newOps.back()); TransformOp &rop(newOps.back());
rop.op = follow->op; rop.op = follow->op;
rop.replacement = (PcodeOp *)0; rop.replacement = (PcodeOp *)0;
@ -546,7 +546,7 @@ TransformOp *TransformManager::newOp(int4 numParams,OpCode opc,TransformOp *foll
TransformOp *TransformManager::newPreexistingOp(int4 numParams,OpCode opc,PcodeOp *originalOp) TransformOp *TransformManager::newPreexistingOp(int4 numParams,OpCode opc,PcodeOp *originalOp)
{ {
newOps.push_back(TransformOp()); newOps.emplace_back();
TransformOp &rop(newOps.back()); TransformOp &rop(newOps.back());
rop.op = originalOp; rop.op = originalOp;
rop.replacement = (PcodeOp *)0; rop.replacement = (PcodeOp *)0;

View file

@ -738,7 +738,7 @@ Address AddrSpaceManager::constructFloatExtensionAddress(const Address &realaddr
if (logicalsize == realsize) if (logicalsize == realsize)
return realaddr; return realaddr;
vector<VarnodeData> pieces; vector<VarnodeData> pieces;
pieces.push_back(VarnodeData()); pieces.emplace_back();
pieces.back().space = realaddr.getSpace(); pieces.back().space = realaddr.getSpace();
pieces.back().offset = realaddr.getOffset(); pieces.back().offset = realaddr.getOffset();
pieces.back().size = realsize; pieces.back().size = realsize;
@ -790,8 +790,8 @@ Address AddrSpaceManager::constructJoinAddress(const Translate *translate,
} }
// Otherwise construct a formal JoinRecord // Otherwise construct a formal JoinRecord
vector<VarnodeData> pieces; vector<VarnodeData> pieces;
pieces.push_back(VarnodeData()); pieces.emplace_back();
pieces.push_back(VarnodeData()); pieces.emplace_back();
pieces[0].space = hiaddr.getSpace(); pieces[0].space = hiaddr.getSpace();
pieces[0].offset = hiaddr.getOffset(); pieces[0].offset = hiaddr.getOffset();
pieces[0].size = hisz; pieces[0].size = hisz;

View file

@ -1342,15 +1342,15 @@ void ScopeLocal::addRecommendName(Symbol *sym)
SymbolEntry *entry = sym->getFirstWholeMap(); SymbolEntry *entry = sym->getFirstWholeMap();
if (entry == (SymbolEntry *) 0) return; if (entry == (SymbolEntry *) 0) return;
if (entry->isDynamic()) { if (entry->isDynamic()) {
dynRecommend.push_back(DynamicRecommend(entry->getFirstUseAddress(), entry->getHash(), sym->getName(), sym->getId())); dynRecommend.emplace_back(entry->getFirstUseAddress(), entry->getHash(), sym->getName(), sym->getId());
} }
else { else {
Address usepoint; Address usepoint((AddrSpace *)0,0);
if (!entry->getUseLimit().empty()) { if (!entry->getUseLimit().empty()) {
const Range *range = entry->getUseLimit().getFirstRange(); const Range *range = entry->getUseLimit().getFirstRange();
usepoint = Address(range->getSpace(), range->getFirst()); usepoint = Address(range->getSpace(), range->getFirst());
} }
nameRecommend.push_back(NameRecommend(entry->getAddr(),usepoint, entry->getSize(), sym->getName(), sym->getId())); nameRecommend.emplace_back(entry->getAddr(),usepoint, entry->getSize(), sym->getName(), sym->getId());
} }
if (sym->getCategory() < 0) if (sym->getCategory() < 0)
removeSymbol(sym); removeSymbol(sym);