| 820 | } |
| 821 | |
| 822 | static void valueFlowPointerAlias(TokenList& tokenlist, const Settings& settings) |
| 823 | { |
| 824 | for (Token* tok = tokenlist.front(); tok; tok = tok->next()) { |
| 825 | // not address of |
| 826 | if (!tok->isUnaryOp("&")) |
| 827 | continue; |
| 828 | |
| 829 | // parent should be a '=' |
| 830 | if (!Token::simpleMatch(tok->astParent(), "=")) |
| 831 | continue; |
| 832 | |
| 833 | // child should be some buffer or variable |
| 834 | const Token* vartok = tok->astOperand1(); |
| 835 | while (vartok) { |
| 836 | if (vartok->str() == "[") |
| 837 | vartok = vartok->astOperand1(); |
| 838 | else if (vartok->str() == "." || vartok->str() == "::") |
| 839 | vartok = vartok->astOperand2(); |
| 840 | else |
| 841 | break; |
| 842 | } |
| 843 | if (!(vartok && vartok->variable() && !vartok->variable()->isPointer())) |
| 844 | continue; |
| 845 | |
| 846 | ValueFlow::Value value; |
| 847 | value.valueType = ValueFlow::Value::ValueType::TOK; |
| 848 | value.tokvalue = tok; |
| 849 | setTokenValue(tok, std::move(value), settings); |
| 850 | } |
| 851 | } |
| 852 | |
| 853 | static void valueFlowBitAnd(TokenList& tokenlist, const Settings& settings) |
| 854 | { |
no test coverage detected