@@ -413,8 +413,6 @@ bool CheckLeakAutoVar::checkScope(const Token * const startToken,
413
413
// assignment..
414
414
if (const Token* const tokAssignOp = isInit ? varTok : isAssignment (varTok)) {
415
415
416
- if (Token::simpleMatch (tokAssignOp->astOperand1 (), " ." ))
417
- continue ;
418
416
// taking address of another variable..
419
417
if (Token::Match (tokAssignOp, " = %var% +|;|?|%comp%" )) {
420
418
if (varTok->tokAt (2 )->varId () != varTok->varId ()) {
@@ -730,8 +728,7 @@ bool CheckLeakAutoVar::checkScope(const Token * const startToken,
730
728
VarInfo::AllocInfo allocation (af ? af->groupId : 0 , VarInfo::DEALLOC, ftok);
731
729
if (allocation.type == 0 )
732
730
allocation.status = VarInfo::NOALLOC;
733
- if (Token::simpleMatch (ftok->astParent (), " (" ) && Token::simpleMatch (ftok->astParent ()->astOperand2 (), " ." ))
734
- continue ;
731
+
735
732
functionCall (ftok, openingPar, varInfo, allocation, af);
736
733
737
734
tok = ftok->linkAt (1 );
@@ -886,7 +883,7 @@ const Token * CheckLeakAutoVar::checkTokenInsideExpression(const Token * const t
886
883
while (rhs->isCast ()) {
887
884
rhs = rhs->astOperand2 () ? rhs->astOperand2 () : rhs->astOperand1 ();
888
885
}
889
- if (rhs->varId () == tok->varId () && isAssignment) {
886
+ if (( rhs->str () == " . " || rhs-> varId () == tok->varId () ) && isAssignment) {
890
887
// simple assignment
891
888
varInfo.erase (tok->varId ());
892
889
} else if (rhs->astParent () && rhs->str () == " (" && !mSettings ->library .returnValue (rhs->astOperand1 ()).empty ()) {
@@ -1024,7 +1021,10 @@ void CheckLeakAutoVar::functionCall(const Token *tokName, const Token *tokOpenin
1024
1021
arg = arg->astOperand2 () ? arg->astOperand2 () : arg->astOperand1 ();
1025
1022
const Token * const argTypeStartTok = arg;
1026
1023
1027
- while (Token::Match (arg, " %name% :: %name%" ))
1024
+ if (Token::simpleMatch (arg, " ." ))
1025
+ arg = arg->next ();
1026
+
1027
+ while (Token::Match (arg, " %name% .|:: %name%" ))
1028
1028
arg = arg->tokAt (2 );
1029
1029
1030
1030
if ((Token::Match (arg, " %var% [-,)] !!." ) && !(arg->variable () && arg->variable ()->isArray ())) ||
0 commit comments