[PATCH] D99344: [Analyzer] Track RValue expressions
Gabor Marton via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 29 06:43:15 PDT 2021
martong marked an inline comment as done.
martong added inline comments.
================
Comment at: clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp:1944-1945
+ return;
+ if (!BO->isMultiplicativeOp())
+ return;
+
----------------
steakhal wrote:
> There are only 3 multiplicative operators:
> ```
> BINARY_OPERATION(Mul, "*")
> BINARY_OPERATION(Div, "/")
> BINARY_OPERATION(Rem, "%")
> ```
> So, the opcode can never be `BO_MulAssign` later.
> The comment for the else block is also inaccurate for the same reason.
Yep, good catch! The reason why the assignment test case passed is that we already handle assignment operations in the `FindLastStoreBRVisitor`.
// If this is an assignment expression, we can track the value
// being assigned.
if (Optional<PostStmt> P = Succ->getLocationAs<PostStmt>())
if (const BinaryOperator *BO = P->getStmtAs<BinaryOperator>())
if (BO->isAssignmentOp())
InitE = BO->getRHS();
So, I could just remove the handling of the assignment from the new function.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D99344/new/
https://reviews.llvm.org/D99344
More information about the cfe-commits
mailing list