| 56 | static const std::array<std::pair<std::string, std::string>, 5> alloc_success_conds {{{"!=", "0"}, {">", "0"}, {"!=", "-1"}, {">=", "0"}, {">", "-1"}}}; |
| 57 | |
| 58 | static bool isAutoDeallocType(const Type* type) { |
| 59 | if (!type || !type->classScope) |
| 60 | return true; |
| 61 | if (type->classScope->numConstructors > 0) |
| 62 | return true; |
| 63 | const std::list<Variable>& varlist = type->classScope->varlist; |
| 64 | if (std::any_of(varlist.begin(), varlist.end(), [](const Variable& v) { |
| 65 | return !v.valueType() || (!v.valueType()->isPrimitive() && !v.valueType()->container); |
| 66 | })) |
| 67 | return true; |
| 68 | if (std::none_of(type->derivedFrom.cbegin(), type->derivedFrom.cend(), [](const Type::BaseInfo& bi) { |
| 69 | return isAutoDeallocType(bi.type); |
| 70 | })) |
| 71 | return false; |
| 72 | return true; |
| 73 | } |
| 74 | |
| 75 | /** |
| 76 | * @brief Is variable type some class with automatic deallocation? |
no test coverage detected