Fix FP redundantPointerOp (#4058)
* Fix #10991 FN: Redundant pointer operation * Fix FP redundantPointerOp * Check for LValue
This commit is contained in:
parent
3d3885d151
commit
8dbe6994a2
|
@ -2951,7 +2951,7 @@ void CheckOther::checkRedundantPointerOp()
|
|||
|
||||
// variable
|
||||
const Token *varTok = tok->astOperand1()->astOperand1();
|
||||
if (!varTok || varTok->isExpandedMacro())
|
||||
if (!varTok || varTok->isExpandedMacro() || (!addressOfDeref && varTok->valueType() && varTok->valueType()->pointer && varTok->valueType()->reference == Reference::LValue))
|
||||
continue;
|
||||
|
||||
const Variable *var = varTok->variable();
|
||||
|
|
|
@ -8774,6 +8774,9 @@ private:
|
|||
"[test.cpp:4]: (style) Redundant pointer operation on 'value' - it's already a variable.\n",
|
||||
errout.str());
|
||||
|
||||
check("void f(int**& p) {}\n", nullptr, false, true);
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// no warning for bitwise AND
|
||||
check("void f(const int *b) {\n"
|
||||
" int x = 0x20 & *b;\n"
|
||||
|
|
Loading…
Reference in New Issue