Merge pull request #2721 from KenPatrickLehrmann/compound_assign_bitshift
Add missing operators <<= and >>=
This commit is contained in:
commit
fab3a8efc8
|
@ -2106,6 +2106,10 @@ static bool evalAssignment(ValueFlow::Value &lhsValue, const std::string &assign
|
|||
lhsValue.intvalue |= rhsValue.intvalue;
|
||||
else if (assign == "^=")
|
||||
lhsValue.intvalue ^= rhsValue.intvalue;
|
||||
else if (assign == "<<=")
|
||||
lhsValue.intvalue <<= rhsValue.intvalue;
|
||||
else if (assign == ">>=")
|
||||
lhsValue.intvalue >>= rhsValue.intvalue;
|
||||
else
|
||||
return false;
|
||||
} else if (lhsValue.isFloatValue()) {
|
||||
|
|
|
@ -2530,6 +2530,20 @@ private:
|
|||
" return x;\n"
|
||||
"}";
|
||||
ASSERT_EQUALS(true, testValueOfX(code, 4U, 123.45F + 67, 0.01F));
|
||||
|
||||
code = "void f() {\n"
|
||||
" int x = 123;\n"
|
||||
" x >>= 1;\n"
|
||||
" return x;\n"
|
||||
"}";
|
||||
ASSERT_EQUALS(true, testValueOfX(code, 4U, 61));
|
||||
|
||||
code = "void f() {\n"
|
||||
" int x = 123;\n"
|
||||
" x <<= 1;\n"
|
||||
" return x;\n"
|
||||
"}";
|
||||
ASSERT_EQUALS(true, testValueOfX(code, 4U, 246));
|
||||
}
|
||||
|
||||
void valueFlowForwardCorrelatedVariables() {
|
||||
|
|
Loading…
Reference in New Issue