| 858 | // Check if its an alias of the variable or is being aliased to this variable |
| 859 | template<typename V> |
| 860 | static bool isAliasOf(const Variable * var, const Token *tok, nonneg int varid, const V& values, bool* inconclusive = nullptr) |
| 861 | { |
| 862 | if (tok->varId() == varid) |
| 863 | return false; |
| 864 | if (tok->varId() == 0) |
| 865 | return false; |
| 866 | if (isAliasOf(tok, varid, inconclusive)) |
| 867 | return true; |
| 868 | if (var && !var->isPointer()) |
| 869 | return false; |
| 870 | // Search through non value aliases |
| 871 | return std::any_of(values.begin(), values.end(), [&](const ValueFlow::Value& val) { |
| 872 | if (!val.isNonValue()) |
| 873 | return false; |
| 874 | if (val.isInconclusive()) |
| 875 | return false; |
| 876 | if (val.isLifetimeValue() && !val.isLocalLifetimeValue()) |
| 877 | return false; |
| 878 | if (val.isLifetimeValue() && val.lifetimeKind != ValueFlow::Value::LifetimeKind::Address) |
| 879 | return false; |
| 880 | if (!Token::Match(val.tokvalue, ".|&|*|%var%")) |
| 881 | return false; |
| 882 | return astHasVar(val.tokvalue, tok->varId()); |
| 883 | }); |
| 884 | } |
| 885 | |
| 886 | struct MultiValueFlowAnalyzer : ValueFlowAnalyzer { |
| 887 | class SelectValueFromVarIdMapRange { |