Fix for the bug n°39792: False positive on strcpy targeting struct member
Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=39792
I fixed it by replacing the use of dyn_cast by two isas to check if Target is a DeclRefExpr or a MemberExpr.
The removal of the DeclRef variable seems to be meaningless because the only place where the DeclRef variable was used is one line below, and it was used to call a method which is inherited from Expr.
Thus, replacing the only use of DeclRef by Target should have no effect.
I also added a small test for this bugfix in test/Analysis/security-syntax-checks.m
Note: I think we can completely remove the outer if (isa<DeclRefExpr>(Target) || isa<MemberExpr>(Target)), no? Why should we only allow DeclRefExprs to pass this check?
PS: This is my first contribution ever to CLang (or any other open source project), so I'm totally open to feedback, even if it's harsh.
Thank you for your attention!
No need for this newline.