[PATCH] D44552: [Coroutines] Find custom allocators in class scope
Brian Gesiak via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 15 23:26:54 PDT 2018
modocache created this revision.
modocache added reviewers: GorNishanov, eric_niebler, lewissbaker.
Herald added a subscriber: EricWF.
https://reviews.llvm.org/rL325291 implemented Coroutines TS N4723
section [dcl.fct.def.coroutine]/7, but it performed lookup of allocator
functions within both the global and class scope, whereas the specified
behavior is to perform lookup for custom allocators within just the
To fix, add parameters to the `Sema::FindAllocationFunctions` function
such that it can be used to lookup allocators in global scope,
class scope, or both (instead of just being able to look up in just global
scope or in both global and class scope). Then, use those parameters
from within the coroutine Sema.
This incorrect behavior had the unfortunate side-effect of causing the
bug https://bugs.llvm.org/show_bug.cgi?id=36578 (or at least the reports
of that bug in C++ programs). That bug would occur for any C++ user with
a coroutine frame that took a single pointer argument, since it would
then find the global placement form `operator new`, described in the
C++ standard 22.214.171.124.1. This patch prevents Clang from generating code
that triggers the LLVM assert described in that bug report.
Test Plan: `check-clang`
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 12420 bytes
Desc: not available
More information about the cfe-commits