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

Artem Dergachev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 6 09:00:28 PST 2020


NoQ added a comment.

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.

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.

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.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D52957



More information about the llvm-commits mailing list