| 5892 | } |
| 5893 | |
| 5894 | static bool needsInitialization(const Variable* var) |
| 5895 | { |
| 5896 | if (!var) |
| 5897 | return false; |
| 5898 | if (var->hasDefault()) |
| 5899 | return false; |
| 5900 | if (var->isPointer()) |
| 5901 | return true; |
| 5902 | if (var->type() && var->type()->isUnionType()) |
| 5903 | return false; |
| 5904 | if (!var->nameToken()->isCpp()) |
| 5905 | return true; |
| 5906 | if (var->type() && var->type()->needInitialization == Type::NeedInitialization::True) |
| 5907 | return true; |
| 5908 | if (var->valueType()) { |
| 5909 | if (var->valueType()->isPrimitive()) |
| 5910 | return true; |
| 5911 | if (var->valueType()->type == ValueType::Type::POD) |
| 5912 | return true; |
| 5913 | if (var->valueType()->type == ValueType::Type::ITERATOR) |
| 5914 | return true; |
| 5915 | if (var->isStlType() && var->isArray()) { |
| 5916 | if (const Token* ctt = var->valueType()->containerTypeToken) { |
| 5917 | if (ctt->isStandardType()) |
| 5918 | return true; |
| 5919 | const Type* ct = ctt->type(); |
| 5920 | if (ct && ct->needInitialization == Type::NeedInitialization::True) |
| 5921 | return true; |
| 5922 | } |
| 5923 | } |
| 5924 | } |
| 5925 | return false; |
| 5926 | } |
| 5927 | |
| 5928 | static void addToErrorPath(ValueFlow::Value& value, const ValueFlow::Value& from) |
| 5929 | { |
no test coverage detected