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

Balázs Benics via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 6 08:05:22 PST 2020


steakhal added a comment.

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

> Everything looks good to me here. The new-expression `new int;` has 1 implicit argument (allocation size passed to the implementation of operator new, the value is probably 4) and 0 placement arguments (the ones that are explicitly written down after `new` and before `int`). See also https://en.cppreference.com/w/cpp/language/new#Placement_new.

I'm still confused.

  alloc->getNumImplicitArgs(): 1
  alloc->getNumArgs(): 1
  alloc->getArgExpr(0): nullptr

I would expect `alloc->getArgExpr(0)` to return the //implicit// parameter, aka. the size of the placement new.
I can not see any other `getXX` function which seems applicable. My best bet was the `getPlacementArgExpr` thus I raised this issue here.

How can I access the placement new's allocation size of an `CXXAllocatorCall` if not via `getArgExpr()`?


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