[clang] Reland "[AllocToken] Infer the allocated type from placement new into the result" (PR #244809)

David Li via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 25 15:01:09 PST 2026


https://github.com/david-xl commented:

Closing per the discussion above: since simple source changes get the same result, we'll do those instead of extending the inference, e.g. a sizeof hint at the allocation call in the hot pointer-free wrappers (absl's CordRepFlat among them). Some compiler-side follow-ups are still worth pursuing:

- #244314, now independent of this PR, propagates a call-site hint through inlined malloc_span wrappers, so size-returning wrappers can be typed per call site (the "propagate a hint through inlinable wrappers" idea above).
- An optimization remark listing allocation calls that end up with the fallback token would make the remaining source cleanups easy to find and keep them from regressing.

We can revisit placement-new inference if source hints stop scaling. Thanks for the review!

https://github.com/llvm/llvm-project/pull/244809


More information about the cfe-commits mailing list