[PATCH] D52957: [analyzer] Teach CallEvent about C++17 aligned new.
Artem Dergachev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 9 14:04:39 PST 2020
NoQ added a comment.
In D52957#2383373 <https://reviews.llvm.org/D52957#2383373>, @steakhal wrote:
> In D52957#2379330 <https://reviews.llvm.org/D52957#2379330>, @NoQ wrote:
>
>> The argument value can be computed by taking the size of the type (and aligning to the requested alignment, i guess(?)) and multiplying it by array size (for which there is an expression) in case of array new. It'd be great to write down these computations once in the `CallEvent` class and then re-use them.
>
> Should I provide them as member functions to the `CXXAllocatorCall ` class?
> Something like `size_t getAlignment()` and `size_t getAllocationSize()`?
Yes. Note that allocation size is not necessarily concrete, so you'll have to return an `SVal` there. Alignment, i guess, is always concrete (?) you'll probably still want to return an `SVal` because a lot of users will want an `SVal` anyway.
>> I guess the actual shocking truth here is that we've never performed these computations when inlining the allocators; the size argument that's bound to the size parameter in the Store while the allocator body is inlined ended up being a fresh symbol, which is not correct.
>
> I might miss something to understand this. Could you elaborate on that if you think is related?
For `CXXAllocatorCall`'s implicit arguments `getArgSVal()` always fails and returns an `UnknownVal` as it stumbles upon lack of expression and doesn't know how to work around it. In particular, it fails in `addParameterValuesToBindings()` which leaves the respective Store bindings empty.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D52957/new/
https://reviews.llvm.org/D52957
More information about the cfe-commits
mailing list