[PATCH] D81718: [Analyzer][NFC] Add methods `getReturnObject()` and `getArgObject()` to `CallEvent`

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 12 03:12:37 PDT 2020


NoQ added a comment.

No, please don't do this.

The checker should *always* know the nature of the object in advance. If you look at the SVal in order to figure out the nature of the object, you are unable to discriminate between objects of completely different nature that are intentionally represented by the same SVal. For example, if you receive a SymbolicRegion value as a return value from your `getReturnObject()`, this can be for two reasons: (1) you're returning a pointer, (2) you're returning an object into that region. And you can't discriminate between those cases by looking at the SVal.

Both arbitrary glvalues and pointer prvalues are represented by Loc values but any code that fails to discriminate between the value of expression E and the value of ImplicitCastExpr(E, CK_LValueToRValue) is bonkers.

See also D77062#inline-744287 <https://reviews.llvm.org/D77062#inline-744287>


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81718





More information about the cfe-commits mailing list