[PATCH] D38801: [analyzer] In getSVal() API, disable auto-detection of void type as char type.

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 30 04:34:56 PDT 2017


NoQ added a comment.

Yeah, cleaning up this API would be great - as long as everybody loves to have the API broken and rewrite stuff.

If we are to simplify some APIs, i'd definitely start with `getAsSymExpr()`/`getAsSymbol()`/`getAsSymbolicExpression()`.

Essentially we only need `getSVal(MR)` because only `MR` can be bound to, while other types of `Loc` cannot be bound to. Technically, only (base `MR`, offset) pairs can be bound to, but this is "implementation detail" that we're still trying to keep that way (even though it leaks like hell everywhere). So i'd rather think of the `Loc` overload as of a convenient wrapper (i.e., the user receives `Loc` in some `checkLocation` callback, so he wants to put it directly into the API to find his binding). And people would still need to operate with regions from time to time (eg., construct a sub-region manually when we expect it to be there, or strip casts).

Also the overload between `getSVal(Ex, LC)` and `getSVal(R, Ty)`, when they do completely different things, seems confusing.


https://reviews.llvm.org/D38801





More information about the cfe-commits mailing list