[clang] [analyzer] Adjust ExprEngine::VisitDeclStmt to ignore `T v=v;` idiom cases for C code (PR #187530)
Ella Ma via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 23 03:44:32 PDT 2026
Snape3058 wrote:
My idea is to just keep my current matcher (DeclStmt -> VarDecl -> ImpCast (L2R) -> DeclRefExpr), which will ignore all C++ constructor invocations, and exclude the C++ ref types from the matcher only, which makes the UndefinedAssignmentChecker report for ref type self-assignments. The reasons are that constructor calls are evaluated before the assignment, so if there are copy ctor calls, ignoring the bind here makes fewer differences. Besides, it seems that in the case of copy ctor calls, the UndefinedAssignmentChecker::checkBind checker will not be hit (according to my tests with @steakhal 's example https://godbolt.org/z/jPEa4sfeM above).
https://github.com/llvm/llvm-project/pull/187530
More information about the cfe-commits
mailing list