mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
Fix marked as false positive knownConditionTrueFalse cppcheck warnings
std::make_shared<> does not return null, it throws std::bad_alloc.
This commit is contained in:
parent
cd1e13d4d2
commit
a1fbe84660
@ -206,10 +206,6 @@ void makeCFG_top_edge(GoughGraph &cfg, const vector<GoughVertex> &vertices,
|
||||
assert(contains(src_slots, slot_id));
|
||||
|
||||
shared_ptr<GoughSSAVarMin> vmin = make_shared<GoughSSAVarMin>();
|
||||
if (!vmin) {
|
||||
assert(0);
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
cfg[e].vars.emplace_back(vmin);
|
||||
final_var = vmin.get();
|
||||
|
||||
@ -321,10 +317,6 @@ void makeCFG_edge(GoughGraph &cfg, const map<u32, u32> &som_creators,
|
||||
DEBUG_PRINTF("bypassing min on join %u\n", slot_id);
|
||||
} else {
|
||||
shared_ptr<GoughSSAVarMin> vmin = make_shared<GoughSSAVarMin>();
|
||||
if (!vmin) {
|
||||
assert(0);
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
cfg[e].vars.emplace_back(vmin);
|
||||
final_var = vmin.get();
|
||||
|
||||
|
@ -2445,10 +2445,6 @@ static
|
||||
bool doLitHaigSom(NG &ng, const NGHolder &g, som_type som) {
|
||||
ue2_literal lit;
|
||||
shared_ptr<NGHolder> rhs = make_shared<NGHolder>();
|
||||
if (!rhs) {
|
||||
assert(0);
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
if (!ng.cc.grey.allowLitHaig) {
|
||||
return false;
|
||||
}
|
||||
@ -2513,10 +2509,6 @@ bool doHaigLitHaigSom(NG &ng, NGHolder &g,
|
||||
ue2_literal lit;
|
||||
shared_ptr<NGHolder> rhs = make_shared<NGHolder>();
|
||||
shared_ptr<NGHolder> lhs = make_shared<NGHolder>();
|
||||
if (!rhs || !lhs) {
|
||||
assert(0);
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
|
||||
if (!splitOffBestLiteral(g, regions, &lit, &*lhs, &*rhs, ng.cc)) {
|
||||
return false;
|
||||
|
@ -1035,11 +1035,6 @@ bool splitRoseEdge(const NGHolder &base_graph, RoseInGraph &vg,
|
||||
shared_ptr<NGHolder> lhs = make_shared<NGHolder>();
|
||||
shared_ptr<NGHolder> rhs = make_shared<NGHolder>();
|
||||
|
||||
if (!lhs || !rhs) {
|
||||
assert(0);
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
|
||||
unordered_map<NFAVertex, NFAVertex> lhs_map;
|
||||
unordered_map<NFAVertex, NFAVertex> rhs_map;
|
||||
|
||||
@ -1233,10 +1228,6 @@ void splitEdgesByCut(const NGHolder &h, RoseInGraph &vg,
|
||||
DEBUG_PRINTF("splitting on pivot %zu\n", h[pivot].index);
|
||||
unordered_map<NFAVertex, NFAVertex> temp_map;
|
||||
shared_ptr<NGHolder> new_lhs = make_shared<NGHolder>();
|
||||
if (!new_lhs) {
|
||||
assert(0);
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
splitLHS(h, pivot, new_lhs.get(), &temp_map);
|
||||
|
||||
/* want to cut off paths to pivot from things other than the pivot -
|
||||
@ -1318,10 +1309,7 @@ void splitEdgesByCut(const NGHolder &h, RoseInGraph &vg,
|
||||
if (!contains(done_rhs, adj)) {
|
||||
unordered_map<NFAVertex, NFAVertex> temp_map;
|
||||
shared_ptr<NGHolder> new_rhs = make_shared<NGHolder>();
|
||||
if (!new_rhs) {
|
||||
assert(0);
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
|
||||
splitRHS(h, adj, new_rhs.get(), &temp_map);
|
||||
remove_edge(new_rhs->start, new_rhs->accept, *new_rhs);
|
||||
remove_edge(new_rhs->start, new_rhs->acceptEod, *new_rhs);
|
||||
@ -2293,10 +2281,7 @@ void splitEdgesForSuffix(const NGHolder &base_graph, RoseInGraph &vg,
|
||||
assert(!splitters.empty());
|
||||
|
||||
shared_ptr<NGHolder> lhs = make_shared<NGHolder>();
|
||||
if (!lhs) {
|
||||
assert(0);
|
||||
throw bad_alloc();
|
||||
}
|
||||
|
||||
unordered_map<NFAVertex, NFAVertex> v_map;
|
||||
cloneHolder(*lhs, base_graph, &v_map);
|
||||
lhs->kind = NFA_INFIX;
|
||||
|
@ -561,10 +561,7 @@ bool handleMixedPrefixCliche(const NGHolder &h, RoseGraph &g, RoseVertex v,
|
||||
DEBUG_PRINTF("woot?\n");
|
||||
|
||||
shared_ptr<NGHolder> h_new = make_shared<NGHolder>();
|
||||
if (!h_new) {
|
||||
assert(0);
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
|
||||
unordered_map<NFAVertex, NFAVertex> rhs_map;
|
||||
vector<NFAVertex> exits_vec;
|
||||
insert(&exits_vec, exits_vec.end(), exits);
|
||||
|
Loading…
x
Reference in New Issue
Block a user