[PATCH] D55701: [analyzer] Pass the correct loc Expr from VisitIncDecOp to evalStore

Rafael Stahl via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 7 07:11:06 PST 2019


r.stahl added a comment.

I tried adding isGLValue to evalStore and the test suite didn't complain. For evalLoad (on BoundEx) it failed in pretty much every test. Should the evalStore assert also go into trunk?

Since the analyzer behavior itself remains unchanged, I don't believe any other checker should be affected.

For myself it was pretty obvious that there is something weird going on when I didn't get the expected Stmt in my checker callback. So I added the following workaround. With this patch, the workaround is safely skipped.

The only change that this patch might cause "in the wild" is when someone used the Stmt as location, but didn't test with IncDecOps. However, as far as I can tell this should only have positive outcome.

Do I have any other means to check if other checkers were affected than to run the test suite?

  // Workaround for an inconsistency with IncDecOps: The statement is not the location expr.
  if (auto unaryE = dyn_cast<UnaryOperator>(S))
  {
    if (unaryE->isIncrementDecrementOp())
    {
      S = unaryE->getSubExpr();
    }
  }


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55701/new/

https://reviews.llvm.org/D55701





More information about the cfe-commits mailing list