[PATCH] D52957: [analyzer] Teach CallEvent about C++17 aligned new.

Balázs Benics via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 9 10:20:12 PST 2020


steakhal added a comment.

In D52957#2379330 <https://reviews.llvm.org/D52957#2379330>, @NoQ wrote:

> You cannot have an argument expression because there's no argument expression anywhere in the AST. There's an argument, but it's not computed as a value of any syntactic expression. If there was no argument, `getArgExpr(0)` would have crashed; but it returns a `nullptr` which indicates that there's no expression to return.

Aa, now I see. Thanks.

> 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()`?

> 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?


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