Skip to content

Ghidra is a software reverse engineering (SRE) framework

using emplace

caheckman5f715d73e330
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/architecture.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/architecture.cc
index 3967e6a4d7..26a28a52fe 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/architecture.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/architecture.cc
@@ -1066,7 +1066,7 @@ void Architecture::parsePreferSplit(const Element *el)
List::const_iterator iter;
for(iter=list.begin();iter!=list.end();++iter) {
- splitrecords.push_back(PreferSplitRecord());
+ splitrecords.emplace_back();
PreferSplitRecord &record( splitrecords.back() );
record.storage.restoreXml( *iter, this );
record.splitoffset = record.storage.size/2;
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/block.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/block.cc
index e8b4954e7e..7cab29691e 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/block.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/block.cc
@@ -73,11 +73,11 @@ void FlowBlock::addInEdge(FlowBlock *b,uint4 lab)
void FlowBlock::restoreNextInEdge(const Element *el,BlockMap &resolver)
{
- intothis.push_back(BlockEdge());
+ intothis.emplace_back();
BlockEdge &inedge(intothis.back());
inedge.restoreXml(el,resolver);
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]);
outedge.label = 0;
outedge.point = this;
@@ -3271,7 +3271,7 @@ BlockSwitch::BlockSwitch(FlowBlock *ind)
void BlockSwitch::addCase(FlowBlock *switchbl,FlowBlock *bl,uint4 gt)
{
- caseblocks.push_back(CaseOrder());
+ caseblocks.emplace_back();
CaseOrder &curcase( caseblocks.back() );
const FlowBlock *basicbl = bl->getFrontLeaf()->subBlock(0);
curcase.block = bl;
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/blockaction.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/blockaction.cc
index c5c8bc9a5a..80265a458f 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/blockaction.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/blockaction.cc
@@ -729,7 +729,7 @@ TraceDAG::BlockTrace *TraceDAG::selectBadEdge(void)
if ((*aiter)->isTerminal()) continue;
if (((*aiter)->top->top == (FlowBlock *)0)&&((*aiter)->bottom==(FlowBlock *)0))
continue; // Never remove virtual edges
- badedgelist.push_back(BadEdgeScore());
+ badedgelist.emplace_back();
BadEdgeScore &score( badedgelist.back() );
score.trace = *aiter;
score.exitproto = score.trace->destnode;
@@ -1125,7 +1125,7 @@ void CollapseStructure::labelLoops(vector<LoopBody *> &looporder)
for(int4 j=0;j<sizein;++j) {
if (bl->isBackEdgeIn(j)) { // back-edge coming in must be from the bottom of a loop
FlowBlock *loopbottom = bl->getIn(j);
- loopbody.push_back(LoopBody(bl));
+ loopbody.emplace_back(bl);
LoopBody &curbody( loopbody.back() );
curbody.addTail(loopbottom);
looporder.push_back( & curbody );
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/callgraph.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/callgraph.cc
index 240943d121..24524e79a3 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/callgraph.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/callgraph.cc
@@ -193,7 +193,7 @@ void CallGraph::clearMarks(void)
CallGraphEdge &CallGraph::insertBlankEdge(CallGraphNode *node,int4 slot)
{
- node->outedge.push_back(CallGraphEdge());
+ node->outedge.emplace_back();
if (node->outedge.size() > 1) {
for(int4 i=node->outedge.size()-2;i>=slot;--i) {
int4 newi = i+1;
@@ -255,7 +255,7 @@ void CallGraph::addEdge(CallGraphNode *from,CallGraphNode *to,const Address &add
CallGraphEdge &fromedge( insertBlankEdge(from,i) );
int4 toi = to->inedge.size();
- to->inedge.push_back(CallGraphEdge());
+ to->inedge.emplace_back();
CallGraphEdge &toedge( to->inedge.back() );
fromedge.from = from;
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/codedata.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/codedata.cc
index 20c38cbff8..92690f4220 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/codedata.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/codedata.cc
@@ -282,7 +282,7 @@ Address CodeDataAnalysis::disassembleBlock(const Address &addr,const Address &en
}
for(;;) {
disengine.disassemble(curaddr,disresult);
- codevec.push_back(CodeUnit());
+ codevec.emplace_back();
if (!disresult.success) {
codevec.back().flags = CodeUnit::notcode;
codevec.back().size = 1;
@@ -428,16 +428,16 @@ void CodeDataAnalysis::markCrossHits(void)
void CodeDataAnalysis::addTargetHit(const Address &codeaddr,uintb targethit)
{
- targethits.push_back(TargetHit());
- targethits.back().funcstart = findFunctionStart( codeaddr );
- targethits.back().codeaddr = codeaddr;
- targethits.back().thunkaddr = Address(glb->translate->getDefaultCodeSpace(),targethit);
+ Address funcstart = findFunctionStart( codeaddr );
+ Address thunkaddr = Address(glb->translate->getDefaultCodeSpace(),targethit);
+ uint4 mask;
map<Address,TargetFeature>::const_iterator titer;
- titer = targets.find( targethits.back().thunkaddr );
+ titer = targets.find( thunkaddr );
if (titer != targets.end())
- targethits.back().mask = (*titer).second.featuremask;
+ mask = (*titer).second.featuremask;
else
throw LowlevelError("Found thunk without a feature mask");
+ targethits.emplace_back(funcstart,codeaddr,thunkaddr,mask);
}
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
disengine.disassemble(curaddr,disresult);
if (!disresult.success) return false;
- codevec.push_back(CodeUnit());
+ codevec.emplace_back();
if ((disresult.flags & CodeUnit::jump)!=0) {
fromto_vec[ AddrLink(curaddr,disresult.jumpaddress) ] = disresult.flags;
}
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/codedata.hh b/Ghidra/Features/Decompiler/src/decompile/cpp/codedata.hh
index 07cc684759..3b5a4b031a 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/codedata.hh
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/codedata.hh
@@ -77,6 +77,8 @@ public:
Address codeaddr; // Address of instruction refering to target call
Address thunkaddr; // The target call
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); }
};
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/context.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/context.cc
index 920568a46f..d1acbb1649 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/context.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/context.cc
@@ -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)
{
- contextcommit.push_back(ContextSet());
+ contextcommit.emplace_back();
ContextSet &set(contextcommit.back());
set.sym = sym;
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/coreaction.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/coreaction.cc
index d90f8a07c5..6fb1aa38ed 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/coreaction.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/coreaction.cc
@@ -4532,7 +4532,7 @@ void ActionInferTypes::propagateOneType(TypeFactory *typegrp,Varnode *vn)
PropagationState *ptr;
vector<PropagationState> state;
- state.push_back(PropagationState(vn));
+ state.emplace_back(vn);
vn->setMark();
while(!state.empty()) {
@@ -4545,7 +4545,7 @@ void ActionInferTypes::propagateOneType(TypeFactory *typegrp,Varnode *vn)
if (propagateTypeEdge(typegrp,ptr->op,ptr->inslot,ptr->slot)) {
vn = (ptr->slot==-1) ? ptr->op->getOut() : ptr->op->getIn(ptr->slot);
ptr->step(); // Make sure to step before push_back
- state.push_back(PropagationState(vn));
+ state.emplace_back(vn);
vn->setMark();
}
else
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/cpool.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/cpool.cc
index 7d6e899b16..1cb4617ede 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/cpool.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/cpool.cc
@@ -193,7 +193,7 @@ CPoolRecord *ConstantPoolInternal::createRecord(const vector<uintb> &refs)
{
CheapSorter sorter(refs);
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)
throw LowlevelError("Creating duplicate entry in constant pool: "+(*res.first).second.getToken());
return &(*res.first).second;
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/database.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/database.cc
index b7e8430b87..e0068dceb2 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/database.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/database.cc
@@ -53,12 +53,11 @@ SymbolEntry::SymbolEntry(Symbol *sym,uint4 exfl,uint8 h,int4 off,int4 sz,const R
uselimit = rnglist;
}
-/// Assuming the boundary offsets have been specified with
-/// the constructor, fill in the rest of the data.
+/// Establish the boundary offsets and fill in additional data
/// \param data contains the raw initialization data
/// \param a is the starting 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);
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/database.hh b/Ghidra/Features/Decompiler/src/decompile/cpp/database.hh
index 51d3670536..e254246b52 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/database.hh
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/database.hh
@@ -112,7 +112,7 @@ public:
typedef EntrySubsort subsorttype; ///< The sub-sort object for 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
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
@@ -122,7 +122,6 @@ public:
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
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
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
@@ -819,13 +818,12 @@ private:
Address first; ///< The first address of the range
Address last; ///< The last address of the range
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 getLast(void) const { return last; } ///< Get the last address in the range
NullSubsort getSubsort(void) const { return NullSubsort(); } ///< Get the sub-subsort object
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
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/flow.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/flow.cc
index 62172e6728..9421da8c96 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/flow.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/flow.cc
@@ -1203,14 +1203,14 @@ void FlowInfo::injectUserOp(PcodeOp *op)
icontext.nextaddr = icontext.baseaddr;
for(int4 i=1;i<op->numInput();++i) { // Skip the first operand containing the injectid
Varnode *vn = op->getIn(i);
- icontext.inputlist.push_back(VarnodeData());
+ icontext.inputlist.emplace_back();
icontext.inputlist.back().space = vn->getSpace();
icontext.inputlist.back().offset = vn->getOffset();
icontext.inputlist.back().size = vn->getSize();
}
Varnode *outvn = op->getOut();
if (outvn != (Varnode *)0) {
- icontext.output.push_back(VarnodeData());
+ icontext.output.emplace_back();
icontext.output.back().space = outvn->getSpace();
icontext.output.back().offset = outvn->getOffset();
icontext.output.back().size = outvn->getSize();
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/fspec.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/fspec.cc
index 42adedf4ba..bb40b24eef 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/fspec.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/fspec.cc
@@ -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());
}
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
// Assume datatype is stored elsewhere and only the pointer is passed
AddrSpace *spc = spacebase;
@@ -567,7 +567,7 @@ void ParamListStandard::assignMap(const vector<Datatype *> &proto,bool isinput,T
}
}
else {
- res.push_back(ParameterPieces());
+ res.emplace_back();
if (proto[0]->getMetatype() != TYPE_VOID) {
res.back().addr = assignAddress(proto[0],status);
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) {
const Element *subel = *fiter;
if (subel->getName() == "pentry") {
- entry.push_back(ParamEntry(numgroup));
+ entry.emplace_back(numgroup);
entry.back().restoreXml(subel,manage,normalstack);
if (entry.back().getType()==TYPE_FLOAT) {
if (nonfloatgroup >= 0)
@@ -1089,7 +1089,7 @@ void ParamListStandardOut::assignMap(const vector<Datatype *> &proto,bool isinpu
vector<int4> status(numgroup,0);
// This is always an output list so we ignore -isinput-
- res.push_back(ParameterPieces());
+ res.emplace_back();
res.back().type = proto[0];
res.back().flags = 0;
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().flags = ParameterPieces::indirectstorage;
- res.push_back(ParameterPieces()); // 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.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
// leave its address invalid, to be filled in by the input list assignMap
res.back().flags = ParameterPieces::hiddenretparm; // Mark it as special
}
@@ -1851,7 +1851,7 @@ void ProtoModel::assignParameterStorage(const vector<Datatype *> &typelist,vecto
}
catch(ParamUnassignedError &err) {
res.clear();
- res.push_back(ParameterPieces());
+ res.emplace_back();
// leave address undefined
res.back().flags = 0;
res.back().type = glb->types->getTypeVoid();
@@ -1984,7 +1984,7 @@ void ProtoModel::restoreXml(const Element *el)
const List &flist(subnode->getChildren());
List::const_iterator fiter;
for(fiter=flist.begin();fiter!=flist.end();++fiter) {
- effectlist.push_back(EffectRecord());
+ effectlist.emplace_back();
effectlist.back().restoreXml(EffectRecord::unaffected,*fiter,glb);
}
}
@@ -1992,7 +1992,7 @@ void ProtoModel::restoreXml(const Element *el)
const List &flist(subnode->getChildren());
List::const_iterator fiter;
for(fiter=flist.begin();fiter!=flist.end();++fiter) {
- effectlist.push_back(EffectRecord());
+ effectlist.emplace_back();
effectlist.back().restoreXml(EffectRecord::killedbycall,*fiter,glb);
}
}
@@ -2000,7 +2000,7 @@ void ProtoModel::restoreXml(const Element *el)
const List &flist(subnode->getChildren());
List::const_iterator fiter;
for(fiter=flist.begin();fiter!=flist.end();++fiter) {
- effectlist.push_back(EffectRecord());
+ effectlist.emplace_back();
effectlist.back().restoreXml(EffectRecord::return_address,*fiter,glb);
}
sawretaddr = true;
@@ -2029,7 +2029,7 @@ void ProtoModel::restoreXml(const Element *el)
const List &flist(subnode->getChildren());
List::const_iterator fiter;
for(fiter=flist.begin();fiter!=flist.end();++fiter) {
- likelytrash.push_back(VarnodeData());
+ likelytrash.emplace_back();
likelytrash.back().restoreXml(*fiter,glb);
}
}
@@ -2088,7 +2088,7 @@ void ScoreProtoModel::addParameter(const Address &addr,int4 sz)
else
isparam = model->possibleOutputParamWithSlot(addr,sz,slot,slotsize);
if (isparam) {
- entry.push_back(PEntry());
+ entry.emplace_back();
entry.back().origIndex = orig;
entry.back().slot = slot;
entry.back().size = slotsize;
@@ -2731,7 +2731,7 @@ void ProtoStoreInternal::clearOutput(void)
{
if (outparam != (ProtoParameter *)0)
delete outparam;
- outparam = new ParameterBasic("",Address(),voidtype,0);
+ outparam = new ParameterBasic(voidtype);
}
ProtoParameter *ProtoStoreInternal::getOutput(void)
@@ -2852,7 +2852,7 @@ void ProtoStoreInternal::restoreXml(const Element *el,ProtoModel *model)
}
if ((flags & ParameterPieces::hiddenretparm) == 0)
namelist.push_back(name);
- pieces.push_back(ParameterPieces());
+ pieces.emplace_back();
ParameterPieces &curparam( pieces.back() );
const List &sublist(subel->getChildren());
List::const_iterator subiter;
@@ -3963,7 +3963,7 @@ void FuncProto::restoreXml(const Element *el,Architecture *glb)
const List &list2((*iter)->getChildren());
List::const_iterator iter2 = list2.begin();
while(iter2 != list2.end()) {
- effectlist.push_back(EffectRecord());
+ effectlist.emplace_back();
effectlist.back().restoreXml(EffectRecord::unaffected,*iter2,glb);
++iter2;
}
@@ -3972,7 +3972,7 @@ void FuncProto::restoreXml(const Element *el,Architecture *glb)
const List &list2((*iter)->getChildren());
List::const_iterator iter2 = list2.begin();
while(iter2 != list2.end()) {
- effectlist.push_back(EffectRecord());
+ effectlist.emplace_back();
effectlist.back().restoreXml(EffectRecord::killedbycall,*iter2,glb);
++iter2;
}
@@ -3981,7 +3981,7 @@ void FuncProto::restoreXml(const Element *el,Architecture *glb)
const List &list2((*iter)->getChildren());
List::const_iterator iter2 = list2.begin();
while(iter2 != list2.end()) {
- effectlist.push_back(EffectRecord());
+ effectlist.emplace_back();
effectlist.back().restoreXml(EffectRecord::return_address,*iter2,glb);
++iter2;
}
@@ -3990,7 +3990,7 @@ void FuncProto::restoreXml(const Element *el,Architecture *glb)
const List &list2((*iter)->getChildren());
List::const_iterator iter2 = list2.begin();
while(iter2 != list2.end()) {
- likelytrash.push_back(VarnodeData());
+ likelytrash.emplace_back();
likelytrash.back().restoreXml(*iter2,glb);
++iter2;
}
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/fspec.hh b/Ghidra/Features/Decompiler/src/decompile/cpp/fspec.hh
index 303c39b373..9a592cb4a2 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/fspec.hh
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/fspec.hh
@@ -130,8 +130,7 @@ public:
typedef SubsortPosition subsorttype; ///< The sub-sort object for a rangemap
typedef InitData inittype; ///< Initialization data for a ScopeMapper
- ParamEntryRange(void) {} ///< Constructor for use with rangemap
- void initialize(const inittype &data,uintb f,uintb l) {
+ ParamEntryRange(const inittype &data,uintb f,uintb l) {
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 getLast(void) const { return last; } ///< Get the last address in the range
@@ -981,6 +980,8 @@ class ParameterBasic : public ProtoParameter {
public:
ParameterBasic(const string &nm,const Address &ad,Datatype *tp,uint4 fl) {
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 Datatype *getType(void) const { return type; }
virtual Address getAddress(void) const { return addr; }
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/globalcontext.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/globalcontext.cc
index 58aa1bf1df..970eed9c33 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/globalcontext.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/globalcontext.cc
@@ -97,7 +97,7 @@ void ContextDatabase::restoreTracked(const Element *el,const AddrSpaceManager *m
while(iter != list.end()) {
const Element *subel = *iter;
- vec.push_back(TrackedContext());
+ vec.emplace_back();
vec.back().restoreXml(subel,manage);
++iter;
}
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/heritage.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/heritage.cc
index f97c663b26..2e2b76494d 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/heritage.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/heritage.cc
@@ -811,7 +811,7 @@ void Heritage::generateLoadGuard(StackNode &node,PcodeOp *op,AddrSpace *spc)
{
if (!op->usesSpacebasePtr()) {
- loadGuard.push_back(LoadGuard());
+ loadGuard.emplace_back();
loadGuard.back().set(op,spc,node.offset);
fd->opMarkSpacebasePtr(op);
}
@@ -828,7 +828,7 @@ void Heritage::generateStoreGuard(StackNode &node,PcodeOp *op,AddrSpace *spc)
{
if (!op->usesSpacebasePtr()) {
- storeGuard.push_back(LoadGuard());
+ storeGuard.emplace_back();
storeGuard.back().set(op,spc,node.offset);
fd->opMarkSpacebasePtr(op);
}
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/ifacedecomp.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/ifacedecomp.cc
index b0b2325e44..389553599e 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/ifacedecomp.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/ifacedecomp.cc
@@ -2345,7 +2345,7 @@ void IfcPreferSplit::execute(istream &s)
s >> dec >> split;
if (split == -1)
throw IfaceParseError("Bad split offset");
- dcp->conf->splitrecords.push_back(PreferSplitRecord());
+ dcp->conf->splitrecords.emplace_back();
PreferSplitRecord &rec( dcp->conf->splitrecords.back() );
rec.storage.space = addr.getSpace();
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/jumptable.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/jumptable.cc
index ccbb667cf7..656d197573 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/jumptable.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/jumptable.cc
@@ -2660,7 +2660,7 @@ void JumpTable::restoreXml(const Element *el)
missedlabel = true; // No following entries are allowed to have a label attribute
}
else if (subel->getName() == "loadtable") {
- loadpoints.push_back(LoadTable());
+ loadpoints.emplace_back();
loadpoints.back().restoreXml(subel,glb);
}
else if (subel->getName() == "basicoverride") {
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/pcodeinject.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/pcodeinject.cc
index 0c6f093913..f8e8d1f928 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/pcodeinject.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/pcodeinject.cc
@@ -123,7 +123,7 @@ void ExecutablePcode::build(void)
icontext.nextaddr = icontext.baseaddr;
for(int4 i=0;i<sizeInput();++i) { // Skip the first operand containing the injectid
InjectParameter &param( getInput(i) );
- icontext.inputlist.push_back(VarnodeData());
+ icontext.inputlist.emplace_back();
icontext.inputlist.back().space = uniqSpace;
icontext.inputlist.back().offset = uniqReserve;
icontext.inputlist.back().size = param.getSize();
@@ -132,7 +132,7 @@ void ExecutablePcode::build(void)
}
for(int4 i=0;i<sizeOutput();++i) {
InjectParameter &param( getOutput(i) );
- icontext.output.push_back(VarnodeData());
+ icontext.output.emplace_back();
icontext.output.back().space = uniqSpace;
icontext.output.back().offset = uniqReserve;
icontext.output.back().size = param.getSize();
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/printc.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/printc.cc
index cad78ea5ee..ccf046a633 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/printc.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/printc.cc
@@ -1725,7 +1725,7 @@ void PrintC::pushPartialSymbol(const Symbol *sym,int4 off,int4 sz,
const TypeField *field;
field = ((TypeStruct *)ct)->getField(off,sz,&off);
if (field != (const TypeField *)0) {
- stack.push_back(PartialSymbolEntry());
+ stack.emplace_back();
PartialSymbolEntry &entry( stack.back() );
entry.token = &object_member;
entry.field = field;
@@ -1740,7 +1740,7 @@ void PrintC::pushPartialSymbol(const Symbol *sym,int4 off,int4 sz,
int4 el;
Datatype *arrayof = ((TypeArray *)ct)->getSubEntry(off,sz,&off,&el);
if (arrayof != (Datatype *)0) {
- stack.push_back(PartialSymbolEntry());
+ stack.emplace_back();
PartialSymbolEntry &entry( stack.back() );
entry.token = &subscript;
ostringstream s;
@@ -1761,7 +1761,7 @@ void PrintC::pushPartialSymbol(const Symbol *sym,int4 off,int4 sz,
succeeded = true;
}
if (!succeeded) { // Subtype was not good
- stack.push_back(PartialSymbolEntry());
+ stack.emplace_back();
PartialSymbolEntry &entry(stack.back());
entry.token = &object_member;
ostringstream s;
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/printlanguage.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/printlanguage.cc
index bb73411e3b..29d95e9258 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/printlanguage.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/printlanguage.cc
@@ -142,7 +142,7 @@ void PrintLanguage::pushOp(const OpToken *tok,const PcodeOp *op)
else
id = emit->openGroup();
}
- revpol.push_back(ReversePolish());
+ revpol.emplace_back();
revpol.back().tok = tok;
revpol.back().visited = 0;
revpol.back().paren = paren;
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/rangemap.hh b/Ghidra/Features/Decompiler/src/decompile/cpp/rangemap.hh
index ae8bb3e3f7..05e315ca0a 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/rangemap.hh
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/rangemap.hh
@@ -28,11 +28,10 @@
/// intervals. I.e. a map from a linear ordered domain to
/// (multiple) records.
/// 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
/// - getLast() end of range (inclusive)
/// - getSubsort() retrieve the subsorttype object (see below)
-/// - initialize(inittype,linetype,linetype) an initializer routine
///
/// The \b recordtype must define data-types:
/// - linetype
@@ -231,8 +230,7 @@ rangemap<_recordtype>::insert(const inittype &data,linetype a,linetype b)
unzip(f-1,low); // If so do the refinement
}
- record.push_front( _recordtype() );
- record.front().initialize( data, a, b );
+ record.emplace_front( data, a, b );
liter = record.begin();
AddrRange addrrange(b,(*liter).getSubsort());
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/rangeutil.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/rangeutil.cc
index 54980406bb..f583f1331d 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/rangeutil.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/rangeutil.cc
@@ -1939,7 +1939,7 @@ ValueSet *ValueSetSolver::ValueSetEdge::getNext(void)
void ValueSetSolver::newValueSet(Varnode *vn,int4 tCode)
{
- valueNodes.push_back(ValueSet());
+ valueNodes.emplace_back();
valueNodes.back().setVarnode(vn, tCode);
}
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/sleigh.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/sleigh.cc
index ce31bec378..0c2d470e06 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/sleigh.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/sleigh.cc
@@ -79,7 +79,7 @@ void PcodeCacher::addLabelRef(VarnodeData *ptr)
{ // Store off a reference to a label and the next instruction
// address
- label_refs.push_back(RelativeRecord());
+ label_refs.emplace_back();
label_refs.back().dataptr = ptr;
label_refs.back().calling_index = issued.size();
}
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/sleigh.hh b/Ghidra/Features/Decompiler/src/decompile/cpp/sleigh.hh
index 22b9c7a21a..6519a09900 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/sleigh.hh
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/sleigh.hh
@@ -53,7 +53,7 @@ public:
return expandPool(size);
}
PcodeData *allocateInstruction(void) {
- issued.push_back(PcodeData());
+ issued.emplace_back();
PcodeData *res = &issued.back();
res->outvar = (VarnodeData *)0;
res->invar = (VarnodeData *)0;
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/sleigh_arch.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/sleigh_arch.cc
index 1742e61a23..038bc379e6 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/sleigh_arch.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/sleigh_arch.cc
@@ -59,11 +59,11 @@ void LanguageDescription::restoreXml(const Element *el)
if (subel->getName() == "description")
description = subel->getContent();
else if (subel->getName() == "compiler") {
- compilers.push_back(CompilerTag());
+ compilers.emplace_back();
compilers.back().restoreXml(subel);
}
else if (subel->getName() == "truncate_space") {
- truncations.push_back(TruncationTag());
+ truncations.emplace_back();
truncations.back().restoreXml(subel);
}
}
@@ -113,7 +113,7 @@ void SleighArchitecture::loadLanguageDescription(const string &specfile,ostream
List::const_iterator iter;
for(iter=list.begin();iter!=list.end();++iter) {
if ((*iter)->getName() != "language") continue;
- description.push_back(LanguageDescription());
+ description.emplace_back();
description.back().restoreXml( *iter );
}
delete doc;
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/sleighbase.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/sleighbase.cc
index 59b6fd6445..5893acc878 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/sleighbase.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/sleighbase.cc
@@ -227,7 +227,7 @@ void SleighBase::restoreXml(const Element *el)
List::const_iterator iter;
iter = list.begin();
while((*iter)->getName() == "floatformat") {
- floatformats.push_back(FloatFormat());
+ floatformats.emplace_back();
floatformats.back().restoreXml(*iter);
++iter;
}
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/slgh_compile.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/slgh_compile.cc
index 64d30b516a..474bd7fa1f 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/slgh_compile.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/slgh_compile.cc
@@ -82,7 +82,7 @@ void SectionVector::append(ConstructTpl *rtl,SymbolScope *scope)
{
while(named.size() <= nextindex)
- named.push_back(RtlPair());
+ named.emplace_back();
named[ nextindex ] = RtlPair(rtl,scope);
}
@@ -2700,7 +2700,7 @@ void SleighCompile::checkUniqueAllocation(void)
void SleighCompile::pushWith(SubtableSymbol *ss,PatternEquation *pateq,vector<ContextChange *> *contvec)
{
- withstack.push_back(WithBlock());
+ withstack.emplace_back();
withstack.back().set(ss,pateq,contvec);
}
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/slghsymbol.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/slghsymbol.cc
index 8b9417e466..a600bd8806 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/slghsymbol.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/slghsymbol.cc
@@ -1803,7 +1803,7 @@ TokenPattern *Constructor::buildPattern(ostream &s)
}
// We should also check that recursion is rightmost extreme
recursion = true;
- oppattern.push_back(TokenPattern());
+ oppattern.emplace_back();
}
else
oppattern.push_back(*subsym->buildPattern(s));
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/space.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/space.cc
index b7e92c93b9..e5f5457c79 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/space.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/space.cc
@@ -546,7 +546,7 @@ uintb JoinSpace::restoreXmlAttributes(const Element *el,uint4 &size) const
}
int4 pos = (int4)(attrName[5] - '1');
while(pieces.size() <= pos)
- pieces.push_back(VarnodeData());
+ pieces.emplace_back();
VarnodeData &vdat( pieces[pos] );
string attrVal = el->getAttributeValue(i);
@@ -604,7 +604,7 @@ uintb JoinSpace::read(const string &s,int4 &size) const
int4 szsum = 0;
int4 i=0;
while(i < s.size()) {
- pieces.push_back(VarnodeData()); // Prepare to read next VarnodeData
+ pieces.emplace_back(); // Prepare to read next VarnodeData
string token;
while((i<s.size())&&(s[i]!=',')) {
token += s[i];
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/subflow.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/subflow.cc
index 8c75ed149d..bbb3f2ca70 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/subflow.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/subflow.cc
@@ -158,7 +158,7 @@ SubvariableFlow::ReplaceOp *SubvariableFlow::createOp(OpCode opc,int4 numparam,R
{
if (outrvn->def != (ReplaceOp *)0)
return outrvn->def;
- oplist.push_back(ReplaceOp());
+ oplist.emplace_back();
ReplaceOp *rop = &oplist.back();
outrvn->def = rop;
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)
{
- oplist.push_back(ReplaceOp());
+ oplist.emplace_back();
ReplaceOp *rop = &oplist.back();
rop->op = op;
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->isInputLocked() && (!fc->isDotdotdot())) return false;
- patchlist.push_back(PatchRecord());
+ patchlist.emplace_back();
patchlist.back().type = PatchRecord::parameter_patch;
patchlist.back().patchOp = op;
patchlist.back().in1 = rvn;
@@ -261,7 +261,7 @@ bool SubvariableFlow::tryReturnPull(PcodeOp *op,ReplaceVarnode *rvn,int4 slot)
worklist.push_back(rep);
else if (retvn->isConstant() && retop != op) {
// 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().patchOp = retop;
patchlist.back().in1 = rep;
@@ -271,7 +271,7 @@ bool SubvariableFlow::tryReturnPull(PcodeOp *op,ReplaceVarnode *rvn,int4 slot)
}
returnsTraversed = true;
}
- patchlist.push_back(PatchRecord());
+ patchlist.emplace_back();
patchlist.back().type = PatchRecord::parameter_patch;
patchlist.back().patchOp = op;
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->vn->getConsume()&~rvn->mask)!=0) // If there's something outside the mask being consumed
return false; // we can't trim
- patchlist.push_back(PatchRecord());
+ patchlist.emplace_back();
patchlist.back().type = PatchRecord::parameter_patch;
patchlist.back().patchOp = op;
patchlist.back().in1 = rvn;
@@ -1001,7 +1001,7 @@ bool SubvariableFlow::createCompareBridge(PcodeOp *op,ReplaceVarnode *inrvn,int4
SubvariableFlow::ReplaceVarnode *SubvariableFlow::addConstant(ReplaceOp *rop,uintb mask,
uint4 slot,uintb val)
{ // Add a constant to the replacement tree
- newvarlist.push_back(ReplaceVarnode());
+ newvarlist.emplace_back();
ReplaceVarnode *res = &newvarlist.back();
res->vn = (Varnode *)0;
res->replacement = (Varnode *)0;
@@ -1028,7 +1028,7 @@ SubvariableFlow::ReplaceVarnode *SubvariableFlow::addConstant(ReplaceOp *rop,uin
void SubvariableFlow::createNewOut(ReplaceOp *rop,uintb mask)
{
- newvarlist.push_back(ReplaceVarnode());
+ newvarlist.emplace_back();
ReplaceVarnode *res = &newvarlist.back();
res->vn = (Varnode *)0;
res->replacement = (Varnode *)0;
@@ -1063,7 +1063,7 @@ void SubvariableFlow::addPush(PcodeOp *pushOp,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().patchOp = pullop; // Operation pulling the variable out
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)
{
- patchlist.push_back(PatchRecord());
+ patchlist.emplace_back();
patchlist.back().type = PatchRecord::parameter_patch; // Keep the original op, just change input
patchlist.back().patchOp = pullop; // Operation pulling the variable out
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)
{
- 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().patchOp = pullop; // Operation pulling the variable out
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)
{
- patchlist.push_back(PatchRecord());
+ patchlist.emplace_back();
patchlist.back().type = PatchRecord::extension_patch;
patchlist.back().in1 = rvn;
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)
{
- patchlist.push_back(PatchRecord());
+ patchlist.emplace_back();
patchlist.back().type = PatchRecord::compare_patch;
patchlist.back().patchOp = op;
patchlist.back().in1 = in1;
@@ -2020,7 +2020,7 @@ TransformVar *LaneDivide::setReplacement(Varnode *vn,int4 numLanes,int4 skipLane
vn->setMark();
TransformVar *res = newSplit(vn, description, numLanes, skipLanes);
if (!vn->isFree()) {
- workList.push_back(WorkNode());
+ workList.emplace_back();
workList.back().lanes = res;
workList.back().numLanes = numLanes;
workList.back().skipLanes = skipLanes;
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/transform.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/transform.cc
index 312edc102e..c60d99bdb7 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/transform.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/transform.cc
@@ -380,7 +380,7 @@ TransformVar *TransformManager::newPreexistingVarnode(Varnode *vn)
TransformVar *TransformManager::newUnique(int4 size)
{
- newVarnodes.push_back(TransformVar());
+ newVarnodes.emplace_back();
TransformVar *res = &newVarnodes.back();
res->initialize(TransformVar::normal_temp,(Varnode *)0,size*8,size,0);
return res;
@@ -395,7 +395,7 @@ TransformVar *TransformManager::newUnique(int4 size)
TransformVar *TransformManager::newConstant(int4 size,int4 lsbOffset,uintb val)
{
- newVarnodes.push_back(TransformVar());
+ newVarnodes.emplace_back();
TransformVar *res = &newVarnodes.back();
res->initialize(TransformVar::constant,(Varnode *)0,size*8,size,(val >> lsbOffset) & calc_mask(size));
return res;
@@ -407,7 +407,7 @@ TransformVar *TransformManager::newConstant(int4 size,int4 lsbOffset,uintb val)
TransformVar *TransformManager::newIop(Varnode *vn)
{
- newVarnodes.push_back(TransformVar());
+ newVarnodes.emplace_back();
TransformVar *res = &newVarnodes.back();
res->initialize(TransformVar::constant_iop,(Varnode *)0,vn->getSize()*8,vn->getSize(),vn->getOffset());
return res;
@@ -499,7 +499,7 @@ TransformVar *TransformManager::newSplit(Varnode *vn,const LaneDescription &desc
TransformOp *TransformManager::newOpReplace(int4 numParams,OpCode opc,PcodeOp *replace)
{
- newOps.push_back(TransformOp());
+ newOps.emplace_back();
TransformOp &rop(newOps.back());
rop.op = replace;
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)
{
- newOps.push_back(TransformOp());
+ newOps.emplace_back();
TransformOp &rop(newOps.back());
rop.op = follow->op;
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)
{
- newOps.push_back(TransformOp());
+ newOps.emplace_back();
TransformOp &rop(newOps.back());
rop.op = originalOp;
rop.replacement = (PcodeOp *)0;
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/translate.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/translate.cc
index 7091ed6a47..6a397be4a4 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/translate.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/translate.cc
@@ -738,7 +738,7 @@ Address AddrSpaceManager::constructFloatExtensionAddress(const Address &realaddr
if (logicalsize == realsize)
return realaddr;
vector<VarnodeData> pieces;
- pieces.push_back(VarnodeData());
+ pieces.emplace_back();
pieces.back().space = realaddr.getSpace();
pieces.back().offset = realaddr.getOffset();
pieces.back().size = realsize;
@@ -790,8 +790,8 @@ Address AddrSpaceManager::constructJoinAddress(const Translate *translate,
}
// Otherwise construct a formal JoinRecord
vector<VarnodeData> pieces;
- pieces.push_back(VarnodeData());
- pieces.push_back(VarnodeData());
+ pieces.emplace_back();
+ pieces.emplace_back();
pieces[0].space = hiaddr.getSpace();
pieces[0].offset = hiaddr.getOffset();
pieces[0].size = hisz;
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/varmap.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/varmap.cc
index 4491016049..6e8b0ab779 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/varmap.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/varmap.cc
@@ -1342,15 +1342,15 @@ void ScopeLocal::addRecommendName(Symbol *sym)
SymbolEntry *entry = sym->getFirstWholeMap();
if (entry == (SymbolEntry *) 0) return;
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 {
- Address usepoint;
+ Address usepoint((AddrSpace *)0,0);
if (!entry->getUseLimit().empty()) {
const Range *range = entry->getUseLimit().getFirstRange();
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)
removeSymbol(sym);